0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include <scsi/scsi_host.h>
0025 #include <linux/hashtable.h>
0026 #include <linux/ktime.h>
0027 #include <linux/workqueue.h>
0028
0029 #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS)
0030 #define CONFIG_SCSI_LPFC_DEBUG_FS
0031 #endif
0032
0033 struct lpfc_sli2_slim;
0034
0035 #define ELX_MODEL_NAME_SIZE 80
0036
0037 #define LPFC_PCI_DEV_LP 0x1
0038 #define LPFC_PCI_DEV_OC 0x2
0039
0040 #define LPFC_SLI_REV2 2
0041 #define LPFC_SLI_REV3 3
0042 #define LPFC_SLI_REV4 4
0043
0044 #define LPFC_MAX_TARGET 4096
0045 #define LPFC_MAX_DISC_THREADS 64
0046
0047 #define LPFC_MAX_NS_RETRY 3
0048
0049 #define LPFC_CMD_PER_LUN 3
0050 #define LPFC_DEFAULT_SG_SEG_CNT 64
0051
0052 #define LPFC_DEFAULT_XPSGL_SIZE 256
0053 #define LPFC_MAX_SG_TABLESIZE 0xffff
0054 #define LPFC_MIN_SG_SLI4_BUF_SZ 0x800
0055 #define LPFC_MAX_BG_SLI4_SEG_CNT_DIF 128
0056 #define LPFC_MAX_SG_SEG_CNT_DIF 512
0057 #define LPFC_MAX_SG_SEG_CNT 4096
0058 #define LPFC_MIN_SG_SEG_CNT 32
0059 #define LPFC_MAX_SGL_SEG_CNT 512
0060 #define LPFC_MAX_BPL_SEG_CNT 4096
0061 #define LPFC_MAX_NVME_SEG_CNT 256
0062
0063 #define LPFC_MAX_SGE_SIZE 0x80000000
0064 #define LPFC_IOCB_LIST_CNT 2250
0065 #define LPFC_Q_RAMP_UP_INTERVAL 120
0066 #define LPFC_VNAME_LEN 100
0067 #define LPFC_TGTQ_RAMPUP_PCENT 5
0068 #define LPFC_MIN_TGT_QDEPTH 10
0069 #define LPFC_MAX_TGT_QDEPTH 0xFFFF
0070
0071 #define LPFC_MAX_BUCKET_COUNT 20
0072
0073
0074
0075
0076
0077
0078
0079 #define QUEUE_RAMP_DOWN_INTERVAL (msecs_to_jiffies(1000 * 1))
0080
0081
0082 #define LPFC_DISC_IOCB_BUFF_COUNT 20
0083
0084 #define LPFC_HB_MBOX_INTERVAL 5
0085 #define LPFC_HB_MBOX_TIMEOUT 30
0086
0087
0088 #define LPFC_ERATT_POLL_INTERVAL 5
0089
0090
0091 #define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr)))
0092 #define putPaddrHigh(addr) ((uint32_t) (0xffffffff & (((u64)(addr))>>32)))
0093 #define getPaddr(high, low) ((dma_addr_t)( \
0094 (( (u64)(high)<<16 ) << 16)|( (u64)(low))))
0095
0096 #define LPFC_DRVR_TIMEOUT 16
0097 #define FC_MAX_ADPTMSG 64
0098
0099 #define MAX_HBAEVT 32
0100 #define MAX_HBAS_NO_RESET 16
0101
0102
0103 #define LPFC_MSIX_VECTORS 2
0104
0105
0106 #define LPFC_DATA_READY 0
0107
0108
0109 #define LPFC_LBUF_SZ 128
0110
0111
0112 #define LPFC_MBX_NO_WAIT 0
0113 #define LPFC_MBX_WAIT 1
0114
0115 #define LPFC_CFG_PARAM_MAGIC_NUM 0xFEAA0005
0116 #define LPFC_PORT_CFG_NAME "/cfg/port.cfg"
0117
0118 #define lpfc_rangecheck(val, min, max) \
0119 ((uint)(val) >= (uint)(min) && (val) <= (max))
0120
0121 enum lpfc_polling_flags {
0122 ENABLE_FCP_RING_POLLING = 0x1,
0123 DISABLE_FCP_RING_INT = 0x2
0124 };
0125
0126 struct perf_prof {
0127 uint16_t cmd_cpu[40];
0128 uint16_t rsp_cpu[40];
0129 uint16_t qh_cpu[40];
0130 uint16_t wqidx[40];
0131 };
0132
0133
0134
0135
0136
0137
0138 #define LPFC_FC4_TYPE_BITMASK 0x00000100
0139
0140
0141 struct lpfc_dmabuf {
0142 struct list_head list;
0143 void *virt;
0144 dma_addr_t phys;
0145 uint32_t buffer_tag;
0146 };
0147
0148 struct lpfc_nvmet_ctxbuf {
0149 struct list_head list;
0150 struct lpfc_async_xchg_ctx *context;
0151 struct lpfc_iocbq *iocbq;
0152 struct lpfc_sglq *sglq;
0153 struct work_struct defer_work;
0154 };
0155
0156 struct lpfc_dma_pool {
0157 struct lpfc_dmabuf *elements;
0158 uint32_t max_count;
0159 uint32_t current_count;
0160 };
0161
0162 struct hbq_dmabuf {
0163 struct lpfc_dmabuf hbuf;
0164 struct lpfc_dmabuf dbuf;
0165 uint16_t total_size;
0166 uint16_t bytes_recv;
0167 uint32_t tag;
0168 struct lpfc_cq_event cq_event;
0169 unsigned long time_stamp;
0170 void *context;
0171 };
0172
0173 struct rqb_dmabuf {
0174 struct lpfc_dmabuf hbuf;
0175 struct lpfc_dmabuf dbuf;
0176 uint16_t total_size;
0177 uint16_t bytes_recv;
0178 uint16_t idx;
0179 struct lpfc_queue *hrq;
0180 struct lpfc_queue *drq;
0181 };
0182
0183
0184 #define MEM_PRI 0x100
0185
0186
0187
0188
0189
0190 typedef struct lpfc_vpd {
0191 uint32_t status;
0192 uint32_t length;
0193 struct {
0194 uint32_t rsvd1;
0195 uint32_t biuRev;
0196 uint32_t smRev;
0197 uint32_t smFwRev;
0198 uint32_t endecRev;
0199 uint16_t rBit;
0200 uint8_t fcphHigh;
0201 uint8_t fcphLow;
0202 uint8_t feaLevelHigh;
0203 uint8_t feaLevelLow;
0204 uint32_t postKernRev;
0205 uint32_t opFwRev;
0206 uint8_t opFwName[16];
0207 uint32_t sli1FwRev;
0208 uint8_t sli1FwName[16];
0209 uint32_t sli2FwRev;
0210 uint8_t sli2FwName[16];
0211 } rev;
0212 struct {
0213 #ifdef __BIG_ENDIAN_BITFIELD
0214 uint32_t rsvd3 :20;
0215 uint32_t rsvd2 : 3;
0216 uint32_t cbg : 1;
0217 uint32_t cmv : 1;
0218 uint32_t ccrp : 1;
0219 uint32_t csah : 1;
0220 uint32_t chbs : 1;
0221 uint32_t cinb : 1;
0222 uint32_t cerbm : 1;
0223 uint32_t cmx : 1;
0224 uint32_t cmr : 1;
0225 #else
0226 uint32_t cmr : 1;
0227 uint32_t cmx : 1;
0228 uint32_t cerbm : 1;
0229 uint32_t cinb : 1;
0230 uint32_t chbs : 1;
0231 uint32_t csah : 1;
0232 uint32_t ccrp : 1;
0233 uint32_t cmv : 1;
0234 uint32_t cbg : 1;
0235 uint32_t rsvd2 : 3;
0236 uint32_t rsvd3 :20;
0237 #endif
0238 } sli3Feat;
0239 } lpfc_vpd_t;
0240
0241
0242
0243
0244
0245 struct lpfc_stats {
0246
0247 uint32_t elsLogiCol;
0248 uint32_t elsRetryExceeded;
0249 uint32_t elsXmitRetry;
0250 uint32_t elsDelayRetry;
0251 uint32_t elsRcvDrop;
0252 uint32_t elsRcvFrame;
0253 uint32_t elsRcvRSCN;
0254 uint32_t elsRcvRNID;
0255 uint32_t elsRcvFARP;
0256 uint32_t elsRcvFARPR;
0257 uint32_t elsRcvFLOGI;
0258 uint32_t elsRcvPLOGI;
0259 uint32_t elsRcvADISC;
0260 uint32_t elsRcvPDISC;
0261 uint32_t elsRcvFAN;
0262 uint32_t elsRcvLOGO;
0263 uint32_t elsRcvPRLO;
0264 uint32_t elsRcvPRLI;
0265 uint32_t elsRcvLIRR;
0266 uint32_t elsRcvRLS;
0267 uint32_t elsRcvRPL;
0268 uint32_t elsRcvRRQ;
0269 uint32_t elsRcvRTV;
0270 uint32_t elsRcvECHO;
0271 uint32_t elsRcvLCB;
0272 uint32_t elsRcvRDP;
0273 uint32_t elsRcvRDF;
0274 uint32_t elsXmitFLOGI;
0275 uint32_t elsXmitFDISC;
0276 uint32_t elsXmitPLOGI;
0277 uint32_t elsXmitPRLI;
0278 uint32_t elsXmitADISC;
0279 uint32_t elsXmitLOGO;
0280 uint32_t elsXmitSCR;
0281 uint32_t elsXmitRSCN;
0282 uint32_t elsXmitRNID;
0283 uint32_t elsXmitFARP;
0284 uint32_t elsXmitFARPR;
0285 uint32_t elsXmitACC;
0286 uint32_t elsXmitLSRJT;
0287
0288 uint32_t frameRcvBcast;
0289 uint32_t frameRcvMulti;
0290 uint32_t strayXmitCmpl;
0291 uint32_t frameXmitDelay;
0292 uint32_t xriCmdCmpl;
0293 uint32_t xriStatErr;
0294 uint32_t LinkUp;
0295 uint32_t LinkDown;
0296 uint32_t LinkMultiEvent;
0297 uint32_t NoRcvBuf;
0298 uint32_t fcpCmd;
0299 uint32_t fcpCmpl;
0300 uint32_t fcpRspErr;
0301 uint32_t fcpRemoteStop;
0302 uint32_t fcpPortRjt;
0303 uint32_t fcpPortBusy;
0304 uint32_t fcpError;
0305 uint32_t fcpLocalErr;
0306 };
0307
0308 struct lpfc_hba;
0309
0310
0311 #define LPFC_VMID_TIMER 300
0312
0313 #define LPFC_MAX_VMID_SIZE 256
0314 #define LPFC_COMPRESS_VMID_SIZE 16
0315
0316 union lpfc_vmid_io_tag {
0317 u32 app_id;
0318 u8 cs_ctl_vmid;
0319 };
0320
0321 #define JIFFIES_PER_HR (HZ * 60 * 60)
0322
0323 struct lpfc_vmid {
0324 u8 flag;
0325 #define LPFC_VMID_SLOT_FREE 0x0
0326 #define LPFC_VMID_SLOT_USED 0x1
0327 #define LPFC_VMID_REQ_REGISTER 0x2
0328 #define LPFC_VMID_REGISTERED 0x4
0329 #define LPFC_VMID_DE_REGISTER 0x8
0330 char host_vmid[LPFC_MAX_VMID_SIZE];
0331 union lpfc_vmid_io_tag un;
0332 struct hlist_node hnode;
0333 u64 io_rd_cnt;
0334 u64 io_wr_cnt;
0335 u8 vmid_len;
0336 u8 delete_inactive;
0337 u32 hash_index;
0338 u64 __percpu *last_io_time;
0339 };
0340
0341 #define lpfc_vmid_is_type_priority_tag(vport)\
0342 (vport->vmid_priority_tagging ? 1 : 0)
0343
0344 #define LPFC_VMID_HASH_SIZE 256
0345 #define LPFC_VMID_HASH_MASK 255
0346 #define LPFC_VMID_HASH_SHIFT 6
0347
0348 struct lpfc_vmid_context {
0349 struct lpfc_vmid *vmp;
0350 struct lpfc_nodelist *nlp;
0351 bool instantiated;
0352 };
0353
0354 struct lpfc_vmid_priority_range {
0355 u8 low;
0356 u8 high;
0357 u8 qos;
0358 };
0359
0360 struct lpfc_vmid_priority_info {
0361 u32 num_descriptors;
0362 struct lpfc_vmid_priority_range *vmid_range;
0363 };
0364
0365 #define QFPA_EVEN_ONLY 0x01
0366 #define QFPA_ODD_ONLY 0x02
0367 #define QFPA_EVEN_ODD 0x03
0368
0369 enum discovery_state {
0370 LPFC_VPORT_UNKNOWN = 0,
0371 LPFC_VPORT_FAILED = 1,
0372 LPFC_LOCAL_CFG_LINK = 6,
0373 LPFC_FLOGI = 7,
0374 LPFC_FDISC = 8,
0375 LPFC_FABRIC_CFG_LINK = 9,
0376
0377 LPFC_NS_REG = 10,
0378 LPFC_NS_QRY = 11,
0379 LPFC_BUILD_DISC_LIST = 12,
0380
0381 LPFC_DISC_AUTH = 13,
0382 LPFC_VPORT_READY = 32,
0383 };
0384
0385 enum hba_state {
0386 LPFC_LINK_UNKNOWN = 0,
0387 LPFC_WARM_START = 1,
0388 LPFC_INIT_START = 2,
0389 LPFC_INIT_MBX_CMDS = 3,
0390 LPFC_LINK_DOWN = 4,
0391 LPFC_LINK_UP = 5,
0392 LPFC_CLEAR_LA = 6,
0393
0394 LPFC_HBA_READY = 32,
0395 LPFC_HBA_ERROR = -1
0396 };
0397
0398 struct lpfc_trunk_link_state {
0399 enum hba_state state;
0400 uint8_t fault;
0401 };
0402
0403 struct lpfc_trunk_link {
0404 struct lpfc_trunk_link_state link0,
0405 link1,
0406 link2,
0407 link3;
0408 };
0409
0410
0411 struct lpfc_cgn_param {
0412 uint32_t cgn_param_magic;
0413 uint8_t cgn_param_version;
0414 uint8_t cgn_param_mode;
0415 #define LPFC_CFG_OFF 0
0416 #define LPFC_CFG_MANAGED 1
0417 #define LPFC_CFG_MONITOR 2
0418 uint8_t cgn_rsvd1;
0419 uint8_t cgn_rsvd2;
0420 uint8_t cgn_param_level0;
0421 uint8_t cgn_param_level1;
0422 uint8_t cgn_param_level2;
0423 uint8_t byte11;
0424 uint8_t byte12;
0425 uint8_t byte13;
0426 uint8_t byte14;
0427 uint8_t byte15;
0428 };
0429
0430
0431 #define LPFC_MAX_CGN_DAYS 10
0432
0433
0434
0435
0436
0437
0438
0439 struct lpfc_cgn_info {
0440
0441 __le16 cgn_info_size;
0442 uint8_t cgn_info_version;
0443 #define LPFC_CGN_INFO_V1 1
0444 #define LPFC_CGN_INFO_V2 2
0445 #define LPFC_CGN_INFO_V3 3
0446 uint8_t cgn_info_mode;
0447 uint8_t cgn_info_detect;
0448 uint8_t cgn_info_action;
0449 uint8_t cgn_info_level0;
0450 uint8_t cgn_info_level1;
0451 uint8_t cgn_info_level2;
0452
0453
0454 uint8_t cgn_info_month;
0455 uint8_t cgn_info_day;
0456 uint8_t cgn_info_year;
0457 uint8_t cgn_info_hour;
0458 uint8_t cgn_info_minute;
0459 uint8_t cgn_info_second;
0460
0461
0462 uint8_t cgn_index_minute;
0463 uint8_t cgn_index_hour;
0464 uint8_t cgn_index_day;
0465
0466 __le16 cgn_warn_freq;
0467 __le16 cgn_alarm_freq;
0468 __le16 cgn_lunq;
0469 uint8_t cgn_pad1[8];
0470
0471
0472 __le16 cgn_drvr_min[60];
0473 __le32 cgn_drvr_hr[24];
0474 __le32 cgn_drvr_day[LPFC_MAX_CGN_DAYS];
0475
0476
0477 __le16 cgn_warn_min[60];
0478 __le32 cgn_warn_hr[24];
0479 __le32 cgn_warn_day[LPFC_MAX_CGN_DAYS];
0480
0481
0482 __le32 cgn_latency_min[60];
0483 __le32 cgn_latency_hr[24];
0484 __le32 cgn_latency_day[LPFC_MAX_CGN_DAYS];
0485
0486
0487 __le16 cgn_bw_min[60];
0488 __le16 cgn_bw_hr[24];
0489 __le16 cgn_bw_day[LPFC_MAX_CGN_DAYS];
0490
0491
0492 __le16 cgn_alarm_min[60];
0493 __le32 cgn_alarm_hr[24];
0494 __le32 cgn_alarm_day[LPFC_MAX_CGN_DAYS];
0495
0496 struct_group(cgn_stat,
0497 uint8_t cgn_stat_npm;
0498
0499
0500 uint8_t cgn_stat_month;
0501 uint8_t cgn_stat_day;
0502 uint8_t cgn_stat_year;
0503 uint8_t cgn_stat_hour;
0504 uint8_t cgn_stat_minute;
0505 uint8_t cgn_pad2[2];
0506
0507 __le32 cgn_notification;
0508 __le32 cgn_peer_notification;
0509 __le32 link_integ_notification;
0510 __le32 delivery_notification;
0511
0512 uint8_t cgn_stat_cgn_month;
0513 uint8_t cgn_stat_cgn_day;
0514 uint8_t cgn_stat_cgn_year;
0515 uint8_t cgn_stat_cgn_hour;
0516 uint8_t cgn_stat_cgn_min;
0517 uint8_t cgn_stat_cgn_sec;
0518
0519 uint8_t cgn_stat_peer_month;
0520 uint8_t cgn_stat_peer_day;
0521 uint8_t cgn_stat_peer_year;
0522 uint8_t cgn_stat_peer_hour;
0523 uint8_t cgn_stat_peer_min;
0524 uint8_t cgn_stat_peer_sec;
0525
0526 uint8_t cgn_stat_lnk_month;
0527 uint8_t cgn_stat_lnk_day;
0528 uint8_t cgn_stat_lnk_year;
0529 uint8_t cgn_stat_lnk_hour;
0530 uint8_t cgn_stat_lnk_min;
0531 uint8_t cgn_stat_lnk_sec;
0532
0533 uint8_t cgn_stat_del_month;
0534 uint8_t cgn_stat_del_day;
0535 uint8_t cgn_stat_del_year;
0536 uint8_t cgn_stat_del_hour;
0537 uint8_t cgn_stat_del_min;
0538 uint8_t cgn_stat_del_sec;
0539 );
0540
0541 __le32 cgn_info_crc;
0542 #define LPFC_CGN_CRC32_MAGIC_NUMBER 0x1EDC6F41
0543 #define LPFC_CGN_CRC32_SEED 0xFFFFFFFF
0544 };
0545
0546 #define LPFC_CGN_INFO_SZ (sizeof(struct lpfc_cgn_info) - \
0547 sizeof(uint32_t))
0548
0549 struct lpfc_cgn_stat {
0550 atomic64_t total_bytes;
0551 atomic64_t rcv_bytes;
0552 atomic64_t rx_latency;
0553 #define LPFC_CGN_NOT_SENT 0xFFFFFFFFFFFFFFFFLL
0554 atomic_t rx_io_cnt;
0555 };
0556
0557 struct lpfc_cgn_acqe_stat {
0558 atomic64_t alarm;
0559 atomic64_t warn;
0560 };
0561
0562 struct lpfc_vport {
0563 struct lpfc_hba *phba;
0564 struct list_head listentry;
0565 uint8_t port_type;
0566 #define LPFC_PHYSICAL_PORT 1
0567 #define LPFC_NPIV_PORT 2
0568 #define LPFC_FABRIC_PORT 3
0569 enum discovery_state port_state;
0570
0571 uint16_t vpi;
0572 uint16_t vfi;
0573 uint8_t vpi_state;
0574 #define LPFC_VPI_REGISTERED 0x1
0575
0576 uint32_t fc_flag;
0577
0578
0579
0580 #define FC_PT2PT 0x1
0581 #define FC_PT2PT_PLOGI 0x2
0582 #define FC_DISC_TMO 0x4
0583 #define FC_PUBLIC_LOOP 0x8
0584 #define FC_LBIT 0x10
0585 #define FC_RSCN_MODE 0x20
0586 #define FC_NLP_MORE 0x40
0587 #define FC_OFFLINE_MODE 0x80
0588 #define FC_FABRIC 0x100
0589 #define FC_VPORT_LOGO_RCVD 0x200
0590 #define FC_RSCN_DISCOVERY 0x400
0591 #define FC_LOGO_RCVD_DID_CHNG 0x800
0592 #define FC_PT2PT_NO_NVME 0x1000
0593 #define FC_SCSI_SCAN_TMO 0x4000
0594 #define FC_ABORT_DISCOVERY 0x8000
0595 #define FC_NDISC_ACTIVE 0x10000
0596 #define FC_BYPASSED_MODE 0x20000
0597 #define FC_VPORT_NEEDS_REG_VPI 0x80000
0598 #define FC_RSCN_DEFERRED 0x100000
0599 #define FC_VPORT_NEEDS_INIT_VPI 0x200000
0600 #define FC_VPORT_CVL_RCVD 0x400000
0601 #define FC_VFI_REGISTERED 0x800000
0602 #define FC_FDISC_COMPLETED 0x1000000
0603 #define FC_DISC_DELAYED 0x2000000
0604
0605 uint32_t ct_flags;
0606 #define FC_CT_RFF_ID 0x1
0607 #define FC_CT_RNN_ID 0x2
0608 #define FC_CT_RSNN_NN 0x4
0609 #define FC_CT_RSPN_ID 0x8
0610 #define FC_CT_RFT_ID 0x10
0611 #define FC_CT_RPRT_DEFER 0x20
0612
0613 struct list_head fc_nodes;
0614
0615
0616 uint16_t fc_plogi_cnt;
0617 uint16_t fc_adisc_cnt;
0618 uint16_t fc_reglogin_cnt;
0619 uint16_t fc_prli_cnt;
0620 uint16_t fc_unmap_cnt;
0621 uint16_t fc_map_cnt;
0622 uint16_t fc_npr_cnt;
0623 uint16_t fc_unused_cnt;
0624 struct serv_parm fc_sparam;
0625
0626 uint32_t fc_myDID;
0627 uint32_t fc_prevDID;
0628 struct lpfc_name fabric_portname;
0629 struct lpfc_name fabric_nodename;
0630
0631 int32_t stopped;
0632 uint8_t fc_linkspeed;
0633
0634 uint32_t num_disc_nodes;
0635 uint32_t gidft_inp;
0636
0637 uint32_t fc_nlp_cnt;
0638 uint32_t fc_rscn_id_cnt;
0639 uint32_t fc_rscn_flush;
0640 struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN];
0641 struct lpfc_name fc_nodename;
0642 struct lpfc_name fc_portname;
0643
0644 struct lpfc_work_evt disc_timeout_evt;
0645
0646 struct timer_list fc_disctmo;
0647 uint8_t fc_ns_retry;
0648 uint32_t fc_prli_sent;
0649
0650 spinlock_t work_port_lock;
0651 uint32_t work_port_events;
0652 #define WORKER_DISC_TMO 0x1
0653 #define WORKER_ELS_TMO 0x2
0654 #define WORKER_DELAYED_DISC_TMO 0x8
0655
0656 #define WORKER_MBOX_TMO 0x100
0657 #define WORKER_HB_TMO 0x200
0658 #define WORKER_FABRIC_BLOCK_TMO 0x400
0659 #define WORKER_RAMP_DOWN_QUEUE 0x800
0660 #define WORKER_RAMP_UP_QUEUE 0x1000
0661 #define WORKER_SERVICE_TXQ 0x2000
0662 #define WORKER_CHECK_INACTIVE_VMID 0x4000
0663 #define WORKER_CHECK_VMID_ISSUE_QFPA 0x8000
0664
0665
0666 struct timer_list els_tmofunc;
0667 struct timer_list delayed_disc_tmo;
0668
0669 uint8_t load_flag;
0670 #define FC_LOADING 0x1
0671 #define FC_UNLOADING 0x2
0672 #define FC_ALLOW_FDMI 0x4
0673 #define FC_ALLOW_VMID 0x8
0674 #define FC_DEREGISTER_ALL_APP_ID 0x10
0675
0676 uint32_t cfg_scan_down;
0677 uint32_t cfg_lun_queue_depth;
0678 uint32_t cfg_nodev_tmo;
0679 uint32_t cfg_devloss_tmo;
0680 uint32_t cfg_restrict_login;
0681 uint32_t cfg_peer_port_login;
0682 uint32_t cfg_fcp_class;
0683 uint32_t cfg_use_adisc;
0684 uint32_t cfg_discovery_threads;
0685 uint32_t cfg_log_verbose;
0686 uint32_t cfg_enable_fc4_type;
0687 uint32_t cfg_max_luns;
0688 uint32_t cfg_enable_da_id;
0689 uint32_t cfg_max_scsicmpl_time;
0690 uint32_t cfg_tgt_queue_depth;
0691 uint32_t cfg_first_burst_size;
0692 uint32_t dev_loss_tmo_changed;
0693
0694 u8 lpfc_vmid_host_uuid[LPFC_COMPRESS_VMID_SIZE];
0695 u32 max_vmid;
0696 u32 cur_vmid_cnt;
0697 #define LPFC_MIN_VMID 4
0698 #define LPFC_MAX_VMID 255
0699 u32 vmid_inactivity_timeout;
0700
0701 u32 vmid_priority_tagging;
0702 #define LPFC_VMID_PRIO_TAG_DISABLE 0
0703 #define LPFC_VMID_PRIO_TAG_SUP_TARGETS 1
0704 #define LPFC_VMID_PRIO_TAG_ALL_TARGETS 2
0705 unsigned long *vmid_priority_range;
0706 #define LPFC_VMID_MAX_PRIORITY_RANGE 256
0707 #define LPFC_VMID_PRIORITY_BITMAP_SIZE 32
0708 u8 vmid_flag;
0709 #define LPFC_VMID_IN_USE 0x1
0710 #define LPFC_VMID_ISSUE_QFPA 0x2
0711 #define LPFC_VMID_QFPA_CMPL 0x4
0712 #define LPFC_VMID_QOS_ENABLED 0x8
0713 #define LPFC_VMID_TIMER_ENBLD 0x10
0714 #define LPFC_VMID_TYPE_PRIO 0x20
0715 struct fc_qfpa_res *qfpa_res;
0716
0717 struct fc_vport *fc_vport;
0718
0719 struct lpfc_vmid *vmid;
0720 DECLARE_HASHTABLE(hash_table, 8);
0721 rwlock_t vmid_lock;
0722 struct lpfc_vmid_priority_info vmid_priority;
0723
0724 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
0725 struct dentry *debug_disc_trc;
0726 struct dentry *debug_nodelist;
0727 struct dentry *debug_nvmestat;
0728 struct dentry *debug_scsistat;
0729 struct dentry *debug_ioktime;
0730 struct dentry *debug_hdwqstat;
0731 struct dentry *vport_debugfs_root;
0732 struct lpfc_debugfs_trc *disc_trc;
0733 atomic_t disc_trc_cnt;
0734 #endif
0735 uint8_t stat_data_enabled;
0736 uint8_t stat_data_blocked;
0737 struct list_head rcv_buffer_list;
0738 unsigned long rcv_buffer_time_stamp;
0739 uint32_t vport_flag;
0740 #define STATIC_VPORT 0x1
0741 #define FAWWPN_PARAM_CHG 0x2
0742
0743 uint16_t fdmi_num_disc;
0744 uint32_t fdmi_hba_mask;
0745 uint32_t fdmi_port_mask;
0746
0747
0748 struct nvme_fc_local_port *localport;
0749 uint8_t nvmei_support;
0750 uint32_t last_fcp_wqidx;
0751 uint32_t rcv_flogi_cnt;
0752 };
0753
0754 struct hbq_s {
0755 uint16_t entry_count;
0756 uint16_t buffer_count;
0757 uint32_t next_hbqPutIdx;
0758 uint32_t hbqPutIdx;
0759 uint32_t local_hbqGetIdx;
0760 void *hbq_virt;
0761 struct list_head hbq_buffer_list;
0762
0763 struct hbq_dmabuf *(*hbq_alloc_buffer) (struct lpfc_hba *);
0764
0765 void (*hbq_free_buffer) (struct lpfc_hba *,
0766 struct hbq_dmabuf *);
0767 };
0768
0769
0770 #define LPFC_ELS_HBQ 0
0771 #define LPFC_MAX_HBQS 1
0772
0773 enum hba_temp_state {
0774 HBA_NORMAL_TEMP,
0775 HBA_OVER_TEMP
0776 };
0777
0778 enum intr_type_t {
0779 NONE = 0,
0780 INTx,
0781 MSI,
0782 MSIX,
0783 };
0784
0785 #define LPFC_CT_CTX_MAX 64
0786 struct unsol_rcv_ct_ctx {
0787 uint32_t ctxt_id;
0788 uint32_t SID;
0789 uint32_t valid;
0790 #define UNSOL_INVALID 0
0791 #define UNSOL_VALID 1
0792 uint16_t oxid;
0793 uint16_t rxid;
0794 };
0795
0796 #define LPFC_USER_LINK_SPEED_AUTO 0
0797 #define LPFC_USER_LINK_SPEED_1G 1
0798 #define LPFC_USER_LINK_SPEED_2G 2
0799 #define LPFC_USER_LINK_SPEED_4G 4
0800 #define LPFC_USER_LINK_SPEED_8G 8
0801 #define LPFC_USER_LINK_SPEED_10G 10
0802 #define LPFC_USER_LINK_SPEED_16G 16
0803 #define LPFC_USER_LINK_SPEED_32G 32
0804 #define LPFC_USER_LINK_SPEED_64G 64
0805 #define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_64G
0806
0807 #define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32, 64"
0808
0809 enum nemb_type {
0810 nemb_mse = 1,
0811 nemb_hbd
0812 };
0813
0814 enum mbox_type {
0815 mbox_rd = 1,
0816 mbox_wr
0817 };
0818
0819 enum dma_type {
0820 dma_mbox = 1,
0821 dma_ebuf
0822 };
0823
0824 enum sta_type {
0825 sta_pre_addr = 1,
0826 sta_pos_addr
0827 };
0828
0829 struct lpfc_mbox_ext_buf_ctx {
0830 uint32_t state;
0831 #define LPFC_BSG_MBOX_IDLE 0
0832 #define LPFC_BSG_MBOX_HOST 1
0833 #define LPFC_BSG_MBOX_PORT 2
0834 #define LPFC_BSG_MBOX_DONE 3
0835 #define LPFC_BSG_MBOX_ABTS 4
0836 enum nemb_type nembType;
0837 enum mbox_type mboxType;
0838 uint32_t numBuf;
0839 uint32_t mbxTag;
0840 uint32_t seqNum;
0841 struct lpfc_dmabuf *mbx_dmabuf;
0842 struct list_head ext_dmabuf_list;
0843 };
0844
0845 struct lpfc_epd_pool {
0846
0847 struct list_head list;
0848 u32 count;
0849 spinlock_t lock;
0850 };
0851
0852 enum ras_state {
0853 INACTIVE,
0854 REG_INPROGRESS,
0855 ACTIVE
0856 };
0857
0858 struct lpfc_ras_fwlog {
0859 uint8_t *fwlog_buff;
0860 uint32_t fw_buffcount;
0861 #define LPFC_RAS_BUFF_ENTERIES 16
0862 #define LPFC_RAS_MAX_ENTRY_SIZE (64 * 1024)
0863 #define LPFC_RAS_MIN_BUFF_POST_SIZE (256 * 1024)
0864 #define LPFC_RAS_MAX_BUFF_POST_SIZE (1024 * 1024)
0865 uint32_t fw_loglevel;
0866 struct lpfc_dmabuf lwpd;
0867 struct list_head fwlog_buff_list;
0868
0869
0870 bool ras_hwsupport;
0871 bool ras_enabled;
0872 #define LPFC_RAS_DISABLE_LOGGING 0x00
0873 #define LPFC_RAS_ENABLE_LOGGING 0x01
0874 enum ras_state state;
0875 };
0876
0877 #define DBG_LOG_STR_SZ 256
0878 #define DBG_LOG_SZ 256
0879
0880 struct dbg_log_ent {
0881 char log[DBG_LOG_STR_SZ];
0882 u64 t_ns;
0883 };
0884
0885 enum lpfc_irq_chann_mode {
0886
0887 NORMAL_MODE,
0888
0889
0890 NUMA_MODE,
0891
0892
0893
0894
0895 NHT_MODE,
0896 };
0897
0898 enum lpfc_hba_bit_flags {
0899 FABRIC_COMANDS_BLOCKED,
0900 HBA_PCI_ERR,
0901 };
0902
0903 struct lpfc_hba {
0904
0905 struct lpfc_io_buf * (*lpfc_get_scsi_buf)
0906 (struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
0907 struct scsi_cmnd *cmnd);
0908 int (*lpfc_scsi_prep_dma_buf)
0909 (struct lpfc_hba *, struct lpfc_io_buf *);
0910 void (*lpfc_scsi_unprep_dma_buf)
0911 (struct lpfc_hba *, struct lpfc_io_buf *);
0912 void (*lpfc_release_scsi_buf)
0913 (struct lpfc_hba *, struct lpfc_io_buf *);
0914 void (*lpfc_rampdown_queue_depth)
0915 (struct lpfc_hba *);
0916 void (*lpfc_scsi_prep_cmnd)
0917 (struct lpfc_vport *, struct lpfc_io_buf *,
0918 struct lpfc_nodelist *);
0919 int (*lpfc_scsi_prep_cmnd_buf)
0920 (struct lpfc_vport *vport,
0921 struct lpfc_io_buf *lpfc_cmd,
0922 uint8_t tmo);
0923 int (*lpfc_scsi_prep_task_mgmt_cmd)
0924 (struct lpfc_vport *vport,
0925 struct lpfc_io_buf *lpfc_cmd,
0926 u64 lun, u8 task_mgmt_cmd);
0927
0928
0929 int (*__lpfc_sli_issue_iocb)
0930 (struct lpfc_hba *, uint32_t,
0931 struct lpfc_iocbq *, uint32_t);
0932 int (*__lpfc_sli_issue_fcp_io)
0933 (struct lpfc_hba *phba, uint32_t ring_number,
0934 struct lpfc_iocbq *piocb, uint32_t flag);
0935 void (*__lpfc_sli_release_iocbq)(struct lpfc_hba *,
0936 struct lpfc_iocbq *);
0937 int (*lpfc_hba_down_post)(struct lpfc_hba *phba);
0938 void (*lpfc_scsi_cmd_iocb_cmpl)
0939 (struct lpfc_hba *, struct lpfc_iocbq *, struct lpfc_iocbq *);
0940
0941
0942 int (*lpfc_sli_issue_mbox)
0943 (struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t);
0944
0945
0946 void (*lpfc_sli_handle_slow_ring_event)
0947 (struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
0948 uint32_t mask);
0949
0950
0951 int (*lpfc_sli_hbq_to_firmware)
0952 (struct lpfc_hba *, uint32_t, struct hbq_dmabuf *);
0953 int (*lpfc_sli_brdrestart)
0954 (struct lpfc_hba *);
0955 int (*lpfc_sli_brdready)
0956 (struct lpfc_hba *, uint32_t);
0957 void (*lpfc_handle_eratt)
0958 (struct lpfc_hba *);
0959 void (*lpfc_stop_port)
0960 (struct lpfc_hba *);
0961 int (*lpfc_hba_init_link)
0962 (struct lpfc_hba *, uint32_t);
0963 int (*lpfc_hba_down_link)
0964 (struct lpfc_hba *, uint32_t);
0965 int (*lpfc_selective_reset)
0966 (struct lpfc_hba *);
0967
0968 int (*lpfc_bg_scsi_prep_dma_buf)
0969 (struct lpfc_hba *, struct lpfc_io_buf *);
0970
0971
0972 void (*__lpfc_sli_prep_els_req_rsp)(struct lpfc_iocbq *cmdiocbq,
0973 struct lpfc_vport *vport,
0974 struct lpfc_dmabuf *bmp,
0975 u16 cmd_size, u32 did, u32 elscmd,
0976 u8 tmo, u8 expect_rsp);
0977 void (*__lpfc_sli_prep_gen_req)(struct lpfc_iocbq *cmdiocbq,
0978 struct lpfc_dmabuf *bmp, u16 rpi,
0979 u32 num_entry, u8 tmo);
0980 void (*__lpfc_sli_prep_xmit_seq64)(struct lpfc_iocbq *cmdiocbq,
0981 struct lpfc_dmabuf *bmp, u16 rpi,
0982 u16 ox_id, u32 num_entry, u8 rctl,
0983 u8 last_seq, u8 cr_cx_cmd);
0984 void (*__lpfc_sli_prep_abort_xri)(struct lpfc_iocbq *cmdiocbq,
0985 u16 ulp_context, u16 iotag,
0986 u8 ulp_class, u16 cqid, bool ia,
0987 bool wqec);
0988
0989
0990 struct lpfc_epd_pool epd_pool;
0991
0992
0993 struct lpfc_sli4_hba sli4_hba;
0994
0995 struct workqueue_struct *wq;
0996 struct delayed_work eq_delay_work;
0997
0998 #define LPFC_IDLE_STAT_DELAY 1000
0999 struct delayed_work idle_stat_delay_work;
1000
1001 struct lpfc_sli sli;
1002 uint8_t pci_dev_grp;
1003 uint32_t sli_rev;
1004 uint32_t sli3_options;
1005 #define LPFC_SLI3_HBQ_ENABLED 0x01
1006 #define LPFC_SLI3_NPIV_ENABLED 0x02
1007 #define LPFC_SLI3_VPORT_TEARDOWN 0x04
1008 #define LPFC_SLI3_CRP_ENABLED 0x08
1009 #define LPFC_SLI3_BG_ENABLED 0x20
1010 #define LPFC_SLI3_DSS_ENABLED 0x40
1011 #define LPFC_SLI4_PERFH_ENABLED 0x80
1012 #define LPFC_SLI4_PHWQ_ENABLED 0x100
1013 uint32_t iocb_cmd_size;
1014 uint32_t iocb_rsp_size;
1015
1016 struct lpfc_trunk_link trunk_link;
1017 enum hba_state link_state;
1018 uint32_t link_flag;
1019 #define LS_LOOPBACK_MODE 0x1
1020
1021
1022 #define LS_NPIV_FAB_SUPPORTED 0x2
1023 #define LS_IGNORE_ERATT 0x4
1024 #define LS_MDS_LINK_DOWN 0x8
1025 #define LS_MDS_LOOPBACK 0x10
1026 #define LS_CT_VEN_RPA 0x20
1027 #define LS_EXTERNAL_LOOPBACK 0x40
1028
1029 uint32_t hba_flag;
1030 #define HBA_ERATT_HANDLED 0x1
1031 #define DEFER_ERATT 0x2
1032 #define HBA_FCOE_MODE 0x4
1033 #define HBA_SP_QUEUE_EVT 0x8
1034 #define HBA_POST_RECEIVE_BUFFER 0x10
1035 #define HBA_PERSISTENT_TOPO 0x20
1036 #define ELS_XRI_ABORT_EVENT 0x40
1037 #define ASYNC_EVENT 0x80
1038 #define LINK_DISABLED 0x100
1039 #define FCF_TS_INPROG 0x200
1040 #define FCF_RR_INPROG 0x400
1041 #define HBA_FIP_SUPPORT 0x800
1042 #define HBA_AER_ENABLED 0x1000
1043 #define HBA_DEVLOSS_TMO 0x2000
1044 #define HBA_RRQ_ACTIVE 0x4000
1045 #define HBA_IOQ_FLUSH 0x8000
1046 #define HBA_RECOVERABLE_UE 0x20000
1047 #define HBA_FORCED_LINK_SPEED 0x40000
1048
1049
1050
1051 #define HBA_FLOGI_ISSUED 0x100000
1052 #define HBA_SHORT_CMF 0x200000
1053 #define HBA_CGN_DAY_WRAP 0x400000
1054 #define HBA_DEFER_FLOGI 0x800000
1055 #define HBA_SETUP 0x1000000
1056 #define HBA_NEEDS_CFG_PORT 0x2000000
1057 #define HBA_HBEAT_INP 0x4000000
1058 #define HBA_HBEAT_TMO 0x8000000
1059 #define HBA_FLOGI_OUTSTANDING 0x10000000
1060 #define HBA_RHBA_CMPL 0x20000000
1061
1062 struct completion *fw_dump_cmpl;
1063 uint32_t fcp_ring_in_use;
1064 struct lpfc_dmabuf slim2p;
1065
1066 MAILBOX_t *mbox;
1067 uint32_t *mbox_ext;
1068 struct lpfc_mbox_ext_buf_ctx mbox_ext_buf_ctx;
1069 uint32_t ha_copy;
1070 struct _PCB *pcb;
1071 struct _IOCB *IOCBs;
1072
1073 struct lpfc_dmabuf hbqslimp;
1074
1075 uint16_t pci_cfg_value;
1076
1077 uint8_t fc_linkspeed;
1078
1079 uint32_t fc_eventTag;
1080 uint32_t link_events;
1081
1082
1083 uint32_t fc_pref_DID;
1084 uint8_t fc_pref_ALPA;
1085 uint32_t fc_edtovResol;
1086 uint32_t fc_edtov;
1087 uint32_t fc_arbtov;
1088 uint32_t fc_ratov;
1089 uint32_t fc_rttov;
1090 uint32_t fc_altov;
1091 uint32_t fc_crtov;
1092
1093 struct serv_parm fc_fabparam;
1094 uint8_t alpa_map[128];
1095
1096 uint32_t lmt;
1097
1098 uint32_t fc_topology;
1099 uint32_t fc_topology_changed;
1100
1101 struct lpfc_stats fc_stat;
1102
1103 struct lpfc_nodelist fc_fcpnodev;
1104 uint32_t nport_event_cnt;
1105
1106 uint8_t wwnn[8];
1107 uint8_t wwpn[8];
1108 uint32_t RandomData[7];
1109 uint8_t fcp_embed_io;
1110 uint8_t nvmet_support;
1111 #define LPFC_NVMET_MAX_PORTS 32
1112 uint8_t mds_diags_support;
1113 uint8_t bbcredit_support;
1114 uint8_t enab_exp_wqcq_pages;
1115 u8 nsler;
1116
1117
1118 uint32_t cfg_ack0;
1119 uint32_t cfg_xri_rebalancing;
1120 uint32_t cfg_xpsgl;
1121 uint32_t cfg_enable_npiv;
1122 uint32_t cfg_enable_rrq;
1123 uint32_t cfg_topology;
1124 uint32_t cfg_link_speed;
1125 #define LPFC_FCF_FOV 1
1126 #define LPFC_FCF_PRIORITY 2
1127 uint32_t cfg_fcf_failover_policy;
1128 uint32_t cfg_fcp_io_sched;
1129 uint32_t cfg_ns_query;
1130 uint32_t cfg_fcp2_no_tgt_reset;
1131 uint32_t cfg_cr_delay;
1132 uint32_t cfg_cr_count;
1133 uint32_t cfg_multi_ring_support;
1134 uint32_t cfg_multi_ring_rctl;
1135 uint32_t cfg_multi_ring_type;
1136 uint32_t cfg_poll;
1137 uint32_t cfg_poll_tmo;
1138 uint32_t cfg_task_mgmt_tmo;
1139 uint32_t cfg_use_msi;
1140 uint32_t cfg_auto_imax;
1141 uint32_t cfg_fcp_imax;
1142 uint32_t cfg_force_rscn;
1143 uint32_t cfg_cq_poll_threshold;
1144 uint32_t cfg_cq_max_proc_limit;
1145 uint32_t cfg_fcp_cpu_map;
1146 uint32_t cfg_fcp_mq_threshold;
1147 uint32_t cfg_hdw_queue;
1148 uint32_t cfg_irq_chann;
1149 uint32_t cfg_suppress_rsp;
1150 uint32_t cfg_nvme_oas;
1151 uint32_t cfg_nvme_embed_cmd;
1152 uint32_t cfg_nvmet_mrq_post;
1153 uint32_t cfg_nvmet_mrq;
1154 uint32_t cfg_enable_nvmet;
1155 uint32_t cfg_nvme_enable_fb;
1156 uint32_t cfg_nvmet_fb_size;
1157 uint32_t cfg_total_seg_cnt;
1158 uint32_t cfg_sg_seg_cnt;
1159 uint32_t cfg_nvme_seg_cnt;
1160 uint32_t cfg_scsi_seg_cnt;
1161 uint32_t cfg_sg_dma_buf_size;
1162 uint32_t cfg_hba_queue_depth;
1163 uint32_t cfg_enable_hba_reset;
1164 uint32_t cfg_enable_hba_heartbeat;
1165 uint32_t cfg_fof;
1166 uint32_t cfg_EnableXLane;
1167 uint8_t cfg_oas_tgt_wwpn[8];
1168 uint8_t cfg_oas_vpt_wwpn[8];
1169 uint32_t cfg_oas_lun_state;
1170 #define OAS_LUN_ENABLE 1
1171 #define OAS_LUN_DISABLE 0
1172 uint32_t cfg_oas_lun_status;
1173 #define OAS_LUN_STATUS_EXISTS 0x01
1174 uint32_t cfg_oas_flags;
1175 #define OAS_FIND_ANY_VPORT 0x01
1176 #define OAS_FIND_ANY_TARGET 0x02
1177 #define OAS_LUN_VALID 0x04
1178 uint32_t cfg_oas_priority;
1179 uint32_t cfg_XLanePriority;
1180 uint32_t cfg_enable_bg;
1181 uint32_t cfg_prot_mask;
1182 uint32_t cfg_prot_guard;
1183 uint32_t cfg_hostmem_hgp;
1184 uint32_t cfg_log_verbose;
1185 uint32_t cfg_enable_fc4_type;
1186 #define LPFC_ENABLE_FCP 1
1187 #define LPFC_ENABLE_NVME 2
1188 #define LPFC_ENABLE_BOTH 3
1189 #if (IS_ENABLED(CONFIG_NVME_FC))
1190 #define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_BOTH
1191 #define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_BOTH
1192 #else
1193 #define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_FCP
1194 #define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_FCP
1195 #endif
1196 uint32_t cfg_aer_support;
1197 uint32_t cfg_sriov_nr_virtfn;
1198 uint32_t cfg_request_firmware_upgrade;
1199 uint32_t cfg_suppress_link_up;
1200 uint32_t cfg_rrq_xri_bitmap_sz;
1201 u32 cfg_fcp_wait_abts_rsp;
1202 uint32_t cfg_delay_discovery;
1203 uint32_t cfg_sli_mode;
1204 #define LPFC_INITIALIZE_LINK 0
1205 #define LPFC_DELAY_INIT_LINK 1
1206 #define LPFC_DELAY_INIT_LINK_INDEFINITELY 2
1207 uint32_t cfg_fdmi_on;
1208 #define LPFC_FDMI_NO_SUPPORT 0
1209 #define LPFC_FDMI_SUPPORT 1
1210 uint32_t cfg_enable_SmartSAN;
1211 uint32_t cfg_enable_mds_diags;
1212 uint32_t cfg_ras_fwlog_level;
1213 uint32_t cfg_ras_fwlog_buffsize;
1214 uint32_t cfg_ras_fwlog_func;
1215 uint32_t cfg_enable_bbcr;
1216 uint32_t cfg_enable_dpp;
1217 uint32_t cfg_enable_pbde;
1218 uint32_t cfg_enable_mi;
1219 struct nvmet_fc_target_port *targetport;
1220 lpfc_vpd_t vpd;
1221
1222 u32 cfg_max_vmid;
1223 u32 cfg_vmid_app_header;
1224 #define LPFC_VMID_APP_HEADER_DISABLE 0
1225 #define LPFC_VMID_APP_HEADER_ENABLE 1
1226 u32 cfg_vmid_priority_tagging;
1227 u32 cfg_vmid_inactivity_timeout;
1228
1229 struct pci_dev *pcidev;
1230 struct list_head work_list;
1231 uint32_t work_ha;
1232 uint32_t work_ha_mask;
1233 uint32_t work_hs;
1234 uint32_t work_status[2];
1235
1236 wait_queue_head_t work_waitq;
1237 struct task_struct *worker_thread;
1238 unsigned long data_flags;
1239 uint32_t border_sge_num;
1240
1241 uint32_t hbq_in_use;
1242 uint32_t hbq_count;
1243 struct hbq_s hbqs[LPFC_MAX_HBQS];
1244
1245 atomic_t fcp_qidx;
1246 atomic_t nvme_qidx;
1247
1248 phys_addr_t pci_bar0_map;
1249 phys_addr_t pci_bar1_map;
1250 phys_addr_t pci_bar2_map;
1251 void __iomem *slim_memmap_p;
1252
1253 void __iomem *ctrl_regs_memmap_p;
1254
1255
1256 void __iomem *pci_bar0_memmap_p;
1257
1258 void __iomem *pci_bar2_memmap_p;
1259
1260 void __iomem *pci_bar4_memmap_p;
1261
1262 #define PCI_64BIT_BAR0 0
1263 #define PCI_64BIT_BAR2 2
1264 #define PCI_64BIT_BAR4 4
1265 void __iomem *MBslimaddr;
1266 void __iomem *HAregaddr;
1267 void __iomem *CAregaddr;
1268 void __iomem *HSregaddr;
1269
1270 void __iomem *HCregaddr;
1271
1272 struct lpfc_hgp __iomem *host_gp;
1273 struct lpfc_pgp *port_gp;
1274 uint32_t __iomem *hbq_put;
1275 uint32_t *hbq_get;
1276
1277 int brd_no;
1278 char SerialNumber[32];
1279 char OptionROMVersion[32];
1280 char BIOSVersion[16];
1281 char ModelDesc[256];
1282 char ModelName[80];
1283 char ProgramType[256];
1284 char Port[20];
1285 uint8_t vpd_flag;
1286
1287 #define VPD_MODEL_DESC 0x1
1288 #define VPD_MODEL_NAME 0x2
1289 #define VPD_PROGRAM_TYPE 0x4
1290 #define VPD_PORT 0x8
1291 #define VPD_MASK 0xf
1292
1293
1294 struct timer_list fcp_poll_timer;
1295 struct timer_list eratt_poll;
1296 uint32_t eratt_poll_interval;
1297
1298 uint64_t bg_guard_err_cnt;
1299 uint64_t bg_apptag_err_cnt;
1300 uint64_t bg_reftag_err_cnt;
1301
1302
1303 spinlock_t scsi_buf_list_get_lock;
1304 spinlock_t scsi_buf_list_put_lock;
1305 struct list_head lpfc_scsi_buf_list_get;
1306 struct list_head lpfc_scsi_buf_list_put;
1307 uint32_t total_scsi_bufs;
1308 struct list_head lpfc_iocb_list;
1309 uint32_t total_iocbq_bufs;
1310 struct list_head active_rrq_list;
1311 spinlock_t hbalock;
1312 struct work_struct unblock_request_work;
1313
1314
1315 struct dma_pool *lpfc_sg_dma_buf_pool;
1316 struct dma_pool *lpfc_mbuf_pool;
1317 struct dma_pool *lpfc_hrb_pool;
1318 struct dma_pool *lpfc_drb_pool;
1319 struct dma_pool *lpfc_nvmet_drb_pool;
1320 struct dma_pool *lpfc_hbq_pool;
1321 struct dma_pool *lpfc_cmd_rsp_buf_pool;
1322 struct lpfc_dma_pool lpfc_mbuf_safety_pool;
1323
1324 mempool_t *mbox_mem_pool;
1325 mempool_t *nlp_mem_pool;
1326 mempool_t *rrq_pool;
1327 mempool_t *active_rrq_pool;
1328
1329 struct fc_host_statistics link_stats;
1330 enum lpfc_irq_chann_mode irq_chann_mode;
1331 enum intr_type_t intr_type;
1332 uint32_t intr_mode;
1333 #define LPFC_INTR_ERROR 0xFFFFFFFF
1334 struct list_head port_list;
1335 spinlock_t port_list_lock;
1336 struct lpfc_vport *pport;
1337 uint16_t max_vpi;
1338 #define LPFC_MAX_VPI 0xFF
1339 #define LPFC_MAX_VPORTS 0x100
1340 uint16_t max_vports;
1341
1342
1343
1344
1345
1346 uint16_t vpi_base;
1347 uint16_t vfi_base;
1348 unsigned long *vpi_bmask;
1349 uint16_t *vpi_ids;
1350 uint16_t vpi_count;
1351 struct list_head lpfc_vpi_blk_list;
1352
1353
1354 struct list_head fabric_iocb_list;
1355 atomic_t fabric_iocb_count;
1356 struct timer_list fabric_block_timer;
1357 unsigned long bit_flags;
1358 atomic_t num_rsrc_err;
1359 atomic_t num_cmd_success;
1360 unsigned long last_rsrc_error_time;
1361 unsigned long last_ramp_down_time;
1362 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1363 struct dentry *hba_debugfs_root;
1364 atomic_t debugfs_vport_count;
1365 struct dentry *debug_multixri_pools;
1366 struct dentry *debug_hbqinfo;
1367 struct dentry *debug_dumpHostSlim;
1368 struct dentry *debug_dumpHBASlim;
1369 struct dentry *debug_InjErrLBA;
1370 struct dentry *debug_InjErrNPortID;
1371 struct dentry *debug_InjErrWWPN;
1372 struct dentry *debug_writeGuard;
1373 struct dentry *debug_writeApp;
1374 struct dentry *debug_writeRef;
1375 struct dentry *debug_readGuard;
1376 struct dentry *debug_readApp;
1377 struct dentry *debug_readRef;
1378
1379 struct dentry *debug_nvmeio_trc;
1380 struct lpfc_debugfs_nvmeio_trc *nvmeio_trc;
1381 struct dentry *debug_hdwqinfo;
1382 #ifdef LPFC_HDWQ_LOCK_STAT
1383 struct dentry *debug_lockstat;
1384 #endif
1385 struct dentry *debug_cgn_buffer;
1386 struct dentry *debug_rx_monitor;
1387 struct dentry *debug_ras_log;
1388 atomic_t nvmeio_trc_cnt;
1389 uint32_t nvmeio_trc_size;
1390 uint32_t nvmeio_trc_output_idx;
1391
1392
1393 uint32_t lpfc_injerr_wgrd_cnt;
1394 uint32_t lpfc_injerr_wapp_cnt;
1395 uint32_t lpfc_injerr_wref_cnt;
1396 uint32_t lpfc_injerr_rgrd_cnt;
1397 uint32_t lpfc_injerr_rapp_cnt;
1398 uint32_t lpfc_injerr_rref_cnt;
1399 uint32_t lpfc_injerr_nportid;
1400 struct lpfc_name lpfc_injerr_wwpn;
1401 sector_t lpfc_injerr_lba;
1402 #define LPFC_INJERR_LBA_OFF (sector_t)(-1)
1403
1404 struct dentry *debug_slow_ring_trc;
1405 struct lpfc_debugfs_trc *slow_ring_trc;
1406 atomic_t slow_ring_trc_cnt;
1407
1408 struct dentry *idiag_root;
1409 struct dentry *idiag_pci_cfg;
1410 struct dentry *idiag_bar_acc;
1411 struct dentry *idiag_que_info;
1412 struct dentry *idiag_que_acc;
1413 struct dentry *idiag_drb_acc;
1414 struct dentry *idiag_ctl_acc;
1415 struct dentry *idiag_mbx_acc;
1416 struct dentry *idiag_ext_acc;
1417 uint8_t lpfc_idiag_last_eq;
1418 #endif
1419 uint16_t nvmeio_trc_on;
1420
1421
1422 struct list_head elsbuf;
1423 int elsbuf_cnt;
1424 int elsbuf_prev_cnt;
1425
1426 uint8_t temp_sensor_support;
1427
1428 unsigned long last_completion_time;
1429 unsigned long skipped_hb;
1430 struct timer_list hb_tmofunc;
1431 struct timer_list rrq_tmr;
1432 enum hba_temp_state over_temp_state;
1433
1434
1435
1436
1437 #define QUE_BUFTAG_BIT (1<<31)
1438 uint32_t buffer_tag_count;
1439
1440 #define LPFC_NO_BUCKET 0
1441 #define LPFC_LINEAR_BUCKET 1
1442 #define LPFC_POWER2_BUCKET 2
1443 uint8_t bucket_type;
1444 uint32_t bucket_base;
1445 uint32_t bucket_step;
1446
1447
1448 #define LPFC_MAX_EVT_COUNT 512
1449 atomic_t fast_event_count;
1450 uint32_t fcoe_eventtag;
1451 uint32_t fcoe_eventtag_at_fcf_scan;
1452 uint32_t fcoe_cvl_eventtag;
1453 uint32_t fcoe_cvl_eventtag_attn;
1454 struct lpfc_fcf fcf;
1455 uint8_t fc_map[3];
1456 uint8_t valid_vlan;
1457 uint16_t vlan_id;
1458 struct list_head fcf_conn_rec_list;
1459
1460 bool defer_flogi_acc_flag;
1461 uint16_t defer_flogi_acc_rx_id;
1462 uint16_t defer_flogi_acc_ox_id;
1463
1464 spinlock_t ct_ev_lock;
1465 struct list_head ct_ev_waiters;
1466 struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX];
1467 uint32_t ctx_idx;
1468 struct timer_list inactive_vmid_poll;
1469
1470
1471 struct lpfc_ras_fwlog ras_fwlog;
1472
1473 uint32_t iocb_cnt;
1474 uint32_t iocb_max;
1475 atomic_t sdev_cnt;
1476 spinlock_t devicelock;
1477 mempool_t *device_data_mem_pool;
1478 struct list_head luns;
1479 #define LPFC_TRANSGRESSION_HIGH_TEMPERATURE 0x0080
1480 #define LPFC_TRANSGRESSION_LOW_TEMPERATURE 0x0040
1481 #define LPFC_TRANSGRESSION_HIGH_VOLTAGE 0x0020
1482 #define LPFC_TRANSGRESSION_LOW_VOLTAGE 0x0010
1483 #define LPFC_TRANSGRESSION_HIGH_TXBIAS 0x0008
1484 #define LPFC_TRANSGRESSION_LOW_TXBIAS 0x0004
1485 #define LPFC_TRANSGRESSION_HIGH_TXPOWER 0x0002
1486 #define LPFC_TRANSGRESSION_LOW_TXPOWER 0x0001
1487 #define LPFC_TRANSGRESSION_HIGH_RXPOWER 0x8000
1488 #define LPFC_TRANSGRESSION_LOW_RXPOWER 0x4000
1489 uint16_t sfp_alarm;
1490 uint16_t sfp_warning;
1491
1492 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1493 uint16_t hdwqstat_on;
1494 #define LPFC_CHECK_OFF 0
1495 #define LPFC_CHECK_NVME_IO 1
1496 #define LPFC_CHECK_NVMET_IO 2
1497 #define LPFC_CHECK_SCSI_IO 4
1498 uint16_t ktime_on;
1499 uint64_t ktime_data_samples;
1500 uint64_t ktime_status_samples;
1501 uint64_t ktime_last_cmd;
1502 uint64_t ktime_seg1_total;
1503 uint64_t ktime_seg1_min;
1504 uint64_t ktime_seg1_max;
1505 uint64_t ktime_seg2_total;
1506 uint64_t ktime_seg2_min;
1507 uint64_t ktime_seg2_max;
1508 uint64_t ktime_seg3_total;
1509 uint64_t ktime_seg3_min;
1510 uint64_t ktime_seg3_max;
1511 uint64_t ktime_seg4_total;
1512 uint64_t ktime_seg4_min;
1513 uint64_t ktime_seg4_max;
1514 uint64_t ktime_seg5_total;
1515 uint64_t ktime_seg5_min;
1516 uint64_t ktime_seg5_max;
1517 uint64_t ktime_seg6_total;
1518 uint64_t ktime_seg6_min;
1519 uint64_t ktime_seg6_max;
1520 uint64_t ktime_seg7_total;
1521 uint64_t ktime_seg7_min;
1522 uint64_t ktime_seg7_max;
1523 uint64_t ktime_seg8_total;
1524 uint64_t ktime_seg8_min;
1525 uint64_t ktime_seg8_max;
1526 uint64_t ktime_seg9_total;
1527 uint64_t ktime_seg9_min;
1528 uint64_t ktime_seg9_max;
1529 uint64_t ktime_seg10_total;
1530 uint64_t ktime_seg10_min;
1531 uint64_t ktime_seg10_max;
1532 #endif
1533
1534 struct lpfc_cgn_stat __percpu *cmf_stat;
1535 uint32_t cmf_interval_rate;
1536 uint32_t cmf_timer_cnt;
1537 #define LPFC_CMF_INTERVAL 90
1538 uint64_t cmf_link_byte_count;
1539 uint64_t cmf_max_line_rate;
1540 uint64_t cmf_max_bytes_per_interval;
1541 uint64_t cmf_last_sync_bw;
1542 #define LPFC_CMF_BLK_SIZE 512
1543 struct hrtimer cmf_timer;
1544 atomic_t cmf_bw_wait;
1545 atomic_t cmf_busy;
1546 atomic_t cmf_stop_io;
1547 uint32_t cmf_active_mode;
1548 uint32_t cmf_info_per_interval;
1549 #define LPFC_MAX_CMF_INFO 32
1550 struct timespec64 cmf_latency;
1551 uint32_t cmf_last_ts;
1552 uint32_t cmf_active_info;
1553
1554
1555 u8 cgn_reg_fpin;
1556 u8 cgn_init_reg_fpin;
1557 #define LPFC_CGN_FPIN_NONE 0x0
1558 #define LPFC_CGN_FPIN_WARN 0x1
1559 #define LPFC_CGN_FPIN_ALARM 0x2
1560 #define LPFC_CGN_FPIN_BOTH (LPFC_CGN_FPIN_WARN | LPFC_CGN_FPIN_ALARM)
1561
1562 u8 cgn_reg_signal;
1563 u8 cgn_init_reg_signal;
1564
1565
1566
1567 u16 cgn_fpin_frequency;
1568 #define LPFC_FPIN_INIT_FREQ 0xffff
1569 u32 cgn_sig_freq;
1570 u32 cgn_acqe_cnt;
1571
1572
1573 struct rxtable_entry *rxtable;
1574 atomic_t rxtable_idx_head;
1575 #define LPFC_RXMONITOR_TABLE_IN_USE (LPFC_MAX_RXMONITOR_ENTRY + 73)
1576 atomic_t rxtable_idx_tail;
1577 atomic_t rx_max_read_cnt;
1578 uint64_t rx_block_cnt;
1579
1580
1581 struct lpfc_cgn_param cgn_p;
1582
1583
1584 struct lpfc_cgn_acqe_stat cgn_acqe_stat;
1585
1586
1587 struct lpfc_dmabuf *cgn_i;
1588 atomic_t cgn_fabric_warn_cnt;
1589 atomic_t cgn_fabric_alarm_cnt;
1590 atomic_t cgn_sync_warn_cnt;
1591 atomic_t cgn_sync_alarm_cnt;
1592 atomic_t cgn_driver_evt_cnt;
1593 atomic_t cgn_latency_evt_cnt;
1594 struct timespec64 cgn_daily_ts;
1595 atomic64_t cgn_latency_evt;
1596 unsigned long cgn_evt_timestamp;
1597 #define LPFC_CGN_TIMER_TO_MIN 60000
1598 uint32_t cgn_evt_minute;
1599 #define LPFC_SEC_MIN 60
1600 #define LPFC_MIN_HOUR 60
1601 #define LPFC_HOUR_DAY 24
1602 #define LPFC_MIN_DAY (LPFC_MIN_HOUR * LPFC_HOUR_DAY)
1603
1604 struct hlist_node cpuhp;
1605 struct timer_list cpuhp_poll_timer;
1606 struct list_head poll_list;
1607 #define LPFC_POLL_HB 1
1608 #define LPFC_POLL_FASTPATH 0
1609 #define LPFC_POLL_SLOWPATH 1
1610
1611 char os_host_name[MAXHOSTNAMELEN];
1612
1613
1614 struct scsi_host_template port_template;
1615
1616 struct scsi_host_template vport_template;
1617 atomic_t dbg_log_idx;
1618 atomic_t dbg_log_cnt;
1619 atomic_t dbg_log_dmping;
1620 struct dbg_log_ent dbg_log[DBG_LOG_SZ];
1621 };
1622
1623 #define LPFC_MAX_RXMONITOR_ENTRY 800
1624 #define LPFC_MAX_RXMONITOR_DUMP 32
1625 struct rxtable_entry {
1626 uint64_t cmf_bytes;
1627 uint64_t total_bytes;
1628 uint64_t rcv_bytes;
1629 uint64_t avg_io_size;
1630 uint64_t avg_io_latency;
1631 uint64_t max_read_cnt;
1632 uint64_t max_bytes_per_interval;
1633 uint32_t cmf_busy;
1634 uint32_t cmf_info;
1635 uint32_t io_cnt;
1636 uint32_t timer_utilization;
1637 uint32_t timer_interval;
1638 };
1639
1640 static inline struct Scsi_Host *
1641 lpfc_shost_from_vport(struct lpfc_vport *vport)
1642 {
1643 return container_of((void *) vport, struct Scsi_Host, hostdata[0]);
1644 }
1645
1646 static inline void
1647 lpfc_set_loopback_flag(struct lpfc_hba *phba)
1648 {
1649 if (phba->cfg_topology == FLAGS_LOCAL_LB)
1650 phba->link_flag |= LS_LOOPBACK_MODE;
1651 else
1652 phba->link_flag &= ~LS_LOOPBACK_MODE;
1653 }
1654
1655 static inline int
1656 lpfc_is_link_up(struct lpfc_hba *phba)
1657 {
1658 return phba->link_state == LPFC_LINK_UP ||
1659 phba->link_state == LPFC_CLEAR_LA ||
1660 phba->link_state == LPFC_HBA_READY;
1661 }
1662
1663 static inline void
1664 lpfc_worker_wake_up(struct lpfc_hba *phba)
1665 {
1666
1667 set_bit(LPFC_DATA_READY, &phba->data_flags);
1668
1669
1670 wake_up(&phba->work_waitq);
1671 return;
1672 }
1673
1674 static inline int
1675 lpfc_readl(void __iomem *addr, uint32_t *data)
1676 {
1677 uint32_t temp;
1678 temp = readl(addr);
1679 if (temp == 0xffffffff)
1680 return -EIO;
1681 *data = temp;
1682 return 0;
1683 }
1684
1685 static inline int
1686 lpfc_sli_read_hs(struct lpfc_hba *phba)
1687 {
1688
1689
1690
1691
1692 phba->sli.slistat.err_attn_event++;
1693
1694
1695 if (lpfc_readl(phba->HSregaddr, &phba->work_hs) ||
1696 lpfc_readl(phba->MBslimaddr + 0xa8, &phba->work_status[0]) ||
1697 lpfc_readl(phba->MBslimaddr + 0xac, &phba->work_status[1])) {
1698 return -EIO;
1699 }
1700
1701
1702 writel(HA_ERATT, phba->HAregaddr);
1703 readl(phba->HAregaddr);
1704 phba->pport->stopped = 1;
1705
1706 return 0;
1707 }
1708
1709 static inline struct lpfc_sli_ring *
1710 lpfc_phba_elsring(struct lpfc_hba *phba)
1711 {
1712
1713 if (phba->sli_rev != LPFC_SLI_REV4 &&
1714 phba->sli_rev != LPFC_SLI_REV3 &&
1715 phba->sli_rev != LPFC_SLI_REV2)
1716 return NULL;
1717
1718 if (phba->sli_rev == LPFC_SLI_REV4) {
1719 if (phba->sli4_hba.els_wq)
1720 return phba->sli4_hba.els_wq->pring;
1721 else
1722 return NULL;
1723 }
1724 return &phba->sli.sli3_ring[LPFC_ELS_RING];
1725 }
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735 static inline unsigned int
1736 lpfc_next_online_cpu(const struct cpumask *mask, unsigned int start)
1737 {
1738 unsigned int cpu_it;
1739
1740 for_each_cpu_wrap(cpu_it, mask, start) {
1741 if (cpu_online(cpu_it))
1742 break;
1743 }
1744
1745 return cpu_it;
1746 }
1747
1748
1749
1750
1751
1752
1753
1754 static inline void
1755 lpfc_sli4_mod_hba_eq_delay(struct lpfc_hba *phba, struct lpfc_queue *eq,
1756 u32 delay)
1757 {
1758 struct lpfc_register reg_data;
1759
1760 reg_data.word0 = 0;
1761 bf_set(lpfc_sliport_eqdelay_id, ®_data, eq->queue_id);
1762 bf_set(lpfc_sliport_eqdelay_delay, ®_data, delay);
1763 writel(reg_data.word0, phba->sli4_hba.u.if_type2.EQDregaddr);
1764 eq->q_mode = delay;
1765 }
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777 #define DECLARE_ENUM2STR_LOOKUP(routine, enum_name, enum_init) \
1778 static struct { \
1779 enum enum_name value; \
1780 char *name; \
1781 } fc_##enum_name##_e2str_names[] = enum_init; \
1782 static const char *routine(enum enum_name table_key) \
1783 { \
1784 int i; \
1785 char *name = "Unrecognized"; \
1786 \
1787 for (i = 0; i < ARRAY_SIZE(fc_##enum_name##_e2str_names); i++) {\
1788 if (fc_##enum_name##_e2str_names[i].value == table_key) {\
1789 name = fc_##enum_name##_e2str_names[i].name; \
1790 break; \
1791 } \
1792 } \
1793 return name; \
1794 }
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815 static inline int lpfc_is_vmid_enabled(struct lpfc_hba *phba)
1816 {
1817 return phba->cfg_vmid_app_header || phba->cfg_vmid_priority_tagging;
1818 }
1819
1820 static inline
1821 u8 get_job_ulpstatus(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1822 {
1823 if (phba->sli_rev == LPFC_SLI_REV4)
1824 return bf_get(lpfc_wcqe_c_status, &iocbq->wcqe_cmpl);
1825 else
1826 return iocbq->iocb.ulpStatus;
1827 }
1828
1829 static inline
1830 u32 get_job_word4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1831 {
1832 if (phba->sli_rev == LPFC_SLI_REV4)
1833 return iocbq->wcqe_cmpl.parameter;
1834 else
1835 return iocbq->iocb.un.ulpWord[4];
1836 }
1837
1838 static inline
1839 u8 get_job_cmnd(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1840 {
1841 if (phba->sli_rev == LPFC_SLI_REV4)
1842 return bf_get(wqe_cmnd, &iocbq->wqe.generic.wqe_com);
1843 else
1844 return iocbq->iocb.ulpCommand;
1845 }
1846
1847 static inline
1848 u16 get_job_ulpcontext(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1849 {
1850 if (phba->sli_rev == LPFC_SLI_REV4)
1851 return bf_get(wqe_ctxt_tag, &iocbq->wqe.generic.wqe_com);
1852 else
1853 return iocbq->iocb.ulpContext;
1854 }
1855
1856 static inline
1857 u16 get_job_rcvoxid(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1858 {
1859 if (phba->sli_rev == LPFC_SLI_REV4)
1860 return bf_get(wqe_rcvoxid, &iocbq->wqe.generic.wqe_com);
1861 else
1862 return iocbq->iocb.unsli3.rcvsli3.ox_id;
1863 }
1864
1865 static inline
1866 u32 get_job_data_placed(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1867 {
1868 if (phba->sli_rev == LPFC_SLI_REV4)
1869 return iocbq->wcqe_cmpl.total_data_placed;
1870 else
1871 return iocbq->iocb.un.genreq64.bdl.bdeSize;
1872 }
1873
1874 static inline
1875 u32 get_job_abtsiotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1876 {
1877 if (phba->sli_rev == LPFC_SLI_REV4)
1878 return iocbq->wqe.abort_cmd.wqe_com.abort_tag;
1879 else
1880 return iocbq->iocb.un.acxri.abortIoTag;
1881 }
1882
1883 static inline
1884 u32 get_job_els_rsp64_did(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1885 {
1886 if (phba->sli_rev == LPFC_SLI_REV4)
1887 return bf_get(wqe_els_did, &iocbq->wqe.els_req.wqe_dest);
1888 else
1889 return iocbq->iocb.un.elsreq64.remoteID;
1890 }