14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER START
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file are subject to the terms of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Common Development and Distribution License (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may not use this file except in compliance with the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * or http://www.opensolaris.org/os/licensing.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * See the License for the specific language governing permissions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * and limitations under the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * When distributing Covered Code, include this CDDL HEADER in each
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * If applicable, add the following below this CDDL HEADER, with the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER END
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Use is subject to license terms.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on library net.d
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on library scsi.d
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on module genunix
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on module fct
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * FC port information.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct fc_port_info {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string fcp_node_wwn; /* node WWN */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string fcp_sym_node_name; /* node symbolic name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string fcp_sym_port_name; /* port symbolic name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t fcp_port_hard_address; /* port hard address */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} fc_port_info_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * FC transfer info (somewhat analogous to iscsiinfo_t)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Represents data transfer details.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct fc_xferinfo {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t fcx_len;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t fcx_offset;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint16_t fcx_flags; /* db_flags as defined in sys/stmf.h */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} fc_xferinfo_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * conninfo translators
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for conninfo, translating from the local port.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator conninfo_t < fct_local_port_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_local = P->port_pwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->port_pwwn_str : "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_remote = "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_protocol = "fc";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for conninfo, translating from the local port implementation.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator conninfo_t < fct_i_local_port_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_local = P->iport_port->port_pwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->iport_port->port_pwwn_str : "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_remote = "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_protocol = "fc";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for conninfo, translating from fct cmd struct.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator conninfo_t < fct_cmd_t *C > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_local = (C->cmd_port ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (C->cmd_port->port_pwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync C->cmd_port->port_pwwn_str : "<unknown>") :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<unknown>");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_remote = (C->cmd_rp ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (C->cmd_rp->rp_pwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync C->cmd_rp->rp_pwwn_str : "<unknown>") :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<unknown>");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_protocol = "fc";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * fc_port_info_t translators.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for fc_port_info_t, translating from the local port.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator fc_port_info_t < fct_local_port_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* node WWN */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_node_wwn = P->port_nwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->port_nwwn_str : "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* node symbolic name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_sym_node_name = P->port_sym_node_name ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->port_sym_node_name : `utsname.nodename;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* port symbolic name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_sym_port_name = P->port_sym_port_name ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->port_sym_port_name : "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* port hard address */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_port_hard_address = P->port_hard_address;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for fc_port_info_t, translating from the local port impl.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator fc_port_info_t < fct_i_local_port_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* node WWN */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_node_wwn = (P->iport_port ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->iport_port->port_nwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->iport_port->port_nwwn_str :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<unknown>") :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<bad iport_port ptr>");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_sym_node_name =
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->iport_port ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->iport_port->port_sym_node_name ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->iport_port->port_sym_node_name : "<unknown>") :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<bad iport_port ptr>");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_sym_port_name =
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->iport_port ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->iport_port->port_sym_port_name ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->iport_port->port_sym_port_name : "<unknown>") :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<bad iport_port ptr>");
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_port_hard_address =
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->iport_port ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->iport_port->port_hard_address : 0);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for fc_port_info, translating from the remote port impl
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator fc_port_info_t < fct_i_remote_port_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* node WWN */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_node_wwn = P->irp_rp ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (P->irp_rp->rp_nwwn_str[0] ?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync P->irp_rp->rp_nwwn_str : "<unknown>") :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* node symbolic name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_sym_node_name = P->irp_snn ? P->irp_snn : "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* port symbolic name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_sym_port_name = P->irp_spn ? P->irp_spn : "<unknown>";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* port hard address */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcp_port_hard_address = P->irp_rp ? P->irp_rp->rp_id : 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Translator for fc_xferinfo, translating from stmf_data_buf_t.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator fc_xferinfo_t < stmf_data_buf_t *B > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcx_len = B->db_data_size;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcx_offset = B->db_relative_offset;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fcx_flags = B->db_flags;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};