Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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