1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. 4 * Copyright (c) 2014- QLogic Corporation. 5 * All rights reserved 6 * www.qlogic.com 7 * 8 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. 9 */ 10 11 #ifndef __BFA_FCS_H__ 12 #define __BFA_FCS_H__ 13 14 #include "bfa_cs.h" 15 #include "bfa_defs.h" 16 #include "bfa_defs_fcs.h" 17 #include "bfa_modules.h" 18 #include "bfa_fc.h" 19 20 #define BFA_FCS_OS_STR_LEN 64 21 22 /* 23 * !!! Only append to the enums defined here to avoid any versioning 24 * !!! needed between trace utility and driver version 25 */ 26 enum { 27 BFA_TRC_FCS_FCS = 1, 28 BFA_TRC_FCS_PORT = 2, 29 BFA_TRC_FCS_RPORT = 3, 30 BFA_TRC_FCS_FCPIM = 4, 31 }; 32 33 34 struct bfa_fcs_s; 35 36 #define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg) 37 38 #define BFA_FCS_BRCD_SWITCH_OUI 0x051e 39 #define N2N_LOCAL_PID 0x010000 40 #define N2N_REMOTE_PID 0x020000 41 #define BFA_FCS_RETRY_TIMEOUT 2000 42 #define BFA_FCS_MAX_NS_RETRIES 5 43 #define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0) 44 #define BFA_FCS_MAX_RPORT_LOGINS 1024 45 46 /* 47 * VPort NS State Machine events 48 */ 49 enum vport_ns_event { 50 NSSM_EVENT_PORT_ONLINE = 1, 51 NSSM_EVENT_PORT_OFFLINE = 2, 52 NSSM_EVENT_PLOGI_SENT = 3, 53 NSSM_EVENT_RSP_OK = 4, 54 NSSM_EVENT_RSP_ERROR = 5, 55 NSSM_EVENT_TIMEOUT = 6, 56 NSSM_EVENT_NS_QUERY = 7, 57 NSSM_EVENT_RSPNID_SENT = 8, 58 NSSM_EVENT_RFTID_SENT = 9, 59 NSSM_EVENT_RFFID_SENT = 10, 60 NSSM_EVENT_GIDFT_SENT = 11, 61 NSSM_EVENT_RNNID_SENT = 12, 62 NSSM_EVENT_RSNN_NN_SENT = 13, 63 }; 64 65 struct bfa_fcs_lport_ns_s; 66 typedef void (*bfa_fcs_lport_ns_sm_t)(struct bfa_fcs_lport_ns_s *fsm, enum vport_ns_event); 67 68 struct bfa_fcs_lport_ns_s { 69 bfa_fcs_lport_ns_sm_t sm; /* state machine */ 70 struct bfa_timer_s timer; 71 struct bfa_fcs_lport_s *port; /* parent port */ 72 struct bfa_fcxp_s *fcxp; 73 struct bfa_fcxp_wqe_s fcxp_wqe; 74 u8 num_rnnid_retries; 75 u8 num_rsnn_nn_retries; 76 }; 77 78 /* 79 * VPort SCN State Machine events 80 */ 81 enum port_scn_event { 82 SCNSM_EVENT_PORT_ONLINE = 1, 83 SCNSM_EVENT_PORT_OFFLINE = 2, 84 SCNSM_EVENT_RSP_OK = 3, 85 SCNSM_EVENT_RSP_ERROR = 4, 86 SCNSM_EVENT_TIMEOUT = 5, 87 SCNSM_EVENT_SCR_SENT = 6, 88 }; 89 90 struct bfa_fcs_lport_scn_s; 91 typedef void (*bfa_fcs_lport_scn_sm_t)(struct bfa_fcs_lport_scn_s *fsm, enum port_scn_event); 92 93 struct bfa_fcs_lport_scn_s { 94 bfa_fcs_lport_scn_sm_t sm; /* state machine */ 95 struct bfa_timer_s timer; 96 struct bfa_fcs_lport_s *port; /* parent port */ 97 struct bfa_fcxp_s *fcxp; 98 struct bfa_fcxp_wqe_s fcxp_wqe; 99 }; 100 101 102 /* 103 * FDMI State Machine events 104 */ 105 enum port_fdmi_event { 106 FDMISM_EVENT_PORT_ONLINE = 1, 107 FDMISM_EVENT_PORT_OFFLINE = 2, 108 FDMISM_EVENT_RSP_OK = 4, 109 FDMISM_EVENT_RSP_ERROR = 5, 110 FDMISM_EVENT_TIMEOUT = 6, 111 FDMISM_EVENT_RHBA_SENT = 7, 112 FDMISM_EVENT_RPRT_SENT = 8, 113 FDMISM_EVENT_RPA_SENT = 9, 114 }; 115 116 struct bfa_fcs_lport_fdmi_s; 117 typedef void (*bfa_fcs_lport_fdmi_sm_t)(struct bfa_fcs_lport_fdmi_s *fsm, enum port_fdmi_event); 118 119 struct bfa_fcs_lport_fdmi_s { 120 bfa_fcs_lport_fdmi_sm_t sm; /* state machine */ 121 struct bfa_timer_s timer; 122 struct bfa_fcs_lport_ms_s *ms; /* parent ms */ 123 struct bfa_fcxp_s *fcxp; 124 struct bfa_fcxp_wqe_s fcxp_wqe; 125 u8 retry_cnt; /* retry count */ 126 u8 rsvd[3]; 127 }; 128 /* 129 * MS State Machine events 130 */ 131 enum port_ms_event { 132 MSSM_EVENT_PORT_ONLINE = 1, 133 MSSM_EVENT_PORT_OFFLINE = 2, 134 MSSM_EVENT_RSP_OK = 3, 135 MSSM_EVENT_RSP_ERROR = 4, 136 MSSM_EVENT_TIMEOUT = 5, 137 MSSM_EVENT_FCXP_SENT = 6, 138 MSSM_EVENT_PORT_FABRIC_RSCN = 7 139 }; 140 141 struct bfa_fcs_lport_ms_s; 142 typedef void (*bfa_fcs_lport_ms_sm_t)(struct bfa_fcs_lport_ms_s *fsm, enum port_ms_event); 143 144 struct bfa_fcs_lport_ms_s { 145 bfa_fcs_lport_ms_sm_t sm; /* state machine */ 146 struct bfa_timer_s timer; 147 struct bfa_fcs_lport_s *port; /* parent port */ 148 struct bfa_fcxp_s *fcxp; 149 struct bfa_fcxp_wqe_s fcxp_wqe; 150 struct bfa_fcs_lport_fdmi_s fdmi; /* FDMI component of MS */ 151 u8 retry_cnt; /* retry count */ 152 u8 rsvd[3]; 153 }; 154 155 156 struct bfa_fcs_lport_fab_s { 157 struct bfa_fcs_lport_ns_s ns; /* NS component of port */ 158 struct bfa_fcs_lport_scn_s scn; /* scn component of port */ 159 struct bfa_fcs_lport_ms_s ms; /* MS component of port */ 160 }; 161 162 #define MAX_ALPA_COUNT 127 163 164 struct bfa_fcs_lport_loop_s { 165 u8 num_alpa; /* Num of ALPA entries in the map */ 166 u8 alpabm_valid; /* alpa bitmap valid or not (1 or 0) */ 167 u8 alpa_pos_map[MAX_ALPA_COUNT]; /* ALPA Positional Map */ 168 struct bfa_fcs_lport_s *port; /* parent port */ 169 }; 170 171 struct bfa_fcs_lport_n2n_s { 172 u32 rsvd; 173 __be16 reply_oxid; /* ox_id from the req flogi to be 174 *used in flogi acc */ 175 wwn_t rem_port_wwn; /* Attached port's wwn */ 176 }; 177 178 179 union bfa_fcs_lport_topo_u { 180 struct bfa_fcs_lport_fab_s pfab; 181 struct bfa_fcs_lport_loop_s ploop; 182 struct bfa_fcs_lport_n2n_s pn2n; 183 }; 184 185 /* 186 * fcs_port_sm FCS logical port state machine 187 */ 188 189 enum bfa_fcs_lport_event { 190 BFA_FCS_PORT_SM_CREATE = 1, 191 BFA_FCS_PORT_SM_ONLINE = 2, 192 BFA_FCS_PORT_SM_OFFLINE = 3, 193 BFA_FCS_PORT_SM_DELETE = 4, 194 BFA_FCS_PORT_SM_DELRPORT = 5, 195 BFA_FCS_PORT_SM_STOP = 6, 196 }; 197 198 struct bfa_fcs_lport_s; 199 typedef void (*bfa_fcs_lport_sm_t)(struct bfa_fcs_lport_s *fsm, enum bfa_fcs_lport_event); 200 201 struct bfa_fcs_lport_s { 202 struct list_head qe; /* used by port/vport */ 203 bfa_fcs_lport_sm_t sm; /* state machine */ 204 struct bfa_fcs_fabric_s *fabric; /* parent fabric */ 205 struct bfa_lport_cfg_s port_cfg; /* port configuration */ 206 struct bfa_timer_s link_timer; /* timer for link offline */ 207 u32 pid:24; /* FC address */ 208 u8 lp_tag; /* lport tag */ 209 u16 num_rports; /* Num of r-ports */ 210 struct list_head rport_q; /* queue of discovered r-ports */ 211 struct bfa_fcs_s *fcs; /* FCS instance */ 212 union bfa_fcs_lport_topo_u port_topo; /* fabric/loop/n2n details */ 213 struct bfad_port_s *bfad_port; /* driver peer instance */ 214 struct bfa_fcs_vport_s *vport; /* NULL for base ports */ 215 struct bfa_fcxp_s *fcxp; 216 struct bfa_fcxp_wqe_s fcxp_wqe; 217 struct bfa_lport_stats_s stats; 218 struct bfa_wc_s wc; /* waiting counter for events */ 219 }; 220 #define BFA_FCS_GET_HAL_FROM_PORT(port) (port->fcs->bfa) 221 #define BFA_FCS_GET_NS_FROM_PORT(port) (&port->port_topo.pfab.ns) 222 #define BFA_FCS_GET_SCN_FROM_PORT(port) (&port->port_topo.pfab.scn) 223 #define BFA_FCS_GET_MS_FROM_PORT(port) (&port->port_topo.pfab.ms) 224 #define BFA_FCS_GET_FDMI_FROM_PORT(port) (&port->port_topo.pfab.ms.fdmi) 225 #define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \ 226 (port->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM) 227 228 /* 229 * forward declaration 230 */ 231 struct bfad_vf_s; 232 233 enum bfa_fcs_fabric_type { 234 BFA_FCS_FABRIC_UNKNOWN = 0, 235 BFA_FCS_FABRIC_SWITCHED = 1, 236 BFA_FCS_FABRIC_N2N = 2, 237 BFA_FCS_FABRIC_LOOP = 3, 238 }; 239 240 /* 241 * Fabric state machine events 242 */ 243 enum bfa_fcs_fabric_event { 244 BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */ 245 BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */ 246 BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */ 247 BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */ 248 BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */ 249 BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */ 250 BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */ 251 BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */ 252 BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */ 253 BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */ 254 BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */ 255 BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */ 256 BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */ 257 BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */ 258 BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */ 259 BFA_FCS_FABRIC_SM_START = 16, /* from driver */ 260 BFA_FCS_FABRIC_SM_STOP = 17, /* Stop from driver */ 261 BFA_FCS_FABRIC_SM_STOPCOMP = 18, /* Stop completion */ 262 BFA_FCS_FABRIC_SM_LOGOCOMP = 19, /* FLOGO completion */ 263 }; 264 265 struct bfa_fcs_fabric_s; 266 typedef void (*bfa_fcs_fabric_sm_t)(struct bfa_fcs_fabric_s *fsm, enum bfa_fcs_fabric_event); 267 268 struct bfa_fcs_fabric_s { 269 struct list_head qe; /* queue element */ 270 bfa_fcs_fabric_sm_t sm; /* state machine */ 271 struct bfa_fcs_s *fcs; /* FCS instance */ 272 struct bfa_fcs_lport_s bport; /* base logical port */ 273 enum bfa_fcs_fabric_type fab_type; /* fabric type */ 274 enum bfa_port_type oper_type; /* current link topology */ 275 u8 is_vf; /* is virtual fabric? */ 276 u8 is_npiv; /* is NPIV supported ? */ 277 u8 is_auth; /* is Security/Auth supported ? */ 278 u16 bb_credit; /* BB credit from fabric */ 279 u16 vf_id; /* virtual fabric ID */ 280 u16 num_vports; /* num vports */ 281 u16 rsvd; 282 struct list_head vport_q; /* queue of virtual ports */ 283 struct list_head vf_q; /* queue of virtual fabrics */ 284 struct bfad_vf_s *vf_drv; /* driver vf structure */ 285 struct bfa_timer_s link_timer; /* Link Failure timer. Vport */ 286 wwn_t fabric_name; /* attached fabric name */ 287 bfa_boolean_t auth_reqd; /* authentication required */ 288 struct bfa_timer_s delay_timer; /* delay timer */ 289 union { 290 u16 swp_vfid;/* switch port VF id */ 291 } event_arg; 292 struct bfa_wc_s wc; /* wait counter for delete */ 293 struct bfa_vf_stats_s stats; /* fabric/vf stats */ 294 struct bfa_lps_s *lps; /* lport login services */ 295 u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; 296 /* attached fabric's ip addr */ 297 struct bfa_wc_s stop_wc; /* wait counter for stop */ 298 }; 299 300 #define bfa_fcs_fabric_npiv_capable(__f) ((__f)->is_npiv) 301 #define bfa_fcs_fabric_is_switched(__f) \ 302 ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED) 303 304 /* 305 * The design calls for a single implementation of base fabric and vf. 306 */ 307 #define bfa_fcs_vf_t struct bfa_fcs_fabric_s 308 309 struct bfa_vf_event_s { 310 u32 undefined; 311 }; 312 313 /* 314 * @todo : need to move to a global config file. 315 * Maximum Rports supported per port (physical/logical). 316 */ 317 #define BFA_FCS_MAX_RPORTS_SUPP 256 /* @todo : tentative value */ 318 319 #define bfa_fcs_lport_t struct bfa_fcs_lport_s 320 321 /* 322 * Symbolic Name related defines 323 * Total bytes 255. 324 * Physical Port's symbolic name 128 bytes. 325 * For Vports, Vport's symbolic name is appended to the Physical port's 326 * Symbolic Name. 327 * 328 * Physical Port's symbolic name Format : (Total 128 bytes) 329 * Adapter Model number/name : 16 bytes 330 * Driver Version : 10 bytes 331 * Host Machine Name : 30 bytes 332 * Host OS Info : 44 bytes 333 * Host OS PATCH Info : 16 bytes 334 * ( remaining 12 bytes reserved to be used for separator) 335 */ 336 #define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | " 337 338 #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16 339 #define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10 340 #define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30 341 #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44 342 #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 343 344 /* 345 * Get FC port ID for a logical port. 346 */ 347 #define bfa_fcs_lport_get_fcid(_lport) ((_lport)->pid) 348 #define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn) 349 #define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn) 350 #define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name) 351 #define bfa_fcs_lport_get_nsym_name(_lport) ((_lport)->port_cfg.node_sym_name) 352 #define bfa_fcs_lport_is_initiator(_lport) \ 353 ((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM) 354 #define bfa_fcs_lport_get_nrports(_lport) \ 355 ((_lport) ? (_lport)->num_rports : 0) 356 357 static inline struct bfad_port_s * 358 bfa_fcs_lport_get_drvport(struct bfa_fcs_lport_s *port) 359 { 360 return port->bfad_port; 361 } 362 363 #define bfa_fcs_lport_get_opertype(_lport) ((_lport)->fabric->oper_type) 364 #define bfa_fcs_lport_get_fabric_name(_lport) ((_lport)->fabric->fabric_name) 365 #define bfa_fcs_lport_get_fabric_ipaddr(_lport) \ 366 ((_lport)->fabric->fabric_ip_addr) 367 368 /* 369 * bfa fcs port public functions 370 */ 371 372 bfa_boolean_t bfa_fcs_lport_is_online(struct bfa_fcs_lport_s *port); 373 struct bfa_fcs_lport_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs); 374 void bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port, 375 struct bfa_rport_qualifier_s rport[], int *nrports); 376 377 struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, 378 u16 vf_id, wwn_t lpwwn); 379 380 void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname); 381 void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, 382 struct bfa_lport_attr_s *port_attr); 383 void bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port, 384 struct bfa_lport_stats_s *port_stats); 385 void bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port); 386 enum bfa_port_speed bfa_fcs_lport_get_rport_max_speed( 387 struct bfa_fcs_lport_s *port); 388 389 /* MS FCS routines */ 390 void bfa_fcs_lport_ms_init(struct bfa_fcs_lport_s *port); 391 void bfa_fcs_lport_ms_offline(struct bfa_fcs_lport_s *port); 392 void bfa_fcs_lport_ms_online(struct bfa_fcs_lport_s *port); 393 void bfa_fcs_lport_ms_fabric_rscn(struct bfa_fcs_lport_s *port); 394 395 /* FDMI FCS routines */ 396 void bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms); 397 void bfa_fcs_lport_fdmi_offline(struct bfa_fcs_lport_ms_s *ms); 398 void bfa_fcs_lport_fdmi_online(struct bfa_fcs_lport_ms_s *ms); 399 void bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, struct fchs_s *fchs, 400 u16 len); 401 void bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs, 402 u16 vf_id, struct bfa_fcs_vport_s *vport); 403 void bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, 404 struct bfa_lport_cfg_s *port_cfg); 405 void bfa_fcs_lport_online(struct bfa_fcs_lport_s *port); 406 void bfa_fcs_lport_offline(struct bfa_fcs_lport_s *port); 407 void bfa_fcs_lport_delete(struct bfa_fcs_lport_s *port); 408 void bfa_fcs_lport_stop(struct bfa_fcs_lport_s *port); 409 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pid( 410 struct bfa_fcs_lport_s *port, u32 pid); 411 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_old_pid( 412 struct bfa_fcs_lport_s *port, u32 pid); 413 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pwwn( 414 struct bfa_fcs_lport_s *port, wwn_t pwwn); 415 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_qualifier( 416 struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 pid); 417 void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port, 418 struct bfa_fcs_rport_s *rport); 419 void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port, 420 struct bfa_fcs_rport_s *rport); 421 void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport); 422 void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport); 423 void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport); 424 void bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port); 425 void bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, 426 struct bfa_fcxp_s *fcxp_alloced); 427 void bfa_fcs_lport_scn_init(struct bfa_fcs_lport_s *vport); 428 void bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *vport); 429 void bfa_fcs_lport_fab_scn_online(struct bfa_fcs_lport_s *vport); 430 void bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port, 431 struct fchs_s *rx_frame, u32 len); 432 void bfa_fcs_lport_lip_scn_online(bfa_fcs_lport_t *port); 433 434 /* 435 * VPort State Machine events 436 */ 437 enum bfa_fcs_vport_event { 438 BFA_FCS_VPORT_SM_CREATE = 1, /* vport create event */ 439 BFA_FCS_VPORT_SM_DELETE = 2, /* vport delete event */ 440 BFA_FCS_VPORT_SM_START = 3, /* vport start request */ 441 BFA_FCS_VPORT_SM_STOP = 4, /* stop: unsupported */ 442 BFA_FCS_VPORT_SM_ONLINE = 5, /* fabric online */ 443 BFA_FCS_VPORT_SM_OFFLINE = 6, /* fabric offline event */ 444 BFA_FCS_VPORT_SM_FRMSENT = 7, /* fdisc/logo sent events */ 445 BFA_FCS_VPORT_SM_RSP_OK = 8, /* good response */ 446 BFA_FCS_VPORT_SM_RSP_ERROR = 9, /* error/bad response */ 447 BFA_FCS_VPORT_SM_TIMEOUT = 10, /* delay timer event */ 448 BFA_FCS_VPORT_SM_DELCOMP = 11, /* lport delete completion */ 449 BFA_FCS_VPORT_SM_RSP_DUP_WWN = 12, /* Dup wnn error*/ 450 BFA_FCS_VPORT_SM_RSP_FAILED = 13, /* non-retryable failure */ 451 BFA_FCS_VPORT_SM_STOPCOMP = 14, /* vport delete completion */ 452 BFA_FCS_VPORT_SM_FABRIC_MAX = 15, /* max vports on fabric */ 453 }; 454 455 struct bfa_fcs_vport_s; 456 typedef void (*bfa_fcs_vport_sm_t)(struct bfa_fcs_vport_s *fsm, enum bfa_fcs_vport_event); 457 458 struct bfa_fcs_vport_s { 459 struct list_head qe; /* queue elem */ 460 bfa_fcs_vport_sm_t sm; /* state machine */ 461 bfa_fcs_lport_t lport; /* logical port */ 462 struct bfa_timer_s timer; 463 struct bfad_vport_s *vport_drv; /* Driver private */ 464 struct bfa_vport_stats_s vport_stats; /* vport statistics */ 465 struct bfa_lps_s *lps; /* Lport login service*/ 466 int fdisc_retries; 467 }; 468 469 #define bfa_fcs_vport_get_port(vport) \ 470 ((struct bfa_fcs_lport_s *)(&vport->port)) 471 472 /* 473 * bfa fcs vport public functions 474 */ 475 bfa_status_t bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, 476 struct bfa_fcs_s *fcs, u16 vf_id, 477 struct bfa_lport_cfg_s *port_cfg, 478 struct bfad_vport_s *vport_drv); 479 bfa_status_t bfa_fcs_pbc_vport_create(struct bfa_fcs_vport_s *vport, 480 struct bfa_fcs_s *fcs, u16 vf_id, 481 struct bfa_lport_cfg_s *port_cfg, 482 struct bfad_vport_s *vport_drv); 483 bfa_status_t bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport); 484 bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport); 485 bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport); 486 void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport, 487 struct bfa_vport_attr_s *vport_attr); 488 struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, 489 u16 vf_id, wwn_t vpwwn); 490 void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport); 491 void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport); 492 void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport); 493 void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport); 494 void bfa_fcs_vport_fcs_stop(struct bfa_fcs_vport_s *vport); 495 void bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport); 496 497 #define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90 /* in secs */ 498 #define BFA_FCS_RPORT_MAX_RETRIES (5) 499 500 /* 501 * forward declarations 502 */ 503 struct bfad_rport_s; 504 505 struct bfa_fcs_itnim_s; 506 struct bfa_fcs_tin_s; 507 struct bfa_fcs_iprp_s; 508 509 /* 510 * fcs_rport_ftrs_sm FCS rport state machine events 511 */ 512 513 enum rpf_event { 514 RPFSM_EVENT_RPORT_OFFLINE = 1, /* Rport offline */ 515 RPFSM_EVENT_RPORT_ONLINE = 2, /* Rport online */ 516 RPFSM_EVENT_FCXP_SENT = 3, /* Frame from has been sent */ 517 RPFSM_EVENT_TIMEOUT = 4, /* Rport SM timeout event */ 518 RPFSM_EVENT_RPSC_COMP = 5, 519 RPFSM_EVENT_RPSC_FAIL = 6, 520 RPFSM_EVENT_RPSC_ERROR = 7, 521 }; 522 523 struct bfa_fcs_rpf_s; 524 typedef void (*bfa_fcs_rpf_sm_t)(struct bfa_fcs_rpf_s *, enum rpf_event); 525 526 /* Rport Features (RPF) */ 527 struct bfa_fcs_rpf_s { 528 bfa_fcs_rpf_sm_t sm; /* state machine */ 529 struct bfa_fcs_rport_s *rport; /* parent rport */ 530 struct bfa_timer_s timer; /* general purpose timer */ 531 struct bfa_fcxp_s *fcxp; /* FCXP needed for discarding */ 532 struct bfa_fcxp_wqe_s fcxp_wqe; /* fcxp wait queue element */ 533 int rpsc_retries; /* max RPSC retry attempts */ 534 enum bfa_port_speed rpsc_speed; 535 /* Current Speed from RPSC. O if RPSC fails */ 536 enum bfa_port_speed assigned_speed; 537 /* 538 * Speed assigned by the user. will be used if RPSC is 539 * not supported by the rport. 540 */ 541 }; 542 543 /* 544 * fcs_rport_sm FCS rport state machine events 545 */ 546 enum rport_event { 547 RPSM_EVENT_PLOGI_SEND = 1, /* new rport; start with PLOGI */ 548 RPSM_EVENT_PLOGI_RCVD = 2, /* Inbound PLOGI from remote port */ 549 RPSM_EVENT_PLOGI_COMP = 3, /* PLOGI completed to rport */ 550 RPSM_EVENT_LOGO_RCVD = 4, /* LOGO from remote device */ 551 RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */ 552 RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */ 553 RPSM_EVENT_DELETE = 7, /* RPORT delete request */ 554 RPSM_EVENT_FAB_SCN = 8, /* state change notification */ 555 RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */ 556 RPSM_EVENT_FAILED = 10, /* Request to rport failed. */ 557 RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */ 558 RPSM_EVENT_HCB_ONLINE = 12, /* BFA rport online callback */ 559 RPSM_EVENT_HCB_OFFLINE = 13, /* BFA rport offline callback */ 560 RPSM_EVENT_FC4_OFFLINE = 14, /* FC-4 offline complete */ 561 RPSM_EVENT_ADDRESS_CHANGE = 15, /* Rport's PID has changed */ 562 RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */ 563 RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */ 564 RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continuously */ 565 RPSM_EVENT_SCN_OFFLINE = 19, /* loop scn offline */ 566 RPSM_EVENT_SCN_ONLINE = 20, /* loop scn online */ 567 RPSM_EVENT_FC4_FCS_ONLINE = 21, /* FC-4 FCS online complete */ 568 }; 569 570 struct bfa_fcs_rport_s; 571 typedef void (*bfa_fcs_rport_sm_t)(struct bfa_fcs_rport_s *, enum rport_event); 572 573 struct bfa_fcs_rport_s { 574 struct list_head qe; /* used by port/vport */ 575 struct bfa_fcs_lport_s *port; /* parent FCS port */ 576 struct bfa_fcs_s *fcs; /* fcs instance */ 577 struct bfad_rport_s *rp_drv; /* driver peer instance */ 578 u32 pid; /* port ID of rport */ 579 u32 old_pid; /* PID before rport goes offline */ 580 u16 maxfrsize; /* maximum frame size */ 581 __be16 reply_oxid; /* OX_ID of inbound requests */ 582 enum fc_cos fc_cos; /* FC classes of service supp */ 583 bfa_boolean_t cisc; /* CISC capable device */ 584 bfa_boolean_t prlo; /* processing prlo or LOGO */ 585 bfa_boolean_t plogi_pending; /* Rx Plogi Pending */ 586 wwn_t pwwn; /* port wwn of rport */ 587 wwn_t nwwn; /* node wwn of rport */ 588 struct bfa_rport_symname_s psym_name; /* port symbolic name */ 589 bfa_fcs_rport_sm_t sm; /* state machine */ 590 struct bfa_timer_s timer; /* general purpose timer */ 591 struct bfa_fcs_itnim_s *itnim; /* ITN initiator mode role */ 592 struct bfa_fcs_tin_s *tin; /* ITN initiator mode role */ 593 struct bfa_fcs_iprp_s *iprp; /* IP/FC role */ 594 struct bfa_rport_s *bfa_rport; /* BFA Rport */ 595 struct bfa_fcxp_s *fcxp; /* FCXP needed for discarding */ 596 int plogi_retries; /* max plogi retry attempts */ 597 int ns_retries; /* max NS query retry attempts */ 598 struct bfa_fcxp_wqe_s fcxp_wqe; /* fcxp wait queue element */ 599 struct bfa_rport_stats_s stats; /* rport stats */ 600 enum bfa_rport_function scsi_function; /* Initiator/Target */ 601 struct bfa_fcs_rpf_s rpf; /* Rport features module */ 602 bfa_boolean_t scn_online; /* SCN online flag */ 603 }; 604 605 static inline struct bfa_rport_s * 606 bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport) 607 { 608 return rport->bfa_rport; 609 } 610 611 /* 612 * bfa fcs rport API functions 613 */ 614 void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, 615 struct bfa_rport_attr_s *attr); 616 struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, 617 wwn_t rpwwn); 618 void bfa_fcs_rport_set_del_timeout(u8 rport_tmo); 619 void bfa_fcs_rport_set_max_logins(u32 max_logins); 620 void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, 621 struct fchs_s *fchs, u16 len); 622 void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); 623 624 struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port, 625 u32 pid); 626 void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, 627 struct fchs_s *rx_fchs, 628 struct fc_logi_s *plogi); 629 void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, 630 struct fc_logi_s *plogi); 631 void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id); 632 633 void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport); 634 void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport); 635 int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport); 636 struct bfa_fcs_rport_s *bfa_fcs_rport_create_by_wwn( 637 struct bfa_fcs_lport_s *port, wwn_t wwn); 638 void bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport); 639 void bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport); 640 void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport); 641 642 /* 643 * fcs_itnim_sm FCS itnim state machine events 644 */ 645 enum bfa_fcs_itnim_event { 646 BFA_FCS_ITNIM_SM_FCS_ONLINE = 1, /* rport online event */ 647 BFA_FCS_ITNIM_SM_OFFLINE = 2, /* rport offline */ 648 BFA_FCS_ITNIM_SM_FRMSENT = 3, /* prli frame is sent */ 649 BFA_FCS_ITNIM_SM_RSP_OK = 4, /* good response */ 650 BFA_FCS_ITNIM_SM_RSP_ERROR = 5, /* error response */ 651 BFA_FCS_ITNIM_SM_TIMEOUT = 6, /* delay timeout */ 652 BFA_FCS_ITNIM_SM_HCB_OFFLINE = 7, /* BFA online callback */ 653 BFA_FCS_ITNIM_SM_HCB_ONLINE = 8, /* BFA offline callback */ 654 BFA_FCS_ITNIM_SM_INITIATOR = 9, /* rport is initiator */ 655 BFA_FCS_ITNIM_SM_DELETE = 10, /* delete event from rport */ 656 BFA_FCS_ITNIM_SM_PRLO = 11, /* delete event from rport */ 657 BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12, /* cmd not supported rsp */ 658 BFA_FCS_ITNIM_SM_HAL_ONLINE = 13, /* bfa rport online event */ 659 }; 660 661 struct bfa_fcs_itnim_s; 662 typedef void (*bfa_fcs_itnim_sm_t)(struct bfa_fcs_itnim_s *, enum bfa_fcs_itnim_event); 663 664 /* 665 * forward declarations 666 */ 667 struct bfad_itnim_s; 668 669 struct bfa_fcs_itnim_s { 670 bfa_fcs_itnim_sm_t sm; /* state machine */ 671 struct bfa_fcs_rport_s *rport; /* parent remote rport */ 672 struct bfad_itnim_s *itnim_drv; /* driver peer instance */ 673 struct bfa_fcs_s *fcs; /* fcs instance */ 674 struct bfa_timer_s timer; /* timer functions */ 675 struct bfa_itnim_s *bfa_itnim; /* BFA itnim struct */ 676 u32 prli_retries; /* max prli retry attempts */ 677 bfa_boolean_t seq_rec; /* seq recovery support */ 678 bfa_boolean_t rec_support; /* REC supported */ 679 bfa_boolean_t conf_comp; /* FCP_CONF support */ 680 bfa_boolean_t task_retry_id; /* task retry id supp */ 681 struct bfa_fcxp_wqe_s fcxp_wqe; /* wait qelem for fcxp */ 682 struct bfa_fcxp_s *fcxp; /* FCXP in use */ 683 struct bfa_itnim_stats_s stats; /* itn statistics */ 684 }; 685 #define bfa_fcs_fcxp_alloc(__fcs, __req) \ 686 bfa_fcxp_req_rsp_alloc(NULL, (__fcs)->bfa, 0, 0, \ 687 NULL, NULL, NULL, NULL, __req) 688 #define bfa_fcs_fcxp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \ 689 __alloc_cbarg, __req) \ 690 bfa_fcxp_req_rsp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \ 691 __alloc_cbarg, NULL, 0, 0, NULL, NULL, NULL, NULL, __req) 692 693 static inline struct bfad_port_s * 694 bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim) 695 { 696 return itnim->rport->port->bfad_port; 697 } 698 699 700 static inline struct bfa_fcs_lport_s * 701 bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim) 702 { 703 return itnim->rport->port; 704 } 705 706 707 static inline wwn_t 708 bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim) 709 { 710 return itnim->rport->nwwn; 711 } 712 713 714 static inline wwn_t 715 bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim) 716 { 717 return itnim->rport->pwwn; 718 } 719 720 721 static inline u32 722 bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim) 723 { 724 return itnim->rport->pid; 725 } 726 727 728 static inline u32 729 bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim) 730 { 731 return itnim->rport->maxfrsize; 732 } 733 734 735 static inline enum fc_cos 736 bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim) 737 { 738 return itnim->rport->fc_cos; 739 } 740 741 742 static inline struct bfad_itnim_s * 743 bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim) 744 { 745 return itnim->itnim_drv; 746 } 747 748 749 static inline struct bfa_itnim_s * 750 bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim) 751 { 752 return itnim->bfa_itnim; 753 } 754 755 /* 756 * bfa fcs FCP Initiator mode API functions 757 */ 758 void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim, 759 struct bfa_itnim_attr_s *attr); 760 void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim, 761 struct bfa_itnim_stats_s *stats); 762 struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port, 763 wwn_t rpwwn); 764 bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn, 765 struct bfa_itnim_attr_s *attr); 766 bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn, 767 struct bfa_itnim_stats_s *stats); 768 bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port, 769 wwn_t rpwwn); 770 struct bfa_fcs_itnim_s *bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport); 771 void bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim); 772 void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim); 773 void bfa_fcs_itnim_brp_online(struct bfa_fcs_itnim_s *itnim); 774 bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim); 775 void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim); 776 void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, 777 struct fchs_s *fchs, u16 len); 778 779 #define BFA_FCS_FDMI_SUPP_SPEEDS_4G (FDMI_TRANS_SPEED_1G | \ 780 FDMI_TRANS_SPEED_2G | \ 781 FDMI_TRANS_SPEED_4G) 782 783 #define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \ 784 FDMI_TRANS_SPEED_2G | \ 785 FDMI_TRANS_SPEED_4G | \ 786 FDMI_TRANS_SPEED_8G) 787 788 #define BFA_FCS_FDMI_SUPP_SPEEDS_16G (FDMI_TRANS_SPEED_2G | \ 789 FDMI_TRANS_SPEED_4G | \ 790 FDMI_TRANS_SPEED_8G | \ 791 FDMI_TRANS_SPEED_16G) 792 793 #define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G 794 795 #define BFA_FCS_FDMI_VENDOR_INFO_LEN 8 796 #define BFA_FCS_FDMI_FC4_TYPE_LEN 32 797 798 /* 799 * HBA Attribute Block : BFA internal representation. Note : Some variable 800 * sizes have been trimmed to suit BFA For Ex : Model will be "QLogic ". Based 801 * on this the size has been reduced to 16 bytes from the standard's 64 bytes. 802 */ 803 struct bfa_fcs_fdmi_hba_attr_s { 804 wwn_t node_name; 805 u8 manufacturer[64]; 806 u8 serial_num[64]; 807 u8 model[16]; 808 u8 model_desc[128]; 809 u8 hw_version[8]; 810 u8 driver_version[BFA_VERSION_LEN]; 811 u8 option_rom_ver[BFA_VERSION_LEN]; 812 u8 fw_version[BFA_VERSION_LEN]; 813 u8 os_name[256]; 814 __be32 max_ct_pyld; 815 struct bfa_lport_symname_s node_sym_name; 816 u8 vendor_info[BFA_FCS_FDMI_VENDOR_INFO_LEN]; 817 __be32 num_ports; 818 wwn_t fabric_name; 819 u8 bios_ver[BFA_VERSION_LEN]; 820 }; 821 822 /* 823 * Port Attribute Block 824 */ 825 struct bfa_fcs_fdmi_port_attr_s { 826 u8 supp_fc4_types[BFA_FCS_FDMI_FC4_TYPE_LEN]; 827 __be32 supp_speed; /* supported speed */ 828 __be32 curr_speed; /* current Speed */ 829 __be32 max_frm_size; /* max frame size */ 830 u8 os_device_name[256]; /* OS device Name */ 831 u8 host_name[256]; /* host name */ 832 wwn_t port_name; 833 wwn_t node_name; 834 struct bfa_lport_symname_s port_sym_name; 835 __be32 port_type; 836 enum fc_cos scos; 837 wwn_t port_fabric_name; 838 u8 port_act_fc4_type[BFA_FCS_FDMI_FC4_TYPE_LEN]; 839 __be32 port_state; 840 __be32 num_ports; 841 }; 842 843 struct bfa_fcs_stats_s { 844 struct { 845 u32 untagged; /* untagged receive frames */ 846 u32 tagged; /* tagged receive frames */ 847 u32 vfid_unknown; /* VF id is unknown */ 848 } uf; 849 }; 850 851 struct bfa_fcs_driver_info_s { 852 u8 version[BFA_VERSION_LEN]; /* Driver Version */ 853 u8 host_machine_name[BFA_FCS_OS_STR_LEN]; 854 u8 host_os_name[BFA_FCS_OS_STR_LEN]; /* OS name and version */ 855 u8 host_os_patch[BFA_FCS_OS_STR_LEN]; /* patch or service pack */ 856 u8 os_device_name[BFA_FCS_OS_STR_LEN]; /* Driver Device Name */ 857 }; 858 859 struct bfa_fcs_s { 860 struct bfa_s *bfa; /* corresponding BFA bfa instance */ 861 struct bfad_s *bfad; /* corresponding BDA driver instance */ 862 struct bfa_trc_mod_s *trcmod; /* tracing module */ 863 bfa_boolean_t vf_enabled; /* VF mode is enabled */ 864 bfa_boolean_t fdmi_enabled; /* FDMI is enabled */ 865 bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ 866 u16 port_vfid; /* port default VF ID */ 867 struct bfa_fcs_driver_info_s driver_info; 868 struct bfa_fcs_fabric_s fabric; /* base fabric state machine */ 869 struct bfa_fcs_stats_s stats; /* FCS statistics */ 870 struct bfa_wc_s wc; /* waiting counter */ 871 int fcs_aen_seq; 872 u32 num_rport_logins; 873 }; 874 875 /* 876 * fcs_fabric_sm fabric state machine functions 877 */ 878 879 /* 880 * bfa fcs API functions 881 */ 882 void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, 883 struct bfad_s *bfad, 884 bfa_boolean_t min_cfg); 885 void bfa_fcs_init(struct bfa_fcs_s *fcs); 886 void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs); 887 void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs); 888 void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, 889 struct bfa_fcs_driver_info_s *driver_info); 890 void bfa_fcs_exit(struct bfa_fcs_s *fcs); 891 void bfa_fcs_stop(struct bfa_fcs_s *fcs); 892 893 /* 894 * bfa fcs vf public functions 895 */ 896 bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id); 897 void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports); 898 899 /* 900 * fabric protected interface functions 901 */ 902 void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs); 903 void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric); 904 void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric); 905 void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric, 906 struct bfa_fcs_vport_s *vport); 907 void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric, 908 struct bfa_fcs_vport_s *vport); 909 struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup( 910 struct bfa_fcs_fabric_s *fabric, wwn_t pwwn); 911 void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs); 912 void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, 913 struct fchs_s *fchs, u16 len); 914 void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); 915 void bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric); 916 void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, 917 wwn_t fabric_name); 918 u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric); 919 void bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs); 920 void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, 921 enum bfa_fcs_fabric_event event); 922 void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, 923 enum bfa_fcs_fabric_event event); 924 void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, 925 enum bfa_fcs_fabric_event event); 926 927 /* 928 * BFA FCS callback interfaces 929 */ 930 931 /* 932 * fcb Main fcs callbacks 933 */ 934 935 struct bfad_port_s; 936 struct bfad_vport_s; 937 938 /* 939 * lport callbacks 940 */ 941 struct bfad_port_s *bfa_fcb_lport_new(struct bfad_s *bfad, 942 struct bfa_fcs_lport_s *port, 943 enum bfa_lport_role roles, 944 struct bfad_vf_s *vf_drv, 945 struct bfad_vport_s *vp_drv); 946 947 /* 948 * vport callbacks 949 */ 950 void bfa_fcb_pbc_vport_create(struct bfad_s *bfad, struct bfi_pbc_vport_s); 951 952 /* 953 * rport callbacks 954 */ 955 bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad, 956 struct bfa_fcs_rport_s **rport, 957 struct bfad_rport_s **rport_drv); 958 959 /* 960 * itnim callbacks 961 */ 962 int bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim, 963 struct bfad_itnim_s **itnim_drv); 964 void bfa_fcb_itnim_free(struct bfad_s *bfad, 965 struct bfad_itnim_s *itnim_drv); 966 void bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv); 967 void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv); 968 969 #endif /* __BFA_FCS_H__ */ 970