1*52fa7bf9SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2a36c61f9SKrishna Gudipati /* 3889d0d42SAnil Gurumurthy * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. 4889d0d42SAnil Gurumurthy * Copyright (c) 2014- QLogic Corporation. 5a36c61f9SKrishna Gudipati * All rights reserved 6889d0d42SAnil Gurumurthy * www.qlogic.com 7a36c61f9SKrishna Gudipati * 831e1d569SAnil Gurumurthy * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. 9a36c61f9SKrishna Gudipati */ 10a36c61f9SKrishna Gudipati 11a36c61f9SKrishna Gudipati #ifndef __BFA_DEFS_FCS_H__ 12a36c61f9SKrishna Gudipati #define __BFA_DEFS_FCS_H__ 13a36c61f9SKrishna Gudipati 14a36c61f9SKrishna Gudipati #include "bfa_fc.h" 15a36c61f9SKrishna Gudipati #include "bfa_defs_svc.h" 16a36c61f9SKrishna Gudipati 17acdc79a6SJing Huang /* 18a36c61f9SKrishna Gudipati * VF states 19a36c61f9SKrishna Gudipati */ 20a36c61f9SKrishna Gudipati enum bfa_vf_state { 21a36c61f9SKrishna Gudipati BFA_VF_UNINIT = 0, /* fabric is not yet initialized */ 22a36c61f9SKrishna Gudipati BFA_VF_LINK_DOWN = 1, /* link is down */ 23a36c61f9SKrishna Gudipati BFA_VF_FLOGI = 2, /* flogi is in progress */ 24a36c61f9SKrishna Gudipati BFA_VF_AUTH = 3, /* authentication in progress */ 25a36c61f9SKrishna Gudipati BFA_VF_NOFABRIC = 4, /* fabric is not present */ 26a36c61f9SKrishna Gudipati BFA_VF_ONLINE = 5, /* login to fabric is complete */ 27a36c61f9SKrishna Gudipati BFA_VF_EVFP = 6, /* EVFP is in progress */ 28a36c61f9SKrishna Gudipati BFA_VF_ISOLATED = 7, /* port isolated due to vf_id mismatch */ 29a36c61f9SKrishna Gudipati }; 30a36c61f9SKrishna Gudipati 31acdc79a6SJing Huang /* 32a36c61f9SKrishna Gudipati * VF statistics 33a36c61f9SKrishna Gudipati */ 34a36c61f9SKrishna Gudipati struct bfa_vf_stats_s { 35a36c61f9SKrishna Gudipati u32 flogi_sent; /* Num FLOGIs sent */ 36a36c61f9SKrishna Gudipati u32 flogi_rsp_err; /* FLOGI response errors */ 37a36c61f9SKrishna Gudipati u32 flogi_acc_err; /* FLOGI accept errors */ 38a36c61f9SKrishna Gudipati u32 flogi_accepts; /* FLOGI accepts received */ 39a36c61f9SKrishna Gudipati u32 flogi_rejects; /* FLOGI rejects received */ 40a36c61f9SKrishna Gudipati u32 flogi_unknown_rsp; /* Unknown responses for FLOGI */ 41a36c61f9SKrishna Gudipati u32 flogi_alloc_wait; /* Allocation waits prior to sending FLOGI */ 42a36c61f9SKrishna Gudipati u32 flogi_rcvd; /* FLOGIs received */ 43a36c61f9SKrishna Gudipati u32 flogi_rejected; /* Incoming FLOGIs rejected */ 44a36c61f9SKrishna Gudipati u32 fabric_onlines; /* Internal fabric online notification sent 45a36c61f9SKrishna Gudipati * to other modules */ 46a36c61f9SKrishna Gudipati u32 fabric_offlines; /* Internal fabric offline notification sent 47a36c61f9SKrishna Gudipati * to other modules */ 48a36c61f9SKrishna Gudipati u32 resvd; /* padding for 64 bit alignment */ 49a36c61f9SKrishna Gudipati }; 50a36c61f9SKrishna Gudipati 51acdc79a6SJing Huang /* 52a36c61f9SKrishna Gudipati * VF attributes returned in queries 53a36c61f9SKrishna Gudipati */ 54a36c61f9SKrishna Gudipati struct bfa_vf_attr_s { 55a36c61f9SKrishna Gudipati enum bfa_vf_state state; /* VF state */ 56a36c61f9SKrishna Gudipati u32 rsvd; 57a36c61f9SKrishna Gudipati wwn_t fabric_name; /* fabric name */ 58a36c61f9SKrishna Gudipati }; 59a36c61f9SKrishna Gudipati 60a36c61f9SKrishna Gudipati #define BFA_FCS_MAX_LPORTS 256 61a36c61f9SKrishna Gudipati #define BFA_FCS_FABRIC_IPADDR_SZ 16 62a36c61f9SKrishna Gudipati 63acdc79a6SJing Huang /* 64a36c61f9SKrishna Gudipati * symbolic names for base port/virtual port 65a36c61f9SKrishna Gudipati */ 66a36c61f9SKrishna Gudipati #define BFA_SYMNAME_MAXLEN 128 /* 128 bytes */ 67a36c61f9SKrishna Gudipati struct bfa_lport_symname_s { 68a36c61f9SKrishna Gudipati char symname[BFA_SYMNAME_MAXLEN]; 69a36c61f9SKrishna Gudipati }; 70a36c61f9SKrishna Gudipati 71acdc79a6SJing Huang /* 72a36c61f9SKrishna Gudipati * Roles of FCS port: 73a36c61f9SKrishna Gudipati * - FCP IM and FCP TM roles cannot be enabled together for a FCS port 74a36c61f9SKrishna Gudipati * - Create multiple ports if both IM and TM functions required. 75a36c61f9SKrishna Gudipati * - Atleast one role must be specified. 76a36c61f9SKrishna Gudipati */ 77a36c61f9SKrishna Gudipati enum bfa_lport_role { 78a36c61f9SKrishna Gudipati BFA_LPORT_ROLE_FCP_IM = 0x01, /* FCP initiator role */ 79a36c61f9SKrishna Gudipati BFA_LPORT_ROLE_FCP_MAX = BFA_LPORT_ROLE_FCP_IM, 80a36c61f9SKrishna Gudipati }; 81a36c61f9SKrishna Gudipati 82acdc79a6SJing Huang /* 83a36c61f9SKrishna Gudipati * FCS port configuration. 84a36c61f9SKrishna Gudipati */ 85a36c61f9SKrishna Gudipati struct bfa_lport_cfg_s { 86a36c61f9SKrishna Gudipati wwn_t pwwn; /* port wwn */ 87a36c61f9SKrishna Gudipati wwn_t nwwn; /* node wwn */ 88a36c61f9SKrishna Gudipati struct bfa_lport_symname_s sym_name; /* vm port symbolic name */ 89ce7242b8SKrishna Gudipati struct bfa_lport_symname_s node_sym_name; /* Node symbolic name */ 90a36c61f9SKrishna Gudipati enum bfa_lport_role roles; /* FCS port roles */ 9160138066SKrishna Gudipati u32 rsvd; 9260138066SKrishna Gudipati bfa_boolean_t preboot_vp; /* vport created from PBC */ 93a36c61f9SKrishna Gudipati u8 tag[16]; /* opaque tag from application */ 9460138066SKrishna Gudipati u8 padding[4]; 95a36c61f9SKrishna Gudipati }; 96a36c61f9SKrishna Gudipati 97acdc79a6SJing Huang /* 98a36c61f9SKrishna Gudipati * FCS port states 99a36c61f9SKrishna Gudipati */ 100a36c61f9SKrishna Gudipati enum bfa_lport_state { 101a36c61f9SKrishna Gudipati BFA_LPORT_UNINIT = 0, /* PORT is not yet initialized */ 102a36c61f9SKrishna Gudipati BFA_LPORT_FDISC = 1, /* FDISC is in progress */ 103a36c61f9SKrishna Gudipati BFA_LPORT_ONLINE = 2, /* login to fabric is complete */ 104a36c61f9SKrishna Gudipati BFA_LPORT_OFFLINE = 3, /* No login to fabric */ 105a36c61f9SKrishna Gudipati }; 106a36c61f9SKrishna Gudipati 107acdc79a6SJing Huang /* 108a36c61f9SKrishna Gudipati * FCS port type. 109a36c61f9SKrishna Gudipati */ 110a36c61f9SKrishna Gudipati enum bfa_lport_type { 111a36c61f9SKrishna Gudipati BFA_LPORT_TYPE_PHYSICAL = 0, 112a36c61f9SKrishna Gudipati BFA_LPORT_TYPE_VIRTUAL, 113a36c61f9SKrishna Gudipati }; 114a36c61f9SKrishna Gudipati 115acdc79a6SJing Huang /* 116a36c61f9SKrishna Gudipati * FCS port offline reason. 117a36c61f9SKrishna Gudipati */ 118a36c61f9SKrishna Gudipati enum bfa_lport_offline_reason { 119a36c61f9SKrishna Gudipati BFA_LPORT_OFFLINE_UNKNOWN = 0, 120a36c61f9SKrishna Gudipati BFA_LPORT_OFFLINE_LINKDOWN, 121a36c61f9SKrishna Gudipati BFA_LPORT_OFFLINE_FAB_UNSUPPORTED, /* NPIV not supported by the 122a36c61f9SKrishna Gudipati * fabric */ 123a36c61f9SKrishna Gudipati BFA_LPORT_OFFLINE_FAB_NORESOURCES, 124a36c61f9SKrishna Gudipati BFA_LPORT_OFFLINE_FAB_LOGOUT, 125a36c61f9SKrishna Gudipati }; 126a36c61f9SKrishna Gudipati 127acdc79a6SJing Huang /* 128a36c61f9SKrishna Gudipati * FCS lport info. 129a36c61f9SKrishna Gudipati */ 130a36c61f9SKrishna Gudipati struct bfa_lport_info_s { 131a36c61f9SKrishna Gudipati u8 port_type; /* bfa_lport_type_t : physical or 132a36c61f9SKrishna Gudipati * virtual */ 133a36c61f9SKrishna Gudipati u8 port_state; /* one of bfa_lport_state values */ 134a36c61f9SKrishna Gudipati u8 offline_reason; /* one of bfa_lport_offline_reason_t 135a36c61f9SKrishna Gudipati * values */ 136a36c61f9SKrishna Gudipati wwn_t port_wwn; 137a36c61f9SKrishna Gudipati wwn_t node_wwn; 138a36c61f9SKrishna Gudipati 139a36c61f9SKrishna Gudipati /* 140a36c61f9SKrishna Gudipati * following 4 feilds are valid for Physical Ports only 141a36c61f9SKrishna Gudipati */ 142a36c61f9SKrishna Gudipati u32 max_vports_supp; /* Max supported vports */ 143a36c61f9SKrishna Gudipati u32 num_vports_inuse; /* Num of in use vports */ 144a36c61f9SKrishna Gudipati u32 max_rports_supp; /* Max supported rports */ 145a36c61f9SKrishna Gudipati u32 num_rports_inuse; /* Num of doscovered rports */ 146a36c61f9SKrishna Gudipati 147a36c61f9SKrishna Gudipati }; 148a36c61f9SKrishna Gudipati 149acdc79a6SJing Huang /* 150a36c61f9SKrishna Gudipati * FCS port statistics 151a36c61f9SKrishna Gudipati */ 152a36c61f9SKrishna Gudipati struct bfa_lport_stats_s { 153a36c61f9SKrishna Gudipati u32 ns_plogi_sent; 154a36c61f9SKrishna Gudipati u32 ns_plogi_rsp_err; 155a36c61f9SKrishna Gudipati u32 ns_plogi_acc_err; 156a36c61f9SKrishna Gudipati u32 ns_plogi_accepts; 157a36c61f9SKrishna Gudipati u32 ns_rejects; /* NS command rejects */ 158a36c61f9SKrishna Gudipati u32 ns_plogi_unknown_rsp; 159a36c61f9SKrishna Gudipati u32 ns_plogi_alloc_wait; 160a36c61f9SKrishna Gudipati 161a36c61f9SKrishna Gudipati u32 ns_retries; /* NS command retries */ 162a36c61f9SKrishna Gudipati u32 ns_timeouts; /* NS command timeouts */ 163a36c61f9SKrishna Gudipati 164a36c61f9SKrishna Gudipati u32 ns_rspnid_sent; 165a36c61f9SKrishna Gudipati u32 ns_rspnid_accepts; 166a36c61f9SKrishna Gudipati u32 ns_rspnid_rsp_err; 167a36c61f9SKrishna Gudipati u32 ns_rspnid_rejects; 168a36c61f9SKrishna Gudipati u32 ns_rspnid_alloc_wait; 169a36c61f9SKrishna Gudipati 170a36c61f9SKrishna Gudipati u32 ns_rftid_sent; 171a36c61f9SKrishna Gudipati u32 ns_rftid_accepts; 172a36c61f9SKrishna Gudipati u32 ns_rftid_rsp_err; 173a36c61f9SKrishna Gudipati u32 ns_rftid_rejects; 174a36c61f9SKrishna Gudipati u32 ns_rftid_alloc_wait; 175a36c61f9SKrishna Gudipati 176a36c61f9SKrishna Gudipati u32 ns_rffid_sent; 177a36c61f9SKrishna Gudipati u32 ns_rffid_accepts; 178a36c61f9SKrishna Gudipati u32 ns_rffid_rsp_err; 179a36c61f9SKrishna Gudipati u32 ns_rffid_rejects; 180a36c61f9SKrishna Gudipati u32 ns_rffid_alloc_wait; 181a36c61f9SKrishna Gudipati 182a36c61f9SKrishna Gudipati u32 ns_gidft_sent; 183a36c61f9SKrishna Gudipati u32 ns_gidft_accepts; 184a36c61f9SKrishna Gudipati u32 ns_gidft_rsp_err; 185a36c61f9SKrishna Gudipati u32 ns_gidft_rejects; 186a36c61f9SKrishna Gudipati u32 ns_gidft_unknown_rsp; 187a36c61f9SKrishna Gudipati u32 ns_gidft_alloc_wait; 188a36c61f9SKrishna Gudipati 189ce7242b8SKrishna Gudipati u32 ns_rnnid_sent; 190ce7242b8SKrishna Gudipati u32 ns_rnnid_accepts; 191ce7242b8SKrishna Gudipati u32 ns_rnnid_rsp_err; 192ce7242b8SKrishna Gudipati u32 ns_rnnid_rejects; 193ce7242b8SKrishna Gudipati u32 ns_rnnid_alloc_wait; 194ce7242b8SKrishna Gudipati 195ce7242b8SKrishna Gudipati u32 ns_rsnn_nn_sent; 196ce7242b8SKrishna Gudipati u32 ns_rsnn_nn_accepts; 197ce7242b8SKrishna Gudipati u32 ns_rsnn_nn_rsp_err; 198ce7242b8SKrishna Gudipati u32 ns_rsnn_nn_rejects; 199ce7242b8SKrishna Gudipati u32 ns_rsnn_nn_alloc_wait; 200ce7242b8SKrishna Gudipati 201a36c61f9SKrishna Gudipati /* 202a36c61f9SKrishna Gudipati * Mgmt Server stats 203a36c61f9SKrishna Gudipati */ 204a36c61f9SKrishna Gudipati u32 ms_retries; /* MS command retries */ 205a36c61f9SKrishna Gudipati u32 ms_timeouts; /* MS command timeouts */ 206a36c61f9SKrishna Gudipati u32 ms_plogi_sent; 207a36c61f9SKrishna Gudipati u32 ms_plogi_rsp_err; 208a36c61f9SKrishna Gudipati u32 ms_plogi_acc_err; 209a36c61f9SKrishna Gudipati u32 ms_plogi_accepts; 210a36c61f9SKrishna Gudipati u32 ms_rejects; /* MS command rejects */ 211a36c61f9SKrishna Gudipati u32 ms_plogi_unknown_rsp; 212a36c61f9SKrishna Gudipati u32 ms_plogi_alloc_wait; 213a36c61f9SKrishna Gudipati 214a36c61f9SKrishna Gudipati u32 num_rscn; /* Num of RSCN received */ 215a36c61f9SKrishna Gudipati u32 num_portid_rscn;/* Num portid format RSCN 216a36c61f9SKrishna Gudipati * received */ 217a36c61f9SKrishna Gudipati 218a36c61f9SKrishna Gudipati u32 uf_recvs; /* Unsolicited recv frames */ 219a36c61f9SKrishna Gudipati u32 uf_recv_drops; /* Dropped received frames */ 220a36c61f9SKrishna Gudipati 221a36c61f9SKrishna Gudipati u32 plogi_rcvd; /* Received plogi */ 222a36c61f9SKrishna Gudipati u32 prli_rcvd; /* Received prli */ 223a36c61f9SKrishna Gudipati u32 adisc_rcvd; /* Received adisc */ 224a36c61f9SKrishna Gudipati u32 prlo_rcvd; /* Received prlo */ 225a36c61f9SKrishna Gudipati u32 logo_rcvd; /* Received logo */ 226a36c61f9SKrishna Gudipati u32 rpsc_rcvd; /* Received rpsc */ 227a36c61f9SKrishna Gudipati u32 un_handled_els_rcvd; /* Received unhandled ELS */ 228a36c61f9SKrishna Gudipati u32 rport_plogi_timeouts; /* Rport plogi retry timeout count */ 229a36c61f9SKrishna Gudipati u32 rport_del_max_plogi_retry; /* Deleted rport 230a36c61f9SKrishna Gudipati * (max retry of plogi) */ 231a36c61f9SKrishna Gudipati }; 232a36c61f9SKrishna Gudipati 233acdc79a6SJing Huang /* 234a36c61f9SKrishna Gudipati * BFA port attribute returned in queries 235a36c61f9SKrishna Gudipati */ 236a36c61f9SKrishna Gudipati struct bfa_lport_attr_s { 237a36c61f9SKrishna Gudipati enum bfa_lport_state state; /* port state */ 238a36c61f9SKrishna Gudipati u32 pid; /* port ID */ 239a36c61f9SKrishna Gudipati struct bfa_lport_cfg_s port_cfg; /* port configuration */ 240a36c61f9SKrishna Gudipati enum bfa_port_type port_type; /* current topology */ 241a36c61f9SKrishna Gudipati u32 loopback; /* cable is externally looped back */ 242a36c61f9SKrishna Gudipati wwn_t fabric_name; /* attached switch's nwwn */ 243a36c61f9SKrishna Gudipati u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /* attached 244a36c61f9SKrishna Gudipati * fabric's ip addr */ 245a36c61f9SKrishna Gudipati mac_t fpma_mac; /* Lport's FPMA Mac address */ 246a36c61f9SKrishna Gudipati u16 authfail; /* auth failed state */ 247a36c61f9SKrishna Gudipati }; 248a36c61f9SKrishna Gudipati 249a36c61f9SKrishna Gudipati 250acdc79a6SJing Huang /* 251a36c61f9SKrishna Gudipati * VPORT states 252a36c61f9SKrishna Gudipati */ 253a36c61f9SKrishna Gudipati enum bfa_vport_state { 254a36c61f9SKrishna Gudipati BFA_FCS_VPORT_UNINIT = 0, 255a36c61f9SKrishna Gudipati BFA_FCS_VPORT_CREATED = 1, 256a36c61f9SKrishna Gudipati BFA_FCS_VPORT_OFFLINE = 1, 257a36c61f9SKrishna Gudipati BFA_FCS_VPORT_FDISC_SEND = 2, 258a36c61f9SKrishna Gudipati BFA_FCS_VPORT_FDISC = 3, 259a36c61f9SKrishna Gudipati BFA_FCS_VPORT_FDISC_RETRY = 4, 260d7be54ccSKrishna Gudipati BFA_FCS_VPORT_FDISC_RSP_WAIT = 5, 261d7be54ccSKrishna Gudipati BFA_FCS_VPORT_ONLINE = 6, 262d7be54ccSKrishna Gudipati BFA_FCS_VPORT_DELETING = 7, 263d7be54ccSKrishna Gudipati BFA_FCS_VPORT_CLEANUP = 8, 264d7be54ccSKrishna Gudipati BFA_FCS_VPORT_LOGO_SEND = 9, 265d7be54ccSKrishna Gudipati BFA_FCS_VPORT_LOGO = 10, 266d7be54ccSKrishna Gudipati BFA_FCS_VPORT_ERROR = 11, 267a36c61f9SKrishna Gudipati BFA_FCS_VPORT_MAX_STATE, 268a36c61f9SKrishna Gudipati }; 269a36c61f9SKrishna Gudipati 270acdc79a6SJing Huang /* 271a36c61f9SKrishna Gudipati * vport statistics 272a36c61f9SKrishna Gudipati */ 273a36c61f9SKrishna Gudipati struct bfa_vport_stats_s { 274a36c61f9SKrishna Gudipati struct bfa_lport_stats_s port_stats; /* base class (port) stats */ 275a36c61f9SKrishna Gudipati /* 276a36c61f9SKrishna Gudipati * TODO - remove 277a36c61f9SKrishna Gudipati */ 278a36c61f9SKrishna Gudipati 279a36c61f9SKrishna Gudipati u32 fdisc_sent; /* num fdisc sent */ 280a36c61f9SKrishna Gudipati u32 fdisc_accepts; /* fdisc accepts */ 281a36c61f9SKrishna Gudipati u32 fdisc_retries; /* fdisc retries */ 282a36c61f9SKrishna Gudipati u32 fdisc_timeouts; /* fdisc timeouts */ 283a36c61f9SKrishna Gudipati u32 fdisc_rsp_err; /* fdisc response error */ 284a36c61f9SKrishna Gudipati u32 fdisc_acc_bad; /* bad fdisc accepts */ 285a36c61f9SKrishna Gudipati u32 fdisc_rejects; /* fdisc rejects */ 286a36c61f9SKrishna Gudipati u32 fdisc_unknown_rsp; 287a36c61f9SKrishna Gudipati /* 288a36c61f9SKrishna Gudipati *!< fdisc rsp unknown error 289a36c61f9SKrishna Gudipati */ 290a36c61f9SKrishna Gudipati u32 fdisc_alloc_wait;/* fdisc req (fcxp)alloc wait */ 291a36c61f9SKrishna Gudipati 292a36c61f9SKrishna Gudipati u32 logo_alloc_wait;/* logo req (fcxp) alloc wait */ 293a36c61f9SKrishna Gudipati u32 logo_sent; /* logo sent */ 294a36c61f9SKrishna Gudipati u32 logo_accepts; /* logo accepts */ 295a36c61f9SKrishna Gudipati u32 logo_rejects; /* logo rejects */ 296a36c61f9SKrishna Gudipati u32 logo_rsp_err; /* logo rsp errors */ 297a36c61f9SKrishna Gudipati u32 logo_unknown_rsp; 298a36c61f9SKrishna Gudipati /* logo rsp unknown errors */ 299a36c61f9SKrishna Gudipati 300a36c61f9SKrishna Gudipati u32 fab_no_npiv; /* fabric does not support npiv */ 301a36c61f9SKrishna Gudipati 302a36c61f9SKrishna Gudipati u32 fab_offline; /* offline events from fab SM */ 303a36c61f9SKrishna Gudipati u32 fab_online; /* online events from fab SM */ 304a36c61f9SKrishna Gudipati u32 fab_cleanup; /* cleanup request from fab SM */ 305a36c61f9SKrishna Gudipati u32 rsvd; 306a36c61f9SKrishna Gudipati }; 307a36c61f9SKrishna Gudipati 308acdc79a6SJing Huang /* 309a36c61f9SKrishna Gudipati * BFA vport attribute returned in queries 310a36c61f9SKrishna Gudipati */ 311a36c61f9SKrishna Gudipati struct bfa_vport_attr_s { 312a36c61f9SKrishna Gudipati struct bfa_lport_attr_s port_attr; /* base class (port) attributes */ 313a36c61f9SKrishna Gudipati enum bfa_vport_state vport_state; /* vport state */ 314a36c61f9SKrishna Gudipati u32 rsvd; 315a36c61f9SKrishna Gudipati }; 316a36c61f9SKrishna Gudipati 317acdc79a6SJing Huang /* 318a36c61f9SKrishna Gudipati * FCS remote port states 319a36c61f9SKrishna Gudipati */ 320a36c61f9SKrishna Gudipati enum bfa_rport_state { 321a36c61f9SKrishna Gudipati BFA_RPORT_UNINIT = 0, /* PORT is not yet initialized */ 322a36c61f9SKrishna Gudipati BFA_RPORT_OFFLINE = 1, /* rport is offline */ 323a36c61f9SKrishna Gudipati BFA_RPORT_PLOGI = 2, /* PLOGI to rport is in progress */ 324a36c61f9SKrishna Gudipati BFA_RPORT_ONLINE = 3, /* login to rport is complete */ 325a36c61f9SKrishna Gudipati BFA_RPORT_PLOGI_RETRY = 4, /* retrying login to rport */ 326a36c61f9SKrishna Gudipati BFA_RPORT_NSQUERY = 5, /* nameserver query */ 327a36c61f9SKrishna Gudipati BFA_RPORT_ADISC = 6, /* ADISC authentication */ 328a36c61f9SKrishna Gudipati BFA_RPORT_LOGO = 7, /* logging out with rport */ 329a36c61f9SKrishna Gudipati BFA_RPORT_LOGORCV = 8, /* handling LOGO from rport */ 330a36c61f9SKrishna Gudipati BFA_RPORT_NSDISC = 9, /* re-discover rport */ 331a36c61f9SKrishna Gudipati }; 332a36c61f9SKrishna Gudipati 333acdc79a6SJing Huang /* 334a36c61f9SKrishna Gudipati * Rport Scsi Function : Initiator/Target. 335a36c61f9SKrishna Gudipati */ 336a36c61f9SKrishna Gudipati enum bfa_rport_function { 337a36c61f9SKrishna Gudipati BFA_RPORT_INITIATOR = 0x01, /* SCSI Initiator */ 338a36c61f9SKrishna Gudipati BFA_RPORT_TARGET = 0x02, /* SCSI Target */ 339a36c61f9SKrishna Gudipati }; 340a36c61f9SKrishna Gudipati 341acdc79a6SJing Huang /* 342a36c61f9SKrishna Gudipati * port/node symbolic names for rport 343a36c61f9SKrishna Gudipati */ 344a36c61f9SKrishna Gudipati #define BFA_RPORT_SYMNAME_MAXLEN 255 345a36c61f9SKrishna Gudipati struct bfa_rport_symname_s { 346a36c61f9SKrishna Gudipati char symname[BFA_RPORT_SYMNAME_MAXLEN]; 347a36c61f9SKrishna Gudipati }; 348a36c61f9SKrishna Gudipati 349acdc79a6SJing Huang /* 350a36c61f9SKrishna Gudipati * FCS remote port statistics 351a36c61f9SKrishna Gudipati */ 352a36c61f9SKrishna Gudipati struct bfa_rport_stats_s { 353a36c61f9SKrishna Gudipati u32 offlines; /* remote port offline count */ 354a36c61f9SKrishna Gudipati u32 onlines; /* remote port online count */ 355a36c61f9SKrishna Gudipati u32 rscns; /* RSCN affecting rport */ 356a36c61f9SKrishna Gudipati u32 plogis; /* plogis sent */ 357a36c61f9SKrishna Gudipati u32 plogi_accs; /* plogi accepts */ 358a36c61f9SKrishna Gudipati u32 plogi_timeouts; /* plogi timeouts */ 359a36c61f9SKrishna Gudipati u32 plogi_rejects; /* rcvd plogi rejects */ 360a36c61f9SKrishna Gudipati u32 plogi_failed; /* local failure */ 361a36c61f9SKrishna Gudipati u32 plogi_rcvd; /* plogis rcvd */ 362a36c61f9SKrishna Gudipati u32 prli_rcvd; /* inbound PRLIs */ 363a36c61f9SKrishna Gudipati u32 adisc_rcvd; /* ADISCs received */ 364a36c61f9SKrishna Gudipati u32 adisc_rejects; /* recvd ADISC rejects */ 365a36c61f9SKrishna Gudipati u32 adisc_sent; /* ADISC requests sent */ 366a36c61f9SKrishna Gudipati u32 adisc_accs; /* ADISC accepted by rport */ 367a36c61f9SKrishna Gudipati u32 adisc_failed; /* ADISC failed (no response) */ 368a36c61f9SKrishna Gudipati u32 adisc_rejected; /* ADISC rejected by us */ 369a36c61f9SKrishna Gudipati u32 logos; /* logos sent */ 370a36c61f9SKrishna Gudipati u32 logo_accs; /* LOGO accepts from rport */ 371a36c61f9SKrishna Gudipati u32 logo_failed; /* LOGO failures */ 372a36c61f9SKrishna Gudipati u32 logo_rejected; /* LOGO rejects from rport */ 373a36c61f9SKrishna Gudipati u32 logo_rcvd; /* LOGO from remote port */ 374a36c61f9SKrishna Gudipati 375a36c61f9SKrishna Gudipati u32 rpsc_rcvd; /* RPSC received */ 376a36c61f9SKrishna Gudipati u32 rpsc_rejects; /* recvd RPSC rejects */ 377a36c61f9SKrishna Gudipati u32 rpsc_sent; /* RPSC requests sent */ 378a36c61f9SKrishna Gudipati u32 rpsc_accs; /* RPSC accepted by rport */ 379a36c61f9SKrishna Gudipati u32 rpsc_failed; /* RPSC failed (no response) */ 380a36c61f9SKrishna Gudipati u32 rpsc_rejected; /* RPSC rejected by us */ 381a36c61f9SKrishna Gudipati 382a36c61f9SKrishna Gudipati u32 rjt_insuff_res; /* LS RJT with insuff resources */ 383a36c61f9SKrishna Gudipati struct bfa_rport_hal_stats_s hal_stats; /* BFA rport stats */ 384a36c61f9SKrishna Gudipati }; 385a36c61f9SKrishna Gudipati 386acdc79a6SJing Huang /* 387a36c61f9SKrishna Gudipati * FCS remote port attributes returned in queries 388a36c61f9SKrishna Gudipati */ 389a36c61f9SKrishna Gudipati struct bfa_rport_attr_s { 390a36c61f9SKrishna Gudipati wwn_t nwwn; /* node wwn */ 391a36c61f9SKrishna Gudipati wwn_t pwwn; /* port wwn */ 392a36c61f9SKrishna Gudipati enum fc_cos cos_supported; /* supported class of services */ 393a36c61f9SKrishna Gudipati u32 pid; /* port ID */ 394a36c61f9SKrishna Gudipati u32 df_sz; /* Max payload size */ 395a36c61f9SKrishna Gudipati enum bfa_rport_state state; /* Rport State machine state */ 396a36c61f9SKrishna Gudipati enum fc_cos fc_cos; /* FC classes of services */ 397a36c61f9SKrishna Gudipati bfa_boolean_t cisc; /* CISC capable device */ 398a36c61f9SKrishna Gudipati struct bfa_rport_symname_s symname; /* Symbolic Name */ 399a36c61f9SKrishna Gudipati enum bfa_rport_function scsi_function; /* Initiator/Target */ 400a36c61f9SKrishna Gudipati struct bfa_rport_qos_attr_s qos_attr; /* qos attributes */ 401a36c61f9SKrishna Gudipati enum bfa_port_speed curr_speed; /* operating speed got from 402a36c61f9SKrishna Gudipati * RPSC ELS. UNKNOWN, if RPSC 403a36c61f9SKrishna Gudipati * is not supported */ 404a36c61f9SKrishna Gudipati bfa_boolean_t trl_enforced; /* TRL enforced ? TRUE/FALSE */ 405a36c61f9SKrishna Gudipati enum bfa_port_speed assigned_speed; /* Speed assigned by the user. 406a36c61f9SKrishna Gudipati * will be used if RPSC is not 407a36c61f9SKrishna Gudipati * supported by the rport */ 408a36c61f9SKrishna Gudipati }; 409a36c61f9SKrishna Gudipati 410a36c61f9SKrishna Gudipati struct bfa_rport_remote_link_stats_s { 411a36c61f9SKrishna Gudipati u32 lfc; /* Link Failure Count */ 412a36c61f9SKrishna Gudipati u32 lsyc; /* Loss of Synchronization Count */ 413a36c61f9SKrishna Gudipati u32 lsic; /* Loss of Signal Count */ 414a36c61f9SKrishna Gudipati u32 pspec; /* Primitive Sequence Protocol Error Count */ 415a36c61f9SKrishna Gudipati u32 itwc; /* Invalid Transmission Word Count */ 416a36c61f9SKrishna Gudipati u32 icc; /* Invalid CRC Count */ 417a36c61f9SKrishna Gudipati }; 418a36c61f9SKrishna Gudipati 419ee1a4a42SKrishna Gudipati struct bfa_rport_qualifier_s { 420ee1a4a42SKrishna Gudipati wwn_t pwwn; /* Port WWN */ 421ee1a4a42SKrishna Gudipati u32 pid; /* port ID */ 422ee1a4a42SKrishna Gudipati u32 rsvd; 423ee1a4a42SKrishna Gudipati }; 424a36c61f9SKrishna Gudipati 425a36c61f9SKrishna Gudipati #define BFA_MAX_IO_INDEX 7 426a36c61f9SKrishna Gudipati #define BFA_NO_IO_INDEX 9 427a36c61f9SKrishna Gudipati 428acdc79a6SJing Huang /* 429a36c61f9SKrishna Gudipati * FCS itnim states 430a36c61f9SKrishna Gudipati */ 431a36c61f9SKrishna Gudipati enum bfa_itnim_state { 432a36c61f9SKrishna Gudipati BFA_ITNIM_OFFLINE = 0, /* offline */ 433a36c61f9SKrishna Gudipati BFA_ITNIM_PRLI_SEND = 1, /* prli send */ 434a36c61f9SKrishna Gudipati BFA_ITNIM_PRLI_SENT = 2, /* prli sent */ 435a36c61f9SKrishna Gudipati BFA_ITNIM_PRLI_RETRY = 3, /* prli retry */ 436a36c61f9SKrishna Gudipati BFA_ITNIM_HCB_ONLINE = 4, /* online callback */ 437a36c61f9SKrishna Gudipati BFA_ITNIM_ONLINE = 5, /* online */ 438a36c61f9SKrishna Gudipati BFA_ITNIM_HCB_OFFLINE = 6, /* offline callback */ 439a36c61f9SKrishna Gudipati BFA_ITNIM_INITIATIOR = 7, /* initiator */ 440a36c61f9SKrishna Gudipati }; 441a36c61f9SKrishna Gudipati 442acdc79a6SJing Huang /* 443a36c61f9SKrishna Gudipati * FCS remote port statistics 444a36c61f9SKrishna Gudipati */ 445a36c61f9SKrishna Gudipati struct bfa_itnim_stats_s { 446a36c61f9SKrishna Gudipati u32 onlines; /* num rport online */ 447a36c61f9SKrishna Gudipati u32 offlines; /* num rport offline */ 448a36c61f9SKrishna Gudipati u32 prli_sent; /* num prli sent out */ 449a36c61f9SKrishna Gudipati u32 fcxp_alloc_wait;/* num fcxp alloc waits */ 450a36c61f9SKrishna Gudipati u32 prli_rsp_err; /* num prli rsp errors */ 451a36c61f9SKrishna Gudipati u32 prli_rsp_acc; /* num prli rsp accepts */ 452a36c61f9SKrishna Gudipati u32 initiator; /* rport is an initiator */ 453a36c61f9SKrishna Gudipati u32 prli_rsp_parse_err; /* prli rsp parsing errors */ 454a36c61f9SKrishna Gudipati u32 prli_rsp_rjt; /* num prli rsp rejects */ 455a36c61f9SKrishna Gudipati u32 timeout; /* num timeouts detected */ 456a36c61f9SKrishna Gudipati u32 sler; /* num sler notification from BFA */ 457a36c61f9SKrishna Gudipati u32 rsvd; /* padding for 64 bit alignment */ 458a36c61f9SKrishna Gudipati }; 459a36c61f9SKrishna Gudipati 460acdc79a6SJing Huang /* 461a36c61f9SKrishna Gudipati * FCS itnim attributes returned in queries 462a36c61f9SKrishna Gudipati */ 463a36c61f9SKrishna Gudipati struct bfa_itnim_attr_s { 464a36c61f9SKrishna Gudipati enum bfa_itnim_state state; /* FCS itnim state */ 465a36c61f9SKrishna Gudipati u8 retry; /* data retransmision support */ 466a36c61f9SKrishna Gudipati u8 task_retry_id; /* task retry ident support */ 467a36c61f9SKrishna Gudipati u8 rec_support; /* REC supported */ 468a36c61f9SKrishna Gudipati u8 conf_comp; /* confirmed completion supp */ 469a36c61f9SKrishna Gudipati }; 470a36c61f9SKrishna Gudipati 471a36c61f9SKrishna Gudipati #endif /* __BFA_DEFS_FCS_H__ */ 472