1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22*3e5bc1d7SReed * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte 26fcf3ce44SJohn Forte #ifndef _FCTL_PRIVATE_H 27fcf3ce44SJohn Forte #define _FCTL_PRIVATE_H 28fcf3ce44SJohn Forte 29fcf3ce44SJohn Forte 30fcf3ce44SJohn Forte #include <sys/note.h> 31fcf3ce44SJohn Forte 32fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fc_ulpif.h> 33fcf3ce44SJohn Forte 34fcf3ce44SJohn Forte #ifdef __cplusplus 35fcf3ce44SJohn Forte extern "C" { 36fcf3ce44SJohn Forte #endif 37fcf3ce44SJohn Forte 38fcf3ce44SJohn Forte /* 39fcf3ce44SJohn Forte * Stuff strictly internal to fctl that 40fcf3ce44SJohn Forte * isn't exposed to any other modules. 41fcf3ce44SJohn Forte */ 42fcf3ce44SJohn Forte #define PWWN_HASH_TABLE_SIZE (32) /* 2^n */ 43fcf3ce44SJohn Forte #define D_ID_HASH_TABLE_SIZE (32) /* 2^n */ 44fcf3ce44SJohn Forte #define NWWN_HASH_TABLE_SIZE (32) /* 2^n */ 45fcf3ce44SJohn Forte #define HASH_FUNC(key, size) ((key) & (size - 1)) 46fcf3ce44SJohn Forte #define WWN_HASH_KEY(x) ((x)[0] + (x)[1] + (x)[2] +\ 47fcf3ce44SJohn Forte (x)[3] + (x)[4] + (x)[5] +\ 48fcf3ce44SJohn Forte (x)[6] + (x)[7]) 49fcf3ce44SJohn Forte #define D_ID_HASH_FUNC(x, size) ((x) & (size - 1)) 50fcf3ce44SJohn Forte #define FC4_TYPE_WORD_POS(x) ((uchar_t)(x) >> 5) 51fcf3ce44SJohn Forte #define FC4_TYPE_BIT_POS(x) ((uchar_t)(x) & 0x1F) 52fcf3ce44SJohn Forte #define FC_ACTION_INVALID -1 53fcf3ce44SJohn Forte #define FC_REASON_INVALID -1 54fcf3ce44SJohn Forte #define FC_EXPLN_INVALID -1 55fcf3ce44SJohn Forte 56fcf3ce44SJohn Forte /* 57fcf3ce44SJohn Forte * Internally translated and used state change values to ULPs 58fcf3ce44SJohn Forte */ 59fcf3ce44SJohn Forte #define FC_ULP_STATEC_DONT_CARE 0 60fcf3ce44SJohn Forte #define FC_ULP_STATEC_ONLINE 1 61fcf3ce44SJohn Forte #define FC_ULP_STATEC_OFFLINE 2 62fcf3ce44SJohn Forte #define FC_ULP_STATEC_OFFLINE_TIMEOUT 3 63fcf3ce44SJohn Forte 64fcf3ce44SJohn Forte #define FC_ULP_ADD_RETRY_COUNT 90 65fcf3ce44SJohn Forte #define FC_MAX_TRACE_BUF_LEN 512 66fcf3ce44SJohn Forte 67fcf3ce44SJohn Forte 68fcf3ce44SJohn Forte #define FC_NPIV_MAX_PORT 255 69fcf3ce44SJohn Forte 70fcf3ce44SJohn Forte /* 71fcf3ce44SJohn Forte * port_dstate values 72fcf3ce44SJohn Forte */ 73fcf3ce44SJohn Forte #define ULP_PORT_ATTACH 0x01 74fcf3ce44SJohn Forte #define ULP_PORT_SUSPEND 0x02 75fcf3ce44SJohn Forte #define ULP_PORT_POWER_DOWN 0x04 76fcf3ce44SJohn Forte #define ULP_PORT_BUSY 0x08 77fcf3ce44SJohn Forte #define FCTL_DISALLOW_CALLBACKS(x) (!((x) & ULP_PORT_ATTACH) ||\ 78fcf3ce44SJohn Forte ((x) & ULP_PORT_BUSY)) 79fcf3ce44SJohn Forte 80fcf3ce44SJohn Forte typedef struct ulp_ports { 81*3e5bc1d7SReed struct ulp_ports *port_next; 82fcf3ce44SJohn Forte int port_dstate; 83fcf3ce44SJohn Forte uint32_t port_statec; 84fcf3ce44SJohn Forte kmutex_t port_mutex; 85fcf3ce44SJohn Forte struct fc_local_port *port_handle; 86fcf3ce44SJohn Forte } fc_ulp_ports_t; 87fcf3ce44SJohn Forte 88fcf3ce44SJohn Forte 89fcf3ce44SJohn Forte typedef struct ulp_module { 90*3e5bc1d7SReed struct ulp_module *mod_next; 91*3e5bc1d7SReed fc_ulp_modinfo_t *mod_info; 92fcf3ce44SJohn Forte fc_ulp_ports_t *mod_ports; 93fcf3ce44SJohn Forte } fc_ulp_module_t; 94fcf3ce44SJohn Forte 95fcf3ce44SJohn Forte 96fcf3ce44SJohn Forte typedef struct ulp_list { 97fcf3ce44SJohn Forte fc_ulp_modinfo_t *ulp_info; 98fcf3ce44SJohn Forte struct ulp_list *ulp_next; 99fcf3ce44SJohn Forte } fc_ulp_list_t; 100fcf3ce44SJohn Forte 101fcf3ce44SJohn Forte 102fcf3ce44SJohn Forte typedef struct fca_port { 103*3e5bc1d7SReed struct fca_port *port_next; 104fcf3ce44SJohn Forte struct fc_local_port *port_handle; 105fcf3ce44SJohn Forte } fc_fca_port_t; 106fcf3ce44SJohn Forte 107fcf3ce44SJohn Forte typedef struct timed_counter { 108fcf3ce44SJohn Forte struct timed_counter *sig; 109fcf3ce44SJohn Forte uint32_t counter; 110fcf3ce44SJohn Forte uint32_t max_value; 111fcf3ce44SJohn Forte boolean_t maxed_out; 112fcf3ce44SJohn Forte kmutex_t mutex; 113fcf3ce44SJohn Forte boolean_t active; 114fcf3ce44SJohn Forte clock_t timer; 115fcf3ce44SJohn Forte timeout_id_t tid; 116fcf3ce44SJohn Forte } timed_counter_t; 117fcf3ce44SJohn Forte 118fcf3ce44SJohn Forte /* 119fcf3ce44SJohn Forte * Struct describing a remote node. A remote node is associated with one 120fcf3ce44SJohn Forte * or more remote ports (fc_remote_port_t structs) that are all accessible 121fcf3ce44SJohn Forte * through one local port (fc_local_port_t struct). 122fcf3ce44SJohn Forte * 123fcf3ce44SJohn Forte * Each fc_remote_node_t struct is also referenced by nwwn in the global 124fcf3ce44SJohn Forte * nwwn_hash_table[] list. 125fcf3ce44SJohn Forte */ 126fcf3ce44SJohn Forte typedef struct fc_remote_node { 127fcf3ce44SJohn Forte /* 128fcf3ce44SJohn Forte * Mutex lock to protect access to all members of this struct. 129fcf3ce44SJohn Forte * Current implementation dictates acquisition of fd_mutex before 130fcf3ce44SJohn Forte * pd_mutex can be acquired (when both locks must be acquired). 131fcf3ce44SJohn Forte */ 132fcf3ce44SJohn Forte kmutex_t fd_mutex; 133fcf3ce44SJohn Forte 134fcf3ce44SJohn Forte /* Node WWN for the remote node */ 135fcf3ce44SJohn Forte la_wwn_t fd_node_name; 136fcf3ce44SJohn Forte 137fcf3ce44SJohn Forte /* 138fcf3ce44SJohn Forte * This is the number of (active) fc_remote_port_t structs that 139fcf3ce44SJohn Forte * are associated with this remote node. 140fcf3ce44SJohn Forte */ 141fcf3ce44SJohn Forte int fd_numports; 142fcf3ce44SJohn Forte 143fcf3ce44SJohn Forte /* 144fcf3ce44SJohn Forte * Tracks whether this struct is "valid" or "invalid", using the 145fcf3ce44SJohn Forte * FC_REMOTE_NODE_* values given above. 146fcf3ce44SJohn Forte */ 147fcf3ce44SJohn Forte int fd_flags; 148fcf3ce44SJohn Forte 149fcf3ce44SJohn Forte /* Linked list of remote ports associated with this remote node. */ 150*3e5bc1d7SReed struct fc_remote_port *fd_portlistp; 151fcf3ce44SJohn Forte 152fcf3ce44SJohn Forte uchar_t fd_ipa[8]; /* Initial proc assoc */ 153fcf3ce44SJohn Forte uchar_t fd_vv[16]; /* Vendor Version */ 154fcf3ce44SJohn Forte uchar_t fd_snn_len; /* node symbolic name len */ 155fcf3ce44SJohn Forte uchar_t fd_snn[255]; /* node symbolic name */ 156fcf3ce44SJohn Forte } fc_remote_node_t; 157fcf3ce44SJohn Forte 158fcf3ce44SJohn Forte /* 159fcf3ce44SJohn Forte * Stack depth for troubleshooting (only used in debug code) 160fcf3ce44SJohn Forte */ 161fcf3ce44SJohn Forte #define FC_STACK_DEPTH 14 162fcf3ce44SJohn Forte 163fcf3ce44SJohn Forte /* 164fcf3ce44SJohn Forte * The fc_remote_port_t struct represents a remote FC port that is 165fcf3ce44SJohn Forte * accessible via the local FC port (fc_local_port_t). Each remote 166fcf3ce44SJohn Forte * FC port is associated with one FC local port (fc_local_port_t, 167fcf3ce44SJohn Forte * above) and one remote FC node (fc_remote_node_t, see below). 168fcf3ce44SJohn Forte * fc_remote_port_t structs are created and destroyed as needed to 169fcf3ce44SJohn Forte * correspond with changing conditions out on the link. 170fcf3ce44SJohn Forte */ 171fcf3ce44SJohn Forte typedef struct fc_remote_port { 172fcf3ce44SJohn Forte /* 173fcf3ce44SJohn Forte * Ah, the infamous 'pd_mutex' that has given developers so much 174fcf3ce44SJohn Forte * joy over the years.... 175fcf3ce44SJohn Forte * (Gotta love the original, extremely helpful comment.) 176fcf3ce44SJohn Forte */ 177fcf3ce44SJohn Forte kmutex_t pd_mutex; /* mutex */ 178fcf3ce44SJohn Forte 179fcf3ce44SJohn Forte fc_portid_t pd_port_id; /* Port Identifier */ 180fcf3ce44SJohn Forte la_wwn_t pd_port_name; /* the port WWN */ 181fcf3ce44SJohn Forte 182fcf3ce44SJohn Forte /* 183fcf3ce44SJohn Forte * Reference count of the # of logins initiated by a ULP 184fcf3ce44SJohn Forte * (i.e., this is the # of ULPs accessing the struct). See 185fcf3ce44SJohn Forte * fp_plogi_group() for more info. 186fcf3ce44SJohn Forte */ 187fcf3ce44SJohn Forte int pd_login_count; 188fcf3ce44SJohn Forte 189fcf3ce44SJohn Forte /* 190fcf3ce44SJohn Forte * This appears to track the login state of the remote FC port. 191fcf3ce44SJohn Forte * Used with the PORT_DEVICE_* macros in fc_appif.h. 192fcf3ce44SJohn Forte */ 193fcf3ce44SJohn Forte uint32_t pd_state; 194fcf3ce44SJohn Forte 195fcf3ce44SJohn Forte /* 196fcf3ce44SJohn Forte * Link pointers for the port wwn and D_ID hash lists. These point 197fcf3ce44SJohn Forte * to the next remote port in the current hash chain. 198fcf3ce44SJohn Forte */ 199*3e5bc1d7SReed struct fc_remote_port *pd_wwn_hnext; 200*3e5bc1d7SReed struct fc_remote_port *pd_did_hnext; 201fcf3ce44SJohn Forte 202fcf3ce44SJohn Forte /* 203fcf3ce44SJohn Forte * Link pointer for list of *all* fc_remote_port_t structs 204fcf3ce44SJohn Forte * associated with the same fc_local_port_t struct. 205fcf3ce44SJohn Forte */ 206*3e5bc1d7SReed struct fc_remote_port *pd_port_next; 207fcf3ce44SJohn Forte 208fcf3ce44SJohn Forte /* 209fcf3ce44SJohn Forte * Pointer to the fc_remote_node_t struct for the remote node 210fcf3ce44SJohn Forte * associated with the remote port. 211fcf3ce44SJohn Forte */ 212*3e5bc1d7SReed struct fc_remote_node *pd_remote_nodep; 213fcf3ce44SJohn Forte 214fcf3ce44SJohn Forte /* port type for the remote port */ 215fcf3ce44SJohn Forte fc_porttype_t pd_porttype; 216fcf3ce44SJohn Forte 217fcf3ce44SJohn Forte fc_hardaddr_t pd_hard_addr; /* Hard Address */ 218fcf3ce44SJohn Forte 219fcf3ce44SJohn Forte /* 220fcf3ce44SJohn Forte * Back pointer to the fc_local_port_t struct for the local port 221fcf3ce44SJohn Forte * associated with this remote port. 222fcf3ce44SJohn Forte */ 223fcf3ce44SJohn Forte struct fc_local_port *pd_port; 224fcf3ce44SJohn Forte 225fcf3ce44SJohn Forte /* 226fcf3ce44SJohn Forte * (Sigh) this actually doesn't have anything to do with the "type" 227fcf3ce44SJohn Forte * of the remote port per se. It's really more an indicator of the 228fcf3ce44SJohn Forte * most recently known state/status of the remote port. It's intended 229fcf3ce44SJohn Forte * to help figure out if/how the remote port has either gone away or 230fcf3ce44SJohn Forte * changed somehow after an event has occurred on the link. 231fcf3ce44SJohn Forte * There also seems to be some connection to the "changed map". 232fcf3ce44SJohn Forte * 233fcf3ce44SJohn Forte * The legal values for this are the PORT_DEVICE_* definitions 234fcf3ce44SJohn Forte * earlier in this file. 235fcf3ce44SJohn Forte */ 236fcf3ce44SJohn Forte uchar_t pd_type; /* new or old */ 237fcf3ce44SJohn Forte 238fcf3ce44SJohn Forte /* 239fcf3ce44SJohn Forte * This tracks the current state/status of a login attempt at the 240*3e5bc1d7SReed * remote port. Legal values are given above. 241fcf3ce44SJohn Forte * See also the pd_state field. 242fcf3ce44SJohn Forte */ 243fcf3ce44SJohn Forte uchar_t pd_flags; /* login in progress */ 244fcf3ce44SJohn Forte 245fcf3ce44SJohn Forte uchar_t pd_login_class; /* Logi Class */ 246fcf3ce44SJohn Forte 247fcf3ce44SJohn Forte /* Legal values are given above (beware of the mipselling) */ 248fcf3ce44SJohn Forte uchar_t pd_recepient; /* who did PLOGI? */ 249fcf3ce44SJohn Forte 250fcf3ce44SJohn Forte uchar_t pd_ip_addr[8]; /* IP address */ 251fcf3ce44SJohn Forte uint32_t pd_fc4types[8]; /* FC-4 types */ 252fcf3ce44SJohn Forte uint32_t pd_cos; /* class of service */ 253*3e5bc1d7SReed struct common_service pd_csp; /* common service */ 254*3e5bc1d7SReed struct service_param pd_clsp1; /* Class 1 */ 255*3e5bc1d7SReed struct service_param pd_clsp2; /* Class 2 */ 256*3e5bc1d7SReed struct service_param pd_clsp3; /* Class 3 */ 257fcf3ce44SJohn Forte 258fcf3ce44SJohn Forte /* This is _SO_ private that even we don't use it */ 259fcf3ce44SJohn Forte caddr_t pd_private; /* private data */ 260fcf3ce44SJohn Forte 261fcf3ce44SJohn Forte /* 262fcf3ce44SJohn Forte * This is a count of the number of references to (or holds on) 263fcf3ce44SJohn Forte * this remote port. 264fcf3ce44SJohn Forte */ 265fcf3ce44SJohn Forte int pd_ref_count; /* number of references */ 266fcf3ce44SJohn Forte 267fcf3ce44SJohn Forte /* 268fcf3ce44SJohn Forte * Re-login disable for FCP-2 error recovery. This is intended to 269fcf3ce44SJohn Forte * help with tape devices when an RSCN or Link Reset occurs during 270fcf3ce44SJohn Forte * a long write operations (like backup). fp's default action is 271fcf3ce44SJohn Forte * to try to log in again, but that forces a rewind on the LUN 272fcf3ce44SJohn Forte * and corrupts its state. 273fcf3ce44SJohn Forte * 274fcf3ce44SJohn Forte * The legal bit values are given below. Some specific definitions 275fcf3ce44SJohn Forte * are as follows: 276fcf3ce44SJohn Forte * 277fcf3ce44SJohn Forte * PD_IN_DID_QUEUE: The fc_remote_port_t is present in the d_id 278fcf3ce44SJohn Forte * hash list of the associated fc_local_port_t. (This 279fcf3ce44SJohn Forte * is apparently meant to cover some races). 280fcf3ce44SJohn Forte * PD_LOGGED_OUT: This is a directive to ignore the NORELOGIN if 281fcf3ce44SJohn Forte * an actual logout occurred 282fcf3ce44SJohn Forte */ 283fcf3ce44SJohn Forte uchar_t pd_aux_flags; /* relogin disable */ 284fcf3ce44SJohn Forte 285*3e5bc1d7SReed uchar_t pd_spn_len; /* length of sym name */ 286*3e5bc1d7SReed char pd_spn[255]; /* symbolic port name */ 287fcf3ce44SJohn Forte 288fcf3ce44SJohn Forte /* 289fcf3ce44SJohn Forte * Count of the # of unsolicited LOGOs received. See the definition 290fcf3ce44SJohn Forte * of FC_LOGO_TOLERANCE_LIMIT in fp.c. 291fcf3ce44SJohn Forte */ 292fcf3ce44SJohn Forte timed_counter_t pd_logo_tc; 293fcf3ce44SJohn Forte 294fcf3ce44SJohn Forte #ifdef DEBUG 295fcf3ce44SJohn Forte int pd_w_depth; /* for WWN hash table */ 296fcf3ce44SJohn Forte pc_t pd_w_stack[FC_STACK_DEPTH]; 297fcf3ce44SJohn Forte int pd_d_depth; /* for D_ID hash table */ 298fcf3ce44SJohn Forte pc_t pd_d_stack[FC_STACK_DEPTH]; 299fcf3ce44SJohn Forte #endif 300fcf3ce44SJohn Forte } fc_remote_port_t; 301fcf3ce44SJohn Forte 302fcf3ce44SJohn Forte 303fcf3ce44SJohn Forte /* 304fcf3ce44SJohn Forte * Structs for the global nwwn_hash_table[] entries. 305fcf3ce44SJohn Forte * 306fcf3ce44SJohn Forte * At _init() time, fctl allocates an array of fctl_nwwn_list_t structs that 307*3e5bc1d7SReed * has nwwn_table_size entries. The hash_head member anchors a linked 308fcf3ce44SJohn Forte * list of fctl_nwwn_elem_t structs that are linked via the fne_next pointer. 309fcf3ce44SJohn Forte * Each fctl_nwwn_elem_t also contains a pointer to one fc_remote_node_t struct. 310fcf3ce44SJohn Forte */ 311fcf3ce44SJohn Forte typedef struct fctl_nwwn_elem fctl_nwwn_elem_t; 312fcf3ce44SJohn Forte 313fcf3ce44SJohn Forte struct fctl_nwwn_elem { 314fcf3ce44SJohn Forte fctl_nwwn_elem_t *fne_nextp; 315*3e5bc1d7SReed fc_remote_node_t *fne_nodep; 316fcf3ce44SJohn Forte }; 317fcf3ce44SJohn Forte 318fcf3ce44SJohn Forte typedef struct fctl_nwwn_list { 319fcf3ce44SJohn Forte fctl_nwwn_elem_t *fnl_headp; 320fcf3ce44SJohn Forte } fctl_nwwn_list_t; 321fcf3ce44SJohn Forte 322fcf3ce44SJohn Forte 323fcf3ce44SJohn Forte 324fcf3ce44SJohn Forte typedef struct fc_errmap { 325fcf3ce44SJohn Forte int fc_errno; 326fcf3ce44SJohn Forte char *fc_errname; 327fcf3ce44SJohn Forte } fc_errmap_t; 328fcf3ce44SJohn Forte 329fcf3ce44SJohn Forte 330fcf3ce44SJohn Forte typedef struct fc_pkt_reason { 331fcf3ce44SJohn Forte int reason_val; 332fcf3ce44SJohn Forte char *reason_msg; 333fcf3ce44SJohn Forte } fc_pkt_reason_t; 334fcf3ce44SJohn Forte 335fcf3ce44SJohn Forte 336fcf3ce44SJohn Forte typedef struct fc_pkt_action { 337fcf3ce44SJohn Forte int action_val; 338fcf3ce44SJohn Forte char *action_msg; 339fcf3ce44SJohn Forte } fc_pkt_action_t; 340fcf3ce44SJohn Forte 341fcf3ce44SJohn Forte 342fcf3ce44SJohn Forte typedef struct fc_pkt_expln { 343fcf3ce44SJohn Forte int expln_val; 344fcf3ce44SJohn Forte char *expln_msg; 345fcf3ce44SJohn Forte } fc_pkt_expln_t; 346fcf3ce44SJohn Forte 347fcf3ce44SJohn Forte 348fcf3ce44SJohn Forte typedef struct fc_pkt_error { 349fcf3ce44SJohn Forte int pkt_state; 350fcf3ce44SJohn Forte char *pkt_msg; 351fcf3ce44SJohn Forte fc_pkt_reason_t *pkt_reason; 352fcf3ce44SJohn Forte fc_pkt_action_t *pkt_action; 353fcf3ce44SJohn Forte fc_pkt_expln_t *pkt_expln; 354fcf3ce44SJohn Forte } fc_pkt_error_t; 355fcf3ce44SJohn Forte 356fcf3ce44SJohn Forte 357fcf3ce44SJohn Forte /* 358fcf3ce44SJohn Forte * Values for the fd_flags field in the fc_remote_node_t struct. 359fcf3ce44SJohn Forte * Note, the code seems to rely on the struct initialization using 360fcf3ce44SJohn Forte * kmem_zalloc() to set all the bits to zero, since FC_REMOTE_NODE_INVALID 361fcf3ce44SJohn Forte * is never explicitly set anywhere. 362fcf3ce44SJohn Forte */ 363fcf3ce44SJohn Forte #define FC_REMOTE_NODE_INVALID 0 364fcf3ce44SJohn Forte #define FC_REMOTE_NODE_VALID 1 365fcf3ce44SJohn Forte 366fcf3ce44SJohn Forte 367fcf3ce44SJohn Forte /* 368fcf3ce44SJohn Forte * Values for the pd_flags field in the fc_remote_port_t struct. These 369fcf3ce44SJohn Forte * are used in a _lot_ of places. NOTE: these are values, not bit flags. 370fcf3ce44SJohn Forte */ 371fcf3ce44SJohn Forte #define PD_IDLE 0x00 372fcf3ce44SJohn Forte #define PD_ELS_IN_PROGRESS 0x01 373fcf3ce44SJohn Forte #define PD_ELS_MARK 0x02 374fcf3ce44SJohn Forte 375fcf3ce44SJohn Forte 376fcf3ce44SJohn Forte /* 377fcf3ce44SJohn Forte * Bit values for the pd_aux_flags field in the fc_remote_port_t struct. 378fcf3ce44SJohn Forte */ 379fcf3ce44SJohn Forte #define PD_IN_DID_QUEUE 0x01 /* The fc_remote_port_t is present */ 380fcf3ce44SJohn Forte /* in the D_ID hash list of the */ 381fcf3ce44SJohn Forte /* associated fc_local_port_t. (This */ 382fcf3ce44SJohn Forte /* is apparently meant to narrow */ 383fcf3ce44SJohn Forte /* some race windows). */ 384fcf3ce44SJohn Forte #define PD_DISABLE_RELOGIN 0x02 385fcf3ce44SJohn Forte #define PD_NEEDS_REMOVAL 0x04 386fcf3ce44SJohn Forte #define PD_LOGGED_OUT 0x08 /* This is a directive to ignore */ 387fcf3ce44SJohn Forte /* the NORELOGIN if an actual logout */ 388fcf3ce44SJohn Forte /* occurred */ 389fcf3ce44SJohn Forte #define PD_GIVEN_TO_ULPS 0x10 /* A reference to this pd has been */ 390fcf3ce44SJohn Forte /* given to one or more ULPs. */ 391fcf3ce44SJohn Forte 392fcf3ce44SJohn Forte /* 393fcf3ce44SJohn Forte * Values for the pd_recepient field in the fc_remote_port_t struct. 394fcf3ce44SJohn Forte * Tries to describe where a PLOGI attempt originated. 395fcf3ce44SJohn Forte */ 396fcf3ce44SJohn Forte #define PD_PLOGI_INITIATOR 0 397fcf3ce44SJohn Forte #define PD_PLOGI_RECEPIENT 1 398fcf3ce44SJohn Forte 399fcf3ce44SJohn Forte 400fcf3ce44SJohn Forte /* 401fcf3ce44SJohn Forte * The fc_local_port_t struct represents a local FC port. It is the softstate 402fcf3ce44SJohn Forte * struct for each fp instance, so it comes into existence at DDI_ATTACH 403fcf3ce44SJohn Forte * and is deleted during DDI_DETACH. 404fcf3ce44SJohn Forte */ 405fcf3ce44SJohn Forte typedef struct fc_local_port { 406fcf3ce44SJohn Forte /* 407fcf3ce44SJohn Forte * Mutex to protect certain data fields in this struct. 408fcf3ce44SJohn Forte */ 409fcf3ce44SJohn Forte kmutex_t fp_mutex; 410fcf3ce44SJohn Forte 411fcf3ce44SJohn Forte /* 412fcf3ce44SJohn Forte * fp_state sort of tracks the state of the link at the local port. 413fcf3ce44SJohn Forte * The actual 'state' is kept in the lower byte, and the port speed 414fcf3ce44SJohn Forte * is kept in the next most significant byte. The code makes 415fcf3ce44SJohn Forte * extensive use of the FC_PORT_SPEED_MASK() and FC_PORT_STATE_MASK() 416*3e5bc1d7SReed * macros to separate these two items. The current link topology 417fcf3ce44SJohn Forte * is actually kept separately in the fp_topology field. 418fcf3ce44SJohn Forte * The legal values for fp_state are given above. 419fcf3ce44SJohn Forte */ 420fcf3ce44SJohn Forte volatile uint32_t fp_state; 421fcf3ce44SJohn Forte 422fcf3ce44SJohn Forte /* 423fcf3ce44SJohn Forte * The S_ID for the local port. See fc_types.h for the fc_portid_t 424fcf3ce44SJohn Forte * definition. 425fcf3ce44SJohn Forte */ 426fcf3ce44SJohn Forte fc_portid_t fp_port_id; 427fcf3ce44SJohn Forte 428fcf3ce44SJohn Forte /* 429fcf3ce44SJohn Forte * Opaque reference handle for the local port device. This value 430fcf3ce44SJohn Forte * is supplied by the FCA driver and is passed unaltered to 431fcf3ce44SJohn Forte * various FCA driver entry point functions. 432fcf3ce44SJohn Forte */ 433fcf3ce44SJohn Forte opaque_t fp_fca_handle; 434fcf3ce44SJohn Forte 435fcf3ce44SJohn Forte /* Entry point vectors for the FCA driver at this FC port */ 436fcf3ce44SJohn Forte struct fca_tran *fp_fca_tran; 437fcf3ce44SJohn Forte 438fcf3ce44SJohn Forte /* 439fcf3ce44SJohn Forte * fp's homegrown "job" threading mechanism (not a Solaris DDI taskq). 440fcf3ce44SJohn Forte * 441fcf3ce44SJohn Forte * Head/tail pointers for a linked list of requests to be executed 442*3e5bc1d7SReed * in a driver-private thread. One thread per fc_local_port_t struct. 443fcf3ce44SJohn Forte * The thread is created during DDI_ATTACH for the instance. 444fcf3ce44SJohn Forte */ 445fcf3ce44SJohn Forte struct job_request *fp_job_head; 446fcf3ce44SJohn Forte struct job_request *fp_job_tail; 447fcf3ce44SJohn Forte 448*3e5bc1d7SReed struct fp_cmd *fp_wait_head; /* waitQ head */ 449fcf3ce44SJohn Forte struct fp_cmd *fp_wait_tail; /* waitQ tail */ 450fcf3ce44SJohn Forte 451fcf3ce44SJohn Forte /* 452fcf3ce44SJohn Forte * Current port topology. Uses the FC_TOP_* values defined in 453*3e5bc1d7SReed * fc_appif.h. This is used with the FC_IS_TOP_SWITCH() macro and 454fcf3ce44SJohn Forte * is also used with the FC_TOP_EXTERNAL() macro in the ULPs. 455fcf3ce44SJohn Forte */ 456fcf3ce44SJohn Forte uint32_t fp_topology; /* topology */ 457fcf3ce44SJohn Forte 458fcf3ce44SJohn Forte /* 459fcf3ce44SJohn Forte * The fp_task and fp_last_task fields are used mainly in the 460fcf3ce44SJohn Forte * fp_job_handler() function. These are used to indicate when a job 461fcf3ce44SJohn Forte * is executing. They also allow a second job to be issued while 462fcf3ce44SJohn Forte * the current job is still in progress, but only one level of nesting 463fcf3ce44SJohn Forte * is permitted. 464fcf3ce44SJohn Forte * 465fcf3ce44SJohn Forte * The legal values for these fields are given in fp.h 466fcf3ce44SJohn Forte * 467fcf3ce44SJohn Forte * This should not be confused with the Solaris DDI taskq mechanism, 468fcf3ce44SJohn Forte * altho also fp makes use of that in some places (just to keep life 469fcf3ce44SJohn Forte * interesting). 470fcf3ce44SJohn Forte */ 471fcf3ce44SJohn Forte int fp_task; /* current task */ 472fcf3ce44SJohn Forte int fp_last_task; /* last task */ 473fcf3ce44SJohn Forte 474fcf3ce44SJohn Forte /* 475fcf3ce44SJohn Forte * fp_soft_state actually tracks the progression of the fp driver 476fcf3ce44SJohn Forte * in various code paths, particularly in attach, detach, suspend, 477fcf3ce44SJohn Forte * resume, and state change callbacks. 478fcf3ce44SJohn Forte * 479fcf3ce44SJohn Forte * The values for this are defined in fc_portif.h. 480fcf3ce44SJohn Forte * 481fcf3ce44SJohn Forte * This is sometimes used in conjunction with the fp_statec_busy 482fcf3ce44SJohn Forte * field (see below), but there is no direct, 1-to-1 correlation 483fcf3ce44SJohn Forte * in how these are used together. 484fcf3ce44SJohn Forte */ 485fcf3ce44SJohn Forte volatile uint16_t fp_soft_state; 486fcf3ce44SJohn Forte 487fcf3ce44SJohn Forte 488fcf3ce44SJohn Forte /* 489fcf3ce44SJohn Forte * Software restoration bit fields for (PM)SUSPEND/(PM)RESUME (??) 490fcf3ce44SJohn Forte * Legal values are FP_RESTORE_* in fp.h 491fcf3ce44SJohn Forte */ 492fcf3ce44SJohn Forte uint16_t fp_restore; 493fcf3ce44SJohn Forte 494fcf3ce44SJohn Forte /* 495fcf3ce44SJohn Forte * Open/Close bit flags. Used in fp_open(), fp_close(), fp_ioctl() 496fcf3ce44SJohn Forte * and fp_fciocmd(). See fp.h for legal values. 497fcf3ce44SJohn Forte */ 498fcf3ce44SJohn Forte uchar_t fp_flag; /* open/close flag */ 499fcf3ce44SJohn Forte 500fcf3ce44SJohn Forte uchar_t fp_verbose; 501fcf3ce44SJohn Forte uchar_t fp_ns_login_class; /* NS Logi Class */ 502fcf3ce44SJohn Forte uchar_t fp_sym_port_namelen; /* Symb port name len */ 503fcf3ce44SJohn Forte uint32_t fp_cos; /* class of service */ 504fcf3ce44SJohn Forte 505fcf3ce44SJohn Forte /* 506fcf3ce44SJohn Forte * Base pointer for hash table of fc_remote_port_t structs (remote 507fcf3ce44SJohn Forte * ports) accessible thru the local port. The table is hashed by 508fcf3ce44SJohn Forte * the D_ID of the remote port. 509fcf3ce44SJohn Forte */ 510fcf3ce44SJohn Forte struct d_id_hash *fp_did_table; 511fcf3ce44SJohn Forte 512fcf3ce44SJohn Forte /* 513fcf3ce44SJohn Forte * Base pointer for hash table of fc_remote_port_t structs (remote 514fcf3ce44SJohn Forte * ports) accessible thru the local port. The table is hashed by 515fcf3ce44SJohn Forte * the port WWN of the remote port. 516fcf3ce44SJohn Forte */ 517fcf3ce44SJohn Forte struct pwwn_hash *fp_pwwn_table; 518fcf3ce44SJohn Forte 519*3e5bc1d7SReed struct kmem_cache *fp_pkt_cache; 520*3e5bc1d7SReed int fp_out_fpcmds; /* outstanding fp_cmd # */ 521fcf3ce44SJohn Forte 522fcf3ce44SJohn Forte /* 523fcf3ce44SJohn Forte * fp_statec_busy tracks the progression of state change 524fcf3ce44SJohn Forte * callbacks within the fp driver. It follows unsolicited callbacks 525fcf3ce44SJohn Forte * and things like the port startup which happens during the attach. 526fcf3ce44SJohn Forte * The value increments when a state change is active and decrements 527fcf3ce44SJohn Forte * when it completes. 528fcf3ce44SJohn Forte * 529fcf3ce44SJohn Forte * The benefit of this is that we should be processing only the 530fcf3ce44SJohn Forte * latest state change and drop the existing one. Coalescing of 531fcf3ce44SJohn Forte * multiple outstanding state changes is NOT performed. 532fcf3ce44SJohn Forte * 533fcf3ce44SJohn Forte * This is accessed in many places in the code, and also is buried 534fcf3ce44SJohn Forte * in some macros (see fp_soft_state above). 535fcf3ce44SJohn Forte * 536fcf3ce44SJohn Forte * IMPORTANT: The code currently permits nested state changes, 537fcf3ce44SJohn Forte * and there is no limitation on the allowed level of nesting. 538fcf3ce44SJohn Forte */ 539fcf3ce44SJohn Forte int fp_statec_busy; 540fcf3ce44SJohn Forte 541fcf3ce44SJohn Forte int fp_port_num; /* port number */ 542fcf3ce44SJohn Forte struct fp_cmd *fp_els_resp_pkt; /* ready response pkt */ 543fcf3ce44SJohn Forte int fp_instance; /* instance number */ 544fcf3ce44SJohn Forte 545fcf3ce44SJohn Forte /* 546fcf3ce44SJohn Forte * Flag to indicate whether or not the ULP attach is in progress. Used 547fcf3ce44SJohn Forte * to synchronize execution of various functions. Seems intended to 548fcf3ce44SJohn Forte * have a value of either zero or one. 549fcf3ce44SJohn Forte */ 550fcf3ce44SJohn Forte int fp_ulp_attach; /* ULP attach done ? */ 551fcf3ce44SJohn Forte 552fcf3ce44SJohn Forte int fp_dev_count; /* number of devices */ 553fcf3ce44SJohn Forte int fp_ptpt_master; /* my WWN is greater */ 554fcf3ce44SJohn Forte int fp_ulp_nload; /* count of ULPs */ 555*3e5bc1d7SReed int fp_total_devices; /* total count */ 556fcf3ce44SJohn Forte 557fcf3ce44SJohn Forte /* 558fcf3ce44SJohn Forte * Another "busy/not busy" flag. Value is either 0 or 1. 559fcf3ce44SJohn Forte */ 560fcf3ce44SJohn Forte int fp_els_resp_pkt_busy; 561fcf3ce44SJohn Forte 562fcf3ce44SJohn Forte /* 563fcf3ce44SJohn Forte * This is the "state" of the link on the local port, as reported 564fcf3ce44SJohn Forte * by the underlying FCA driver at bind time. This uses the same 565fcf3ce44SJohn Forte * values as fp_state above, including FC_STATE_OFFLINE, FC_STATE_LOOP, 566fcf3ce44SJohn Forte * and FC_PORT_STATE_MASK(port->fp_bind_state). 567fcf3ce44SJohn Forte */ 568fcf3ce44SJohn Forte uint32_t fp_bind_state; /* at bind time */ 569fcf3ce44SJohn Forte 570fcf3ce44SJohn Forte /* 571fcf3ce44SJohn Forte * Bit field of various parameterized behaviors for the local port. 572fcf3ce44SJohn Forte * CAUTION: there is also an fp global variable called "fp_options" 573fcf3ce44SJohn Forte * that is used to initialize this field during DDI_ATTACH. 574fcf3ce44SJohn Forte */ 575fcf3ce44SJohn Forte uint32_t fp_options; 576fcf3ce44SJohn Forte 577fcf3ce44SJohn Forte /* 578fcf3ce44SJohn Forte * Apparently intended to facilitate reporting the FC_HBA type 579*3e5bc1d7SReed * for the local port. Legal values are in fcgs2.h. The 580fcf3ce44SJohn Forte * fc_porttype_t typedef is in fc_types.h 581fcf3ce44SJohn Forte */ 582fcf3ce44SJohn Forte fc_porttype_t fp_port_type; 583fcf3ce44SJohn Forte 584fcf3ce44SJohn Forte uint32_t fp_ub_count; /* Number of UBs */ 585fcf3ce44SJohn Forte int fp_active_ubs; /* outstanding UBs */ 586fcf3ce44SJohn Forte uint64_t *fp_ub_tokens; /* UB tokens */ 587fcf3ce44SJohn Forte 588fcf3ce44SJohn Forte /* 589fcf3ce44SJohn Forte * CV to inform fp "job" thread that there is work to do. 590fcf3ce44SJohn Forte * See fp_job_handler() function. 591fcf3ce44SJohn Forte */ 592fcf3ce44SJohn Forte kcondvar_t fp_cv; 593fcf3ce44SJohn Forte 594fcf3ce44SJohn Forte /* 595fcf3ce44SJohn Forte * Apparently intended to prevent race conditions by holding off any 596fcf3ce44SJohn Forte * DDI_DETACHes for the local port while a ULP attach is in progress. 597fcf3ce44SJohn Forte */ 598fcf3ce44SJohn Forte kcondvar_t fp_attach_cv; /* ULP attach cv */ 599fcf3ce44SJohn Forte 600fcf3ce44SJohn Forte /* 601fcf3ce44SJohn Forte * Save up the devinfo pointers from Solaris, for performing 602fcf3ce44SJohn Forte * pm_raise_power(), pm_busy_component(), and other DDI friends. 603fcf3ce44SJohn Forte */ 604fcf3ce44SJohn Forte dev_info_t *fp_port_dip; /* port dip */ 605fcf3ce44SJohn Forte dev_info_t *fp_fca_dip; /* FCA dip */ 606fcf3ce44SJohn Forte 607fcf3ce44SJohn Forte /* This is a real Solaris DDI taskq (not the fp "job" queue) */ 608fcf3ce44SJohn Forte taskq_t *fp_taskq; /* callback queue */ 609fcf3ce44SJohn Forte 610fcf3ce44SJohn Forte timeout_id_t fp_wait_tid; /* retry timer */ 611fcf3ce44SJohn Forte timeout_id_t fp_offline_tid; /* Offline timeout ID */ 612*3e5bc1d7SReed fc_lilpmap_t fp_lilp_map; /* LILP map */ 613fcf3ce44SJohn Forte la_els_logi_t fp_service_params; /* service parameters */ 614fcf3ce44SJohn Forte fc_fcp_dma_t fp_fcp_dma; /* FCP DVMA space */ 615fcf3ce44SJohn Forte fc_reset_action_t fp_reset_action; /* FCA reset behavior */ 616fcf3ce44SJohn Forte fc_dma_behavior_t fp_dma_behavior; /* FCA DMA behavior */ 617fcf3ce44SJohn Forte uchar_t fp_sym_node_namelen; /* Sym node name len */ 618fcf3ce44SJohn Forte uchar_t fp_ipa[8]; /* initial proc assoc */ 619fcf3ce44SJohn Forte uchar_t fp_ip_addr[16]; /* IP address */ 620fcf3ce44SJohn Forte uint32_t fp_fc4_types[8]; /* fc4 types */ 621fcf3ce44SJohn Forte struct fc_orphan *fp_orphan_list; /* orphan list */ 622fcf3ce44SJohn Forte int fp_orphan_count; /* number of orphans */ 623fcf3ce44SJohn Forte 624fcf3ce44SJohn Forte /* 625fcf3ce44SJohn Forte * Current PM power level of the local port device. Values 626fcf3ce44SJohn Forte * are given in fc_portif.h 627fcf3ce44SJohn Forte */ 628fcf3ce44SJohn Forte int fp_pm_level; /* power level */ 629fcf3ce44SJohn Forte 630fcf3ce44SJohn Forte /* Increment/decrement in fctl_busy_port() and fctl_idle_port() */ 631fcf3ce44SJohn Forte int fp_pm_busy; /* port busy */ 632fcf3ce44SJohn Forte 633fcf3ce44SJohn Forte int fp_pm_busy_nocomp; /* busy (no comp) */ 634fcf3ce44SJohn Forte fc_hardaddr_t fp_hard_addr; /* Hard Address */ 635fcf3ce44SJohn Forte char fp_sym_port_name[255]; /* Symb port name */ 636fcf3ce44SJohn Forte char fp_sym_node_name[255]; /* Symb node name */ 637fcf3ce44SJohn Forte 638fcf3ce44SJohn Forte /* 639fcf3ce44SJohn Forte * Opaque data for CALLB_CPR_* macros used by the per-local-port 640*3e5bc1d7SReed * job thread. Required for safe thread shutdown during PM operations. 641fcf3ce44SJohn Forte */ 642fcf3ce44SJohn Forte callb_cpr_t fp_cpr_info; /* CPR info */ 643fcf3ce44SJohn Forte 644fcf3ce44SJohn Forte char fp_jindex; /* Not used */ 645fcf3ce44SJohn Forte char fp_jbuf[15]; /* Not used */ 646fcf3ce44SJohn Forte 647*3e5bc1d7SReed char fp_ibuf[15]; /* instance buf */ 648fcf3ce44SJohn Forte char fp_rnid_init; /* init done */ 649fcf3ce44SJohn Forte fc_rnid_t fp_rnid_params; /* node id data */ 650fcf3ce44SJohn Forte 651fcf3ce44SJohn Forte /* T11 FC-HBA data */ 652fcf3ce44SJohn Forte fca_port_attrs_t fp_hba_port_attrs; 653fcf3ce44SJohn Forte fc_hba_state_change_t fp_last_change; 654fcf3ce44SJohn Forte uint8_t fp_port_supported_fc4_types[32]; 655fcf3ce44SJohn Forte uint8_t fp_port_active_fc4_types[32]; 656fcf3ce44SJohn Forte uint32_t fp_port_speed; 657fcf3ce44SJohn Forte la_wwn_t fp_fabric_name; 658fcf3ce44SJohn Forte uint32_t fp_rscn_count; 659fcf3ce44SJohn Forte int fp_npiv_portnum; 660fcf3ce44SJohn Forte #define FC_NPIV_DISABLE 0 661fcf3ce44SJohn Forte #define FC_NPIV_ENABLE 1 662fcf3ce44SJohn Forte int fp_npiv_flag; 663fcf3ce44SJohn Forte #define FC_NPIV_DELETING 1 664fcf3ce44SJohn Forte int fp_npiv_state; 665fcf3ce44SJohn Forte #define FC_PHY_PORT 0 666fcf3ce44SJohn Forte #define FC_NPIV_PORT 1 667fcf3ce44SJohn Forte int fp_npiv_type; 668fcf3ce44SJohn Forte int fp_npiv_portindex[FC_NPIV_MAX_PORT]; 669fcf3ce44SJohn Forte struct fc_local_port *fp_port_next; 670fcf3ce44SJohn Forte struct fc_local_port *fp_port_prev; 671fcf3ce44SJohn Forte } fc_local_port_t; 672fcf3ce44SJohn Forte 673fcf3ce44SJohn Forte 674fcf3ce44SJohn Forte /* 675fcf3ce44SJohn Forte * Struct for the d_id hash table in the fc_local_port_t struct. The code 676fcf3ce44SJohn Forte * allocates memory for an array of D_ID_HASH_TABLE_SIZE elements at 677*3e5bc1d7SReed * attach time. The array pointer is saved at the fp_did_table member 678fcf3ce44SJohn Forte * in the fc_local_port_t struct. 679fcf3ce44SJohn Forte * Each hash chain is a singly-linked list of fc_remote_port_t 680fcf3ce44SJohn Forte * structs, using the pd_did_hnext pointer in the fc_remote_port_t struct. 681fcf3ce44SJohn Forte */ 682fcf3ce44SJohn Forte struct d_id_hash { 683*3e5bc1d7SReed struct fc_remote_port *d_id_head; /* Head of linked list */ 684*3e5bc1d7SReed int d_id_count; /* Count of list entries */ 685fcf3ce44SJohn Forte }; 686fcf3ce44SJohn Forte 687fcf3ce44SJohn Forte 688fcf3ce44SJohn Forte /* 689fcf3ce44SJohn Forte * Struct for the pwwn hash table in the fc_local_port_t struct. The code 690fcf3ce44SJohn Forte * allocates memory for an array of PWWN_HASH_TABLE_SIZE elements at 691*3e5bc1d7SReed * attach time. The array pointer is saved at the fp_pwwn_table member 692fcf3ce44SJohn Forte * in the fc_local_port_t struct. 693fcf3ce44SJohn Forte * Each hash chain is a singly-linked list of fc_remote_port_t 694fcf3ce44SJohn Forte * structs, using the pd_wwn_hnext pointer in the fc_remote_port_t struct. 695fcf3ce44SJohn Forte */ 696fcf3ce44SJohn Forte struct pwwn_hash { 697*3e5bc1d7SReed struct fc_remote_port *pwwn_head; /* Head of linked list */ 698*3e5bc1d7SReed int pwwn_count; /* Count of list entries */ 699fcf3ce44SJohn Forte }; 700fcf3ce44SJohn Forte 701fcf3ce44SJohn Forte 702fcf3ce44SJohn Forte /* Function prototypes */ 703fcf3ce44SJohn Forte static dev_info_t * 704fcf3ce44SJohn Forte fctl_findchild(dev_info_t *pdip, char *cname, char *caddr); 705fcf3ce44SJohn Forte int fctl_fca_create_npivport(dev_info_t *parent, 706fcf3ce44SJohn Forte dev_info_t *phydip, char *nwwn, char *pwwn, uint32_t *vindex); 707fcf3ce44SJohn Forte static int fctl_fca_bus_ctl(dev_info_t *fca_dip, dev_info_t *rip, 708fcf3ce44SJohn Forte ddi_ctl_enum_t op, void *arg, void *result); 709fcf3ce44SJohn Forte static int fctl_initchild(dev_info_t *fca_dip, dev_info_t *port_dip); 710fcf3ce44SJohn Forte static int fctl_uninitchild(dev_info_t *fca_dip, dev_info_t *port_dip); 711fcf3ce44SJohn Forte static int fctl_cache_constructor(void *buf, void *cdarg, int size); 712fcf3ce44SJohn Forte static void fctl_cache_destructor(void *buf, void *cdarg); 713fcf3ce44SJohn Forte static int fctl_pre_attach(fc_ulp_ports_t *ulp_port, fc_attach_cmd_t cmd); 714fcf3ce44SJohn Forte static void fctl_post_attach(fc_ulp_module_t *mod, fc_ulp_ports_t *ulp_port, 715fcf3ce44SJohn Forte fc_attach_cmd_t cmd, int rval); 716fcf3ce44SJohn Forte static int fctl_pre_detach(fc_ulp_ports_t *ulp_port, fc_detach_cmd_t cmd); 717fcf3ce44SJohn Forte static void fctl_post_detach(fc_ulp_module_t *mod, fc_ulp_ports_t *ulp_port, 718fcf3ce44SJohn Forte fc_detach_cmd_t cmd, int rval); 719fcf3ce44SJohn Forte static fc_ulp_ports_t *fctl_add_ulp_port(fc_ulp_module_t *ulp_module, 720fcf3ce44SJohn Forte fc_local_port_t *port_handle, int sleep); 721fcf3ce44SJohn Forte static fc_ulp_ports_t *fctl_alloc_ulp_port(int sleep); 722fcf3ce44SJohn Forte static int fctl_remove_ulp_port(struct ulp_module *ulp_module, 723fcf3ce44SJohn Forte fc_local_port_t *port_handle); 724fcf3ce44SJohn Forte static void fctl_dealloc_ulp_port(fc_ulp_ports_t *next); 725fcf3ce44SJohn Forte static fc_ulp_ports_t *fctl_get_ulp_port(struct ulp_module *ulp_module, 726fcf3ce44SJohn Forte fc_local_port_t *port_handle); 727fcf3ce44SJohn Forte static int fctl_update_host_ns_values(fc_local_port_t *port, 728fcf3ce44SJohn Forte fc_ns_cmd_t *ns_req); 729fcf3ce44SJohn Forte static int fctl_retrieve_host_ns_values(fc_local_port_t *port, 730fcf3ce44SJohn Forte fc_ns_cmd_t *ns_req); 731fcf3ce44SJohn Forte static void fctl_print_if_not_orphan(fc_local_port_t *port, 732fcf3ce44SJohn Forte fc_remote_port_t *pd); 733fcf3ce44SJohn Forte static void fctl_link_reset_done(opaque_t port_handle, uchar_t result); 734fcf3ce44SJohn Forte static int fctl_error(int fc_errno, char **errmsg); 735fcf3ce44SJohn Forte static int fctl_pkt_error(fc_packet_t *pkt, char **state, char **reason, 736fcf3ce44SJohn Forte char **action, char **expln); 737fcf3ce44SJohn Forte static void fctl_check_alpa_list(fc_local_port_t *port, fc_remote_port_t *pd); 738fcf3ce44SJohn Forte static int fctl_is_alpa_present(fc_local_port_t *port, uchar_t alpa); 739fcf3ce44SJohn Forte static void fc_trace_freemsg(fc_trace_logq_t *logq); 740fcf3ce44SJohn Forte static void fctl_init_dma_attr(fc_local_port_t *port, fc_ulp_module_t *mod, 741*3e5bc1d7SReed fc_ulp_port_info_t *info); 742fcf3ce44SJohn Forte fc_local_port_t *fc_get_npiv_port(fc_local_port_t *phyport, la_wwn_t *pwwn); 743fcf3ce44SJohn Forte fc_local_port_t *fc_delete_npiv_port(fc_local_port_t *phyport, la_wwn_t *pwwn); 744fcf3ce44SJohn Forte 745fcf3ce44SJohn Forte 746fcf3ce44SJohn Forte #ifdef __cplusplus 747fcf3ce44SJohn Forte } 748fcf3ce44SJohn Forte #endif 749fcf3ce44SJohn Forte 750fcf3ce44SJohn Forte #endif /* _FCTL_PRIVATE_H */ 751