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