fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _FCTL_PRIVATE_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _FCTL_PRIVATE_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/note.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/impl/fc_ulpif.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Stuff strictly internal to fctl that
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * isn't exposed to any other modules.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PWWN_HASH_TABLE_SIZE (32) /* 2^n */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define D_ID_HASH_TABLE_SIZE (32) /* 2^n */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NWWN_HASH_TABLE_SIZE (32) /* 2^n */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define HASH_FUNC(key, size) ((key) & (size - 1))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define WWN_HASH_KEY(x) ((x)[0] + (x)[1] + (x)[2] +\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (x)[3] + (x)[4] + (x)[5] +\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (x)[6] + (x)[7])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define D_ID_HASH_FUNC(x, size) ((x) & (size - 1))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC4_TYPE_WORD_POS(x) ((uchar_t)(x) >> 5)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC4_TYPE_BIT_POS(x) ((uchar_t)(x) & 0x1F)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ACTION_INVALID -1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_REASON_INVALID -1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_EXPLN_INVALID -1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Internally translated and used state change values to ULPs
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_STATEC_DONT_CARE 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_STATEC_ONLINE 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_STATEC_OFFLINE 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_STATEC_OFFLINE_TIMEOUT 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_ADD_RETRY_COUNT 90
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_MAX_TRACE_BUF_LEN 512
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_NPIV_MAX_PORT 255
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port_dstate values
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ULP_PORT_ATTACH 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ULP_PORT_SUSPEND 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ULP_PORT_POWER_DOWN 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ULP_PORT_BUSY 0x08
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCTL_DISALLOW_CALLBACKS(x) (!((x) & ULP_PORT_ATTACH) ||\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((x) & ULP_PORT_BUSY))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ulp_ports {
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct ulp_ports *port_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_dstate;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t port_statec;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t port_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_local_port *port_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_ulp_ports_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ulp_module {
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct ulp_module *mod_next;
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed fc_ulp_modinfo_t *mod_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_ports_t *mod_ports;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_ulp_module_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ulp_list {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_modinfo_t *ulp_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct ulp_list *ulp_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_ulp_list_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fca_port {
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fca_port *port_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_local_port *port_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_fca_port_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct timed_counter {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct timed_counter *sig;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t counter;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t max_value;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t maxed_out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t active;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte clock_t timer;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte timeout_id_t tid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} timed_counter_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Struct describing a remote node. A remote node is associated with one
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or more remote ports (fc_remote_port_t structs) that are all accessible
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * through one local port (fc_local_port_t struct).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each fc_remote_node_t struct is also referenced by nwwn in the global
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * nwwn_hash_table[] list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_remote_node {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Mutex lock to protect access to all members of this struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Current implementation dictates acquisition of fd_mutex before
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pd_mutex can be acquired (when both locks must be acquired).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t fd_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Node WWN for the remote node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t fd_node_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is the number of (active) fc_remote_port_t structs that
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are associated with this remote node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fd_numports;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Tracks whether this struct is "valid" or "invalid", using the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FC_REMOTE_NODE_* values given above.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fd_flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Linked list of remote ports associated with this remote node. */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_port *fd_portlistp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fd_ipa[8]; /* Initial proc assoc */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fd_vv[16]; /* Vendor Version */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fd_snn_len; /* node symbolic name len */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fd_snn[255]; /* node symbolic name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_remote_node_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Stack depth for troubleshooting (only used in debug code)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_STACK_DEPTH 14
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The fc_remote_port_t struct represents a remote FC port that is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * accessible via the local FC port (fc_local_port_t). Each remote
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FC port is associated with one FC local port (fc_local_port_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * above) and one remote FC node (fc_remote_node_t, see below).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fc_remote_port_t structs are created and destroyed as needed to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * correspond with changing conditions out on the link.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_remote_port {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Ah, the infamous 'pd_mutex' that has given developers so much
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * joy over the years....
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (Gotta love the original, extremely helpful comment.)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t pd_mutex; /* mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portid_t pd_port_id; /* Port Identifier */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t pd_port_name; /* the port WWN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reference count of the # of logins initiated by a ULP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (i.e., this is the # of ULPs accessing the struct). See
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fp_plogi_group() for more info.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int pd_login_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This appears to track the login state of the remote FC port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used with the PORT_DEVICE_* macros in fc_appif.h.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t pd_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Link pointers for the port wwn and D_ID hash lists. These point
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the next remote port in the current hash chain.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_port *pd_wwn_hnext;
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_port *pd_did_hnext;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Link pointer for list of *all* fc_remote_port_t structs
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * associated with the same fc_local_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_port *pd_port_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Pointer to the fc_remote_node_t struct for the remote node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * associated with the remote port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_node *pd_remote_nodep;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* port type for the remote port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_porttype_t pd_porttype;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_hardaddr_t pd_hard_addr; /* Hard Address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Back pointer to the fc_local_port_t struct for the local port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * associated with this remote port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_local_port *pd_port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (Sigh) this actually doesn't have anything to do with the "type"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the remote port per se. It's really more an indicator of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * most recently known state/status of the remote port. It's intended
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to help figure out if/how the remote port has either gone away or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * changed somehow after an event has occurred on the link.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * There also seems to be some connection to the "changed map".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The legal values for this are the PORT_DEVICE_* definitions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * earlier in this file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t pd_type; /* new or old */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This tracks the current state/status of a login attempt at the
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * remote port. Legal values are given above.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See also the pd_state field.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t pd_flags; /* login in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t pd_login_class; /* Logi Class */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Legal values are given above (beware of the mipselling) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t pd_recepient; /* who did PLOGI? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t pd_ip_addr[8]; /* IP address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t pd_fc4types[8]; /* FC-4 types */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t pd_cos; /* class of service */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct common_service pd_csp; /* common service */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct service_param pd_clsp1; /* Class 1 */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct service_param pd_clsp2; /* Class 2 */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct service_param pd_clsp3; /* Class 3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This is _SO_ private that even we don't use it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t pd_private; /* private data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is a count of the number of references to (or holds on)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this remote port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int pd_ref_count; /* number of references */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Re-login disable for FCP-2 error recovery. This is intended to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * help with tape devices when an RSCN or Link Reset occurs during
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a long write operations (like backup). fp's default action is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to try to log in again, but that forces a rewind on the LUN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and corrupts its state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The legal bit values are given below. Some specific definitions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are as follows:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PD_IN_DID_QUEUE: The fc_remote_port_t is present in the d_id
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash list of the associated fc_local_port_t. (This
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is apparently meant to cover some races).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PD_LOGGED_OUT: This is a directive to ignore the NORELOGIN if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an actual logout occurred
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t pd_aux_flags; /* relogin disable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed uchar_t pd_spn_len; /* length of sym name */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed char pd_spn[255]; /* symbolic port name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Count of the # of unsolicited LOGOs received. See the definition
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of FC_LOGO_TOLERANCE_LIMIT in fp.c.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte timed_counter_t pd_logo_tc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int pd_w_depth; /* for WWN hash table */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pc_t pd_w_stack[FC_STACK_DEPTH];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int pd_d_depth; /* for D_ID hash table */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pc_t pd_d_stack[FC_STACK_DEPTH];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_remote_port_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Structs for the global nwwn_hash_table[] entries.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * At _init() time, fctl allocates an array of fctl_nwwn_list_t structs that
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * has nwwn_table_size entries. The hash_head member anchors a linked
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * list of fctl_nwwn_elem_t structs that are linked via the fne_next pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each fctl_nwwn_elem_t also contains a pointer to one fc_remote_node_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fctl_nwwn_elem fctl_nwwn_elem_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct fctl_nwwn_elem {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fctl_nwwn_elem_t *fne_nextp;
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed fc_remote_node_t *fne_nodep;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fctl_nwwn_list {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fctl_nwwn_elem_t *fnl_headp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fctl_nwwn_list_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_errmap {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fc_errno;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *fc_errname;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_errmap_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_pkt_reason {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int reason_val;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *reason_msg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_pkt_reason_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_pkt_action {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int action_val;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *action_msg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_pkt_action_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_pkt_expln {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int expln_val;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *expln_msg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_pkt_expln_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_pkt_error {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int pkt_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *pkt_msg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_pkt_reason_t *pkt_reason;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_pkt_action_t *pkt_action;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_pkt_expln_t *pkt_expln;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_pkt_error_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Values for the fd_flags field in the fc_remote_node_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note, the code seems to rely on the struct initialization using
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * kmem_zalloc() to set all the bits to zero, since FC_REMOTE_NODE_INVALID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is never explicitly set anywhere.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_REMOTE_NODE_INVALID 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_REMOTE_NODE_VALID 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Values for the pd_flags field in the fc_remote_port_t struct. These
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are used in a _lot_ of places. NOTE: these are values, not bit flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_IDLE 0x00
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_ELS_IN_PROGRESS 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_ELS_MARK 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bit values for the pd_aux_flags field in the fc_remote_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_IN_DID_QUEUE 0x01 /* The fc_remote_port_t is present */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* in the D_ID hash list of the */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* associated fc_local_port_t. (This */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* is apparently meant to narrow */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* some race windows). */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_DISABLE_RELOGIN 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_NEEDS_REMOVAL 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_LOGGED_OUT 0x08 /* This is a directive to ignore */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the NORELOGIN if an actual logout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* occurred */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_GIVEN_TO_ULPS 0x10 /* A reference to this pd has been */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* given to one or more ULPs. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Values for the pd_recepient field in the fc_remote_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Tries to describe where a PLOGI attempt originated.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_PLOGI_INITIATOR 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PD_PLOGI_RECEPIENT 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The fc_local_port_t struct represents a local FC port. It is the softstate
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * struct for each fp instance, so it comes into existence at DDI_ATTACH
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and is deleted during DDI_DETACH.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_local_port {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Mutex to protect certain data fields in this struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t fp_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fp_state sort of tracks the state of the link at the local port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The actual 'state' is kept in the lower byte, and the port speed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is kept in the next most significant byte. The code makes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * extensive use of the FC_PORT_SPEED_MASK() and FC_PORT_STATE_MASK()
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * macros to separate these two items. The current link topology
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is actually kept separately in the fp_topology field.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The legal values for fp_state are given above.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile uint32_t fp_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The S_ID for the local port. See fc_types.h for the fc_portid_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * definition.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portid_t fp_port_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Opaque reference handle for the local port device. This value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is supplied by the FCA driver and is passed unaltered to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * various FCA driver entry point functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t fp_fca_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Entry point vectors for the FCA driver at this FC port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fca_tran *fp_fca_tran;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fp's homegrown "job" threading mechanism (not a Solaris DDI taskq).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Head/tail pointers for a linked list of requests to be executed
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * in a driver-private thread. One thread per fc_local_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The thread is created during DDI_ATTACH for the instance.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct job_request *fp_job_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct job_request *fp_job_tail;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fp_cmd *fp_wait_head; /* waitQ head */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fp_cmd *fp_wait_tail; /* waitQ tail */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Current port topology. Uses the FC_TOP_* values defined in
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * fc_appif.h. This is used with the FC_IS_TOP_SWITCH() macro and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is also used with the FC_TOP_EXTERNAL() macro in the ULPs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_topology; /* topology */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The fp_task and fp_last_task fields are used mainly in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fp_job_handler() function. These are used to indicate when a job
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is executing. They also allow a second job to be issued while
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the current job is still in progress, but only one level of nesting
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is permitted.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The legal values for these fields are given in fp.h
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This should not be confused with the Solaris DDI taskq mechanism,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * altho also fp makes use of that in some places (just to keep life
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * interesting).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_task; /* current task */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_last_task; /* last task */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fp_soft_state actually tracks the progression of the fp driver
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in various code paths, particularly in attach, detach, suspend,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * resume, and state change callbacks.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The values for this are defined in fc_portif.h.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is sometimes used in conjunction with the fp_statec_busy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * field (see below), but there is no direct, 1-to-1 correlation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in how these are used together.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile uint16_t fp_soft_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Software restoration bit fields for (PM)SUSPEND/(PM)RESUME (??)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Legal values are FP_RESTORE_* in fp.h
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t fp_restore;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Open/Close bit flags. Used in fp_open(), fp_close(), fp_ioctl()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and fp_fciocmd(). See fp.h for legal values.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_flag; /* open/close flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_verbose;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_ns_login_class; /* NS Logi Class */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_sym_port_namelen; /* Symb port name len */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_cos; /* class of service */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Base pointer for hash table of fc_remote_port_t structs (remote
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ports) accessible thru the local port. The table is hashed by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the D_ID of the remote port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct d_id_hash *fp_did_table;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Base pointer for hash table of fc_remote_port_t structs (remote
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ports) accessible thru the local port. The table is hashed by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the port WWN of the remote port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct pwwn_hash *fp_pwwn_table;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct kmem_cache *fp_pkt_cache;
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed int fp_out_fpcmds; /* outstanding fp_cmd # */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fp_statec_busy tracks the progression of state change
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callbacks within the fp driver. It follows unsolicited callbacks
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and things like the port startup which happens during the attach.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The value increments when a state change is active and decrements
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * when it completes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The benefit of this is that we should be processing only the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * latest state change and drop the existing one. Coalescing of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * multiple outstanding state changes is NOT performed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is accessed in many places in the code, and also is buried
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in some macros (see fp_soft_state above).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IMPORTANT: The code currently permits nested state changes,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and there is no limitation on the allowed level of nesting.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_statec_busy;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_port_num; /* port number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fp_cmd *fp_els_resp_pkt; /* ready response pkt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_instance; /* instance number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flag to indicate whether or not the ULP attach is in progress. Used
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to synchronize execution of various functions. Seems intended to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * have a value of either zero or one.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_ulp_attach; /* ULP attach done ? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_dev_count; /* number of devices */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_ptpt_master; /* my WWN is greater */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_ulp_nload; /* count of ULPs */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed int fp_total_devices; /* total count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Another "busy/not busy" flag. Value is either 0 or 1.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_els_resp_pkt_busy;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is the "state" of the link on the local port, as reported
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * by the underlying FCA driver at bind time. This uses the same
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * values as fp_state above, including FC_STATE_OFFLINE, FC_STATE_LOOP,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and FC_PORT_STATE_MASK(port->fp_bind_state).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_bind_state; /* at bind time */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bit field of various parameterized behaviors for the local port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CAUTION: there is also an fp global variable called "fp_options"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that is used to initialize this field during DDI_ATTACH.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Apparently intended to facilitate reporting the FC_HBA type
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * for the local port. Legal values are in fcgs2.h. The
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fc_porttype_t typedef is in fc_types.h
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_porttype_t fp_port_type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_ub_count; /* Number of UBs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_active_ubs; /* outstanding UBs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t *fp_ub_tokens; /* UB tokens */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CV to inform fp "job" thread that there is work to do.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See fp_job_handler() function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t fp_cv;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Apparently intended to prevent race conditions by holding off any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DDI_DETACHes for the local port while a ULP attach is in progress.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t fp_attach_cv; /* ULP attach cv */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Save up the devinfo pointers from Solaris, for performing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pm_raise_power(), pm_busy_component(), and other DDI friends.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_info_t *fp_port_dip; /* port dip */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_info_t *fp_fca_dip; /* FCA dip */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This is a real Solaris DDI taskq (not the fp "job" queue) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte taskq_t *fp_taskq; /* callback queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte timeout_id_t fp_wait_tid; /* retry timer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte timeout_id_t fp_offline_tid; /* Offline timeout ID */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed fc_lilpmap_t fp_lilp_map; /* LILP map */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_els_logi_t fp_service_params; /* service parameters */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_fcp_dma_t fp_fcp_dma; /* FCP DVMA space */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_reset_action_t fp_reset_action; /* FCA reset behavior */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_dma_behavior_t fp_dma_behavior; /* FCA DMA behavior */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_sym_node_namelen; /* Sym node name len */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_ipa[8]; /* initial proc assoc */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fp_ip_addr[16]; /* IP address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_fc4_types[8]; /* fc4 types */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_orphan *fp_orphan_list; /* orphan list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_orphan_count; /* number of orphans */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Current PM power level of the local port device. Values
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are given in fc_portif.h
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_pm_level; /* power level */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Increment/decrement in fctl_busy_port() and fctl_idle_port() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_pm_busy; /* port busy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_pm_busy_nocomp; /* busy (no comp) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_hardaddr_t fp_hard_addr; /* Hard Address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fp_sym_port_name[255]; /* Symb port name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fp_sym_node_name[255]; /* Symb node name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Opaque data for CALLB_CPR_* macros used by the per-local-port
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * job thread. Required for safe thread shutdown during PM operations.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte callb_cpr_t fp_cpr_info; /* CPR info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fp_jindex; /* Not used */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fp_jbuf[15]; /* Not used */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed char fp_ibuf[15]; /* instance buf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fp_rnid_init; /* init done */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_rnid_t fp_rnid_params; /* node id data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* T11 FC-HBA data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fca_port_attrs_t fp_hba_port_attrs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_hba_state_change_t fp_last_change;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t fp_port_supported_fc4_types[32];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t fp_port_active_fc4_types[32];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_port_speed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t fp_fabric_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fp_rscn_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_npiv_portnum;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_NPIV_DISABLE 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_NPIV_ENABLE 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_npiv_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_NPIV_DELETING 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_npiv_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_PHY_PORT 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_NPIV_PORT 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_npiv_type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fp_npiv_portindex[FC_NPIV_MAX_PORT];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_local_port *fp_port_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_local_port *fp_port_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_local_port_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Struct for the d_id hash table in the fc_local_port_t struct. The code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocates memory for an array of D_ID_HASH_TABLE_SIZE elements at
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * attach time. The array pointer is saved at the fp_did_table member
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the fc_local_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each hash chain is a singly-linked list of fc_remote_port_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structs, using the pd_did_hnext pointer in the fc_remote_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct d_id_hash {
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_port *d_id_head; /* Head of linked list */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed int d_id_count; /* Count of list entries */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Struct for the pwwn hash table in the fc_local_port_t struct. The code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocates memory for an array of PWWN_HASH_TABLE_SIZE elements at
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed * attach time. The array pointer is saved at the fp_pwwn_table member
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the fc_local_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each hash chain is a singly-linked list of fc_remote_port_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structs, using the pd_wwn_hnext pointer in the fc_remote_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct pwwn_hash {
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed struct fc_remote_port *pwwn_head; /* Head of linked list */
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed int pwwn_count; /* Count of list entries */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Function prototypes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic dev_info_t *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefctl_findchild(dev_info_t *pdip, char *cname, char *caddr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fctl_fca_create_npivport(dev_info_t *parent,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_info_t *phydip, char *nwwn, char *pwwn, uint32_t *vindex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_fca_bus_ctl(dev_info_t *fca_dip, dev_info_t *rip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_ctl_enum_t op, void *arg, void *result);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_initchild(dev_info_t *fca_dip, dev_info_t *port_dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_uninitchild(dev_info_t *fca_dip, dev_info_t *port_dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_cache_constructor(void *buf, void *cdarg, int size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_cache_destructor(void *buf, void *cdarg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_pre_attach(fc_ulp_ports_t *ulp_port, fc_attach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_post_attach(fc_ulp_module_t *mod, fc_ulp_ports_t *ulp_port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_attach_cmd_t cmd, int rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_pre_detach(fc_ulp_ports_t *ulp_port, fc_detach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_post_detach(fc_ulp_module_t *mod, fc_ulp_ports_t *ulp_port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_detach_cmd_t cmd, int rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic fc_ulp_ports_t *fctl_add_ulp_port(fc_ulp_module_t *ulp_module,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t *port_handle, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic fc_ulp_ports_t *fctl_alloc_ulp_port(int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_remove_ulp_port(struct ulp_module *ulp_module,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t *port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_dealloc_ulp_port(fc_ulp_ports_t *next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic fc_ulp_ports_t *fctl_get_ulp_port(struct ulp_module *ulp_module,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t *port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_update_host_ns_values(fc_local_port_t *port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ns_cmd_t *ns_req);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_retrieve_host_ns_values(fc_local_port_t *port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ns_cmd_t *ns_req);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_print_if_not_orphan(fc_local_port_t *port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_remote_port_t *pd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_link_reset_done(opaque_t port_handle, uchar_t result);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_error(int fc_errno, char **errmsg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_pkt_error(fc_packet_t *pkt, char **state, char **reason,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char **action, char **expln);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_check_alpa_list(fc_local_port_t *port, fc_remote_port_t *pd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fctl_is_alpa_present(fc_local_port_t *port, uchar_t alpa);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fc_trace_freemsg(fc_trace_logq_t *logq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fctl_init_dma_attr(fc_local_port_t *port, fc_ulp_module_t *mod,
3e5bc1d795e8c41f3680a71e3954e72d079ee46dReed fc_ulp_port_info_t *info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefc_local_port_t *fc_get_npiv_port(fc_local_port_t *phyport, la_wwn_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefc_local_port_t *fc_delete_npiv_port(fc_local_port_t *phyport, la_wwn_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _FCTL_PRIVATE_H */