forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/scsi/lpfc/lpfc.h
....@@ -1,7 +1,7 @@
11 /*******************************************************************
22 * This file is part of the Emulex Linux Device Driver for *
33 * Fibre Channel Host Bus Adapters. *
4
- * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
4
+ * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term *
55 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
66 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
77 * EMULEX and SLI are trademarks of Emulex. *
....@@ -51,8 +51,10 @@
5151 cmnd for menlo needs nearly twice as for firmware
5252 downloads using bsg */
5353
54
+#define LPFC_DEFAULT_XPSGL_SIZE 256
55
+#define LPFC_MAX_SG_TABLESIZE 0xffff
5456 #define LPFC_MIN_SG_SLI4_BUF_SZ 0x800 /* based on LPFC_DEFAULT_SG_SEG_CNT */
55
-#define LPFC_MAX_SG_SLI4_SEG_CNT_DIF 128 /* sg element count per scsi cmnd */
57
+#define LPFC_MAX_BG_SLI4_SEG_CNT_DIF 128 /* sg element count for BlockGuard */
5658 #define LPFC_MAX_SG_SEG_CNT_DIF 512 /* sg element count per scsi cmnd */
5759 #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */
5860 #define LPFC_MIN_SG_SEG_CNT 32 /* sg element count per scsi cmnd */
....@@ -83,8 +85,6 @@
8385
8486 #define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */
8587 #define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */
86
-
87
-#define LPFC_LOOK_AHEAD_OFF 0 /* Look ahead logic is turned off */
8888
8989 /* Error Attention event polling interval */
9090 #define LPFC_ERATT_POLL_INTERVAL 5 /* EATT poll interval in seconds */
....@@ -143,9 +143,10 @@
143143
144144 struct lpfc_nvmet_ctxbuf {
145145 struct list_head list;
146
- struct lpfc_nvmet_rcv_ctx *context;
146
+ struct lpfc_async_xchg_ctx *context;
147147 struct lpfc_iocbq *iocbq;
148148 struct lpfc_sglq *sglq;
149
+ struct work_struct defer_work;
149150 };
150151
151152 struct lpfc_dma_pool {
....@@ -206,8 +207,7 @@
206207 } rev;
207208 struct {
208209 #ifdef __BIG_ENDIAN_BITFIELD
209
- uint32_t rsvd3 :19; /* Reserved */
210
- uint32_t cdss : 1; /* Configure Data Security SLI */
210
+ uint32_t rsvd3 :20; /* Reserved */
211211 uint32_t rsvd2 : 3; /* Reserved */
212212 uint32_t cbg : 1; /* Configure BlockGuard */
213213 uint32_t cmv : 1; /* Configure Max VPIs */
....@@ -229,13 +229,10 @@
229229 uint32_t cmv : 1; /* Configure Max VPIs */
230230 uint32_t cbg : 1; /* Configure BlockGuard */
231231 uint32_t rsvd2 : 3; /* Reserved */
232
- uint32_t cdss : 1; /* Configure Data Security SLI */
233
- uint32_t rsvd3 :19; /* Reserved */
232
+ uint32_t rsvd3 :20; /* Reserved */
234233 #endif
235234 } sli3Feat;
236235 } lpfc_vpd_t;
237
-
238
-struct lpfc_scsi_buf;
239236
240237
241238 /*
....@@ -263,7 +260,6 @@
263260 uint32_t elsRcvPRLI;
264261 uint32_t elsRcvLIRR;
265262 uint32_t elsRcvRLS;
266
- uint32_t elsRcvRPS;
267263 uint32_t elsRcvRPL;
268264 uint32_t elsRcvRRQ;
269265 uint32_t elsRcvRTV;
....@@ -277,6 +273,7 @@
277273 uint32_t elsXmitADISC;
278274 uint32_t elsXmitLOGO;
279275 uint32_t elsXmitSCR;
276
+ uint32_t elsXmitRSCN;
280277 uint32_t elsXmitRNID;
281278 uint32_t elsXmitFARP;
282279 uint32_t elsXmitFARPR;
....@@ -335,6 +332,18 @@
335332 LPFC_HBA_ERROR = -1
336333 };
337334
335
+struct lpfc_trunk_link_state {
336
+ enum hba_state state;
337
+ uint8_t fault;
338
+};
339
+
340
+struct lpfc_trunk_link {
341
+ struct lpfc_trunk_link_state link0,
342
+ link1,
343
+ link2,
344
+ link3;
345
+};
346
+
338347 struct lpfc_vport {
339348 struct lpfc_hba *phba;
340349 struct list_head listentry;
....@@ -365,6 +374,7 @@
365374 #define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */
366375 #define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */
367376 #define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/
377
+#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */
368378 #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
369379 #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
370380 #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
....@@ -454,6 +464,7 @@
454464 uint32_t cfg_use_adisc;
455465 uint32_t cfg_discovery_threads;
456466 uint32_t cfg_log_verbose;
467
+ uint32_t cfg_enable_fc4_type;
457468 uint32_t cfg_max_luns;
458469 uint32_t cfg_enable_da_id;
459470 uint32_t cfg_max_scsicmpl_time;
....@@ -467,8 +478,9 @@
467478 struct dentry *debug_disc_trc;
468479 struct dentry *debug_nodelist;
469480 struct dentry *debug_nvmestat;
470
- struct dentry *debug_nvmektime;
471
- struct dentry *debug_cpucheck;
481
+ struct dentry *debug_scsistat;
482
+ struct dentry *debug_ioktime;
483
+ struct dentry *debug_hdwqstat;
472484 struct dentry *vport_debugfs_root;
473485 struct lpfc_debugfs_trc *disc_trc;
474486 atomic_t disc_trc_cnt;
....@@ -584,22 +596,74 @@
584596 struct list_head ext_dmabuf_list;
585597 };
586598
599
+struct lpfc_epd_pool {
600
+ /* Expedite pool */
601
+ struct list_head list;
602
+ u32 count;
603
+ spinlock_t lock; /* lock for expedite pool */
604
+};
605
+
606
+enum ras_state {
607
+ INACTIVE,
608
+ REG_INPROGRESS,
609
+ ACTIVE
610
+};
611
+
612
+struct lpfc_ras_fwlog {
613
+ uint8_t *fwlog_buff;
614
+ uint32_t fw_buffcount; /* Buffer size posted to FW */
615
+#define LPFC_RAS_BUFF_ENTERIES 16 /* Each entry can hold max of 64k */
616
+#define LPFC_RAS_MAX_ENTRY_SIZE (64 * 1024)
617
+#define LPFC_RAS_MIN_BUFF_POST_SIZE (256 * 1024)
618
+#define LPFC_RAS_MAX_BUFF_POST_SIZE (1024 * 1024)
619
+ uint32_t fw_loglevel; /* Log level set */
620
+ struct lpfc_dmabuf lwpd;
621
+ struct list_head fwlog_buff_list;
622
+
623
+ /* RAS support status on adapter */
624
+ bool ras_hwsupport; /* RAS Support available on HW or not */
625
+ bool ras_enabled; /* Ras Enabled for the function */
626
+#define LPFC_RAS_DISABLE_LOGGING 0x00
627
+#define LPFC_RAS_ENABLE_LOGGING 0x01
628
+ enum ras_state state; /* RAS logging running state */
629
+};
630
+
631
+#define DBG_LOG_STR_SZ 256
632
+#define DBG_LOG_SZ 256
633
+
634
+struct dbg_log_ent {
635
+ char log[DBG_LOG_STR_SZ];
636
+ u64 t_ns;
637
+};
638
+
639
+enum lpfc_irq_chann_mode {
640
+ /* Assign IRQs to all possible cpus that have hardware queues */
641
+ NORMAL_MODE,
642
+
643
+ /* Assign IRQs only to cpus on the same numa node as HBA */
644
+ NUMA_MODE,
645
+
646
+ /* Assign IRQs only on non-hyperthreaded CPUs. This is the
647
+ * same as normal_mode, but assign IRQS only on physical CPUs.
648
+ */
649
+ NHT_MODE,
650
+};
651
+
587652 struct lpfc_hba {
588653 /* SCSI interface function jump table entries */
589
- int (*lpfc_new_scsi_buf)
590
- (struct lpfc_vport *, int);
591
- struct lpfc_scsi_buf * (*lpfc_get_scsi_buf)
592
- (struct lpfc_hba *, struct lpfc_nodelist *);
654
+ struct lpfc_io_buf * (*lpfc_get_scsi_buf)
655
+ (struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
656
+ struct scsi_cmnd *cmnd);
593657 int (*lpfc_scsi_prep_dma_buf)
594
- (struct lpfc_hba *, struct lpfc_scsi_buf *);
658
+ (struct lpfc_hba *, struct lpfc_io_buf *);
595659 void (*lpfc_scsi_unprep_dma_buf)
596
- (struct lpfc_hba *, struct lpfc_scsi_buf *);
660
+ (struct lpfc_hba *, struct lpfc_io_buf *);
597661 void (*lpfc_release_scsi_buf)
598
- (struct lpfc_hba *, struct lpfc_scsi_buf *);
662
+ (struct lpfc_hba *, struct lpfc_io_buf *);
599663 void (*lpfc_rampdown_queue_depth)
600664 (struct lpfc_hba *);
601665 void (*lpfc_scsi_prep_cmnd)
602
- (struct lpfc_vport *, struct lpfc_scsi_buf *,
666
+ (struct lpfc_vport *, struct lpfc_io_buf *,
603667 struct lpfc_nodelist *);
604668
605669 /* IOCB interface function jump table entries */
....@@ -642,13 +706,20 @@
642706 (struct lpfc_hba *);
643707
644708 int (*lpfc_bg_scsi_prep_dma_buf)
645
- (struct lpfc_hba *, struct lpfc_scsi_buf *);
709
+ (struct lpfc_hba *, struct lpfc_io_buf *);
646710 /* Add new entries here */
711
+
712
+ /* expedite pool */
713
+ struct lpfc_epd_pool epd_pool;
647714
648715 /* SLI4 specific HBA data structure */
649716 struct lpfc_sli4_hba sli4_hba;
650717
651718 struct workqueue_struct *wq;
719
+ struct delayed_work eq_delay_work;
720
+
721
+#define LPFC_IDLE_STAT_DELAY 1000
722
+ struct delayed_work idle_stat_delay_work;
652723
653724 struct lpfc_sli sli;
654725 uint8_t pci_dev_grp; /* lpfc PCI dev group: 0x0, 0x1, 0x2,... */
....@@ -665,6 +736,7 @@
665736 uint32_t iocb_cmd_size;
666737 uint32_t iocb_rsp_size;
667738
739
+ struct lpfc_trunk_link trunk_link;
668740 enum hba_state link_state;
669741 uint32_t link_flag; /* link state flags */
670742 #define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */
....@@ -681,8 +753,8 @@
681753 #define HBA_FCOE_MODE 0x4 /* HBA function in FCoE Mode */
682754 #define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/
683755 #define HBA_POST_RECEIVE_BUFFER 0x10 /* Rcv buffers need to be posted */
684
-#define FCP_XRI_ABORT_EVENT 0x20
685
-#define ELS_XRI_ABORT_EVENT 0x40
756
+#define HBA_PERSISTENT_TOPO 0x20 /* Persistent topology support in hba */
757
+#define ELS_XRI_ABORT_EVENT 0x40 /* ELS_XRI abort event was queued */
686758 #define ASYNC_EVENT 0x80
687759 #define LINK_DISABLED 0x100 /* Link disabled by user */
688760 #define FCF_TS_INPROG 0x200 /* FCF table scan in progress */
....@@ -691,15 +763,16 @@
691763 #define HBA_AER_ENABLED 0x1000 /* AER enabled with HBA */
692764 #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */
693765 #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */
694
-#define HBA_FCP_IOQ_FLUSH 0x8000 /* FCP I/O queues being flushed */
695
-#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */
766
+#define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */
696767 #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */
697768 #define HBA_FORCED_LINK_SPEED 0x40000 /*
698769 * Firmware supports Forced Link Speed
699770 * capability
700771 */
701
-#define HBA_NVME_IOQ_FLUSH 0x80000 /* NVME IO queues flushed. */
772
+#define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */
773
+#define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */
702774
775
+ struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */
703776 uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/
704777 struct lpfc_dmabuf slim2p;
705778
....@@ -751,12 +824,14 @@
751824 uint8_t nvmet_support; /* driver supports NVMET */
752825 #define LPFC_NVMET_MAX_PORTS 32
753826 uint8_t mds_diags_support;
754
- uint32_t initial_imax;
755827 uint8_t bbcredit_support;
756828 uint8_t enab_exp_wqcq_pages;
829
+ u8 nsler; /* Firmware supports FC-NVMe-2 SLER */
757830
758831 /* HBA Config Parameters */
759832 uint32_t cfg_ack0;
833
+ uint32_t cfg_xri_rebalancing;
834
+ uint32_t cfg_xpsgl;
760835 uint32_t cfg_enable_npiv;
761836 uint32_t cfg_enable_rrq;
762837 uint32_t cfg_topology;
....@@ -765,6 +840,7 @@
765840 #define LPFC_FCF_PRIORITY 2 /* Priority fcf failover */
766841 uint32_t cfg_fcf_failover_policy;
767842 uint32_t cfg_fcp_io_sched;
843
+ uint32_t cfg_ns_query;
768844 uint32_t cfg_fcp2_no_tgt_reset;
769845 uint32_t cfg_cr_delay;
770846 uint32_t cfg_cr_count;
....@@ -777,12 +853,16 @@
777853 uint32_t cfg_use_msi;
778854 uint32_t cfg_auto_imax;
779855 uint32_t cfg_fcp_imax;
856
+ uint32_t cfg_force_rscn;
857
+ uint32_t cfg_cq_poll_threshold;
858
+ uint32_t cfg_cq_max_proc_limit;
780859 uint32_t cfg_fcp_cpu_map;
781
- uint32_t cfg_fcp_io_channel;
860
+ uint32_t cfg_fcp_mq_threshold;
861
+ uint32_t cfg_hdw_queue;
862
+ uint32_t cfg_irq_chann;
782863 uint32_t cfg_suppress_rsp;
783864 uint32_t cfg_nvme_oas;
784865 uint32_t cfg_nvme_embed_cmd;
785
- uint32_t cfg_nvme_io_channel;
786866 uint32_t cfg_nvmet_mrq_post;
787867 uint32_t cfg_nvmet_mrq;
788868 uint32_t cfg_enable_nvmet;
....@@ -791,6 +871,7 @@
791871 uint32_t cfg_total_seg_cnt;
792872 uint32_t cfg_sg_seg_cnt;
793873 uint32_t cfg_nvme_seg_cnt;
874
+ uint32_t cfg_scsi_seg_cnt;
794875 uint32_t cfg_sg_dma_buf_size;
795876 uint64_t cfg_soft_wwnn;
796877 uint64_t cfg_soft_wwpn;
....@@ -817,10 +898,20 @@
817898 uint32_t cfg_prot_guard;
818899 uint32_t cfg_hostmem_hgp;
819900 uint32_t cfg_log_verbose;
901
+ uint32_t cfg_enable_fc4_type;
902
+#define LPFC_ENABLE_FCP 1
903
+#define LPFC_ENABLE_NVME 2
904
+#define LPFC_ENABLE_BOTH 3
905
+#if (IS_ENABLED(CONFIG_NVME_FC))
906
+#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_BOTH
907
+#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_BOTH
908
+#else
909
+#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_FCP
910
+#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_FCP
911
+#endif
820912 uint32_t cfg_aer_support;
821913 uint32_t cfg_sriov_nr_virtfn;
822914 uint32_t cfg_request_firmware_upgrade;
823
- uint32_t cfg_iocb_cnt;
824915 uint32_t cfg_suppress_link_up;
825916 uint32_t cfg_rrq_xri_bitmap_sz;
826917 uint32_t cfg_delay_discovery;
....@@ -828,21 +919,17 @@
828919 #define LPFC_INITIALIZE_LINK 0 /* do normal init_link mbox */
829920 #define LPFC_DELAY_INIT_LINK 1 /* layered driver hold off */
830921 #define LPFC_DELAY_INIT_LINK_INDEFINITELY 2 /* wait, manual intervention */
831
- uint32_t cfg_enable_dss;
832922 uint32_t cfg_fdmi_on;
833923 #define LPFC_FDMI_NO_SUPPORT 0 /* FDMI not supported */
834924 #define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */
835925 uint32_t cfg_enable_SmartSAN;
836926 uint32_t cfg_enable_mds_diags;
837
- uint32_t cfg_enable_fc4_type;
927
+ uint32_t cfg_ras_fwlog_level;
928
+ uint32_t cfg_ras_fwlog_buffsize;
929
+ uint32_t cfg_ras_fwlog_func;
838930 uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */
839931 uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */
840
- uint32_t cfg_xri_split;
841
-#define LPFC_ENABLE_FCP 1
842
-#define LPFC_ENABLE_NVME 2
843
-#define LPFC_ENABLE_BOTH 3
844932 uint32_t cfg_enable_pbde;
845
- uint32_t io_channel_irqs; /* number of irqs for io channels */
846933 struct nvmet_fc_target_port *targetport;
847934 lpfc_vpd_t vpd; /* vital product data */
848935
....@@ -856,6 +943,7 @@
856943 wait_queue_head_t work_waitq;
857944 struct task_struct *worker_thread;
858945 unsigned long data_flags;
946
+ uint32_t border_sge_num;
859947
860948 uint32_t hbq_in_use; /* HBQs in use flag */
861949 uint32_t hbq_count; /* Count of configured HBQs */
....@@ -896,6 +984,7 @@
896984 int brd_no; /* FC board number */
897985 char SerialNumber[32]; /* adapter Serial Number */
898986 char OptionROMVersion[32]; /* adapter BIOS / Fcode version */
987
+ char BIOSVersion[16]; /* Boot BIOS version */
899988 char ModelDesc[256]; /* Model Description */
900989 char ModelName[80]; /* Model Name */
901990 char ProgramType[256]; /* Program Type */
....@@ -914,14 +1003,6 @@
9141003 struct timer_list eratt_poll;
9151004 uint32_t eratt_poll_interval;
9161005
917
- /*
918
- * stat counters
919
- */
920
- atomic_t fc4ScsiInputRequests;
921
- atomic_t fc4ScsiOutputRequests;
922
- atomic_t fc4ScsiControlRequests;
923
- atomic_t fc4ScsiIoCmpls;
924
-
9251006 uint64_t bg_guard_err_cnt;
9261007 uint64_t bg_apptag_err_cnt;
9271008 uint64_t bg_reftag_err_cnt;
....@@ -932,13 +1013,6 @@
9321013 struct list_head lpfc_scsi_buf_list_get;
9331014 struct list_head lpfc_scsi_buf_list_put;
9341015 uint32_t total_scsi_bufs;
935
- spinlock_t nvme_buf_list_get_lock; /* NVME buf alloc list lock */
936
- spinlock_t nvme_buf_list_put_lock; /* NVME buf free list lock */
937
- struct list_head lpfc_nvme_buf_list_get;
938
- struct list_head lpfc_nvme_buf_list_put;
939
- uint32_t total_nvme_bufs;
940
- uint32_t get_nvme_bufs;
941
- uint32_t put_nvme_bufs;
9421016 struct list_head lpfc_iocb_list;
9431017 uint32_t total_iocbq_bufs;
9441018 struct list_head active_rrq_list;
....@@ -951,7 +1025,7 @@
9511025 struct dma_pool *lpfc_drb_pool; /* data receive buffer pool */
9521026 struct dma_pool *lpfc_nvmet_drb_pool; /* data receive buffer pool */
9531027 struct dma_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */
954
- struct dma_pool *txrdy_payload_pool;
1028
+ struct dma_pool *lpfc_cmd_rsp_buf_pool;
9551029 struct lpfc_dma_pool lpfc_mbuf_safety_pool;
9561030
9571031 mempool_t *mbox_mem_pool;
....@@ -960,10 +1034,12 @@
9601034 mempool_t *active_rrq_pool;
9611035
9621036 struct fc_host_statistics link_stats;
1037
+ enum lpfc_irq_chann_mode irq_chann_mode;
9631038 enum intr_type_t intr_type;
9641039 uint32_t intr_mode;
9651040 #define LPFC_INTR_ERROR 0xFFFFFFFF
9661041 struct list_head port_list;
1042
+ spinlock_t port_list_lock; /* lock for port_list mutations */
9671043 struct lpfc_vport *pport; /* physical lpfc_vport pointer */
9681044 uint16_t max_vpi; /* Maximum virtual nports */
9691045 #define LPFC_MAX_VPI 0xFF /* Max number VPI supported 0 - 0xff */
....@@ -994,11 +1070,10 @@
9941070 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
9951071 struct dentry *hba_debugfs_root;
9961072 atomic_t debugfs_vport_count;
1073
+ struct dentry *debug_multixri_pools;
9971074 struct dentry *debug_hbqinfo;
9981075 struct dentry *debug_dumpHostSlim;
9991076 struct dentry *debug_dumpHBASlim;
1000
- struct dentry *debug_dumpData; /* BlockGuard BPL */
1001
- struct dentry *debug_dumpDif; /* BlockGuard BPL */
10021077 struct dentry *debug_InjErrLBA; /* LBA to inject errors at */
10031078 struct dentry *debug_InjErrNPortID; /* NPortID to inject errors at */
10041079 struct dentry *debug_InjErrWWPN; /* WWPN to inject errors at */
....@@ -1011,6 +1086,11 @@
10111086
10121087 struct dentry *debug_nvmeio_trc;
10131088 struct lpfc_debugfs_nvmeio_trc *nvmeio_trc;
1089
+ struct dentry *debug_hdwqinfo;
1090
+#ifdef LPFC_HDWQ_LOCK_STAT
1091
+ struct dentry *debug_lockstat;
1092
+#endif
1093
+ struct dentry *debug_ras_log;
10141094 atomic_t nvmeio_trc_cnt;
10151095 uint32_t nvmeio_trc_size;
10161096 uint32_t nvmeio_trc_output_idx;
....@@ -1051,7 +1131,6 @@
10511131
10521132 uint8_t temp_sensor_support;
10531133 /* Fields used for heart beat. */
1054
- unsigned long last_eqdelay_time;
10551134 unsigned long last_completion_time;
10561135 unsigned long skipped_hb;
10571136 struct timer_list hb_tmofunc;
....@@ -1089,18 +1168,23 @@
10891168 uint16_t vlan_id;
10901169 struct list_head fcf_conn_rec_list;
10911170
1171
+ bool defer_flogi_acc_flag;
1172
+ uint16_t defer_flogi_acc_rx_id;
1173
+ uint16_t defer_flogi_acc_ox_id;
1174
+
10921175 spinlock_t ct_ev_lock; /* synchronize access to ct_ev_waiters */
10931176 struct list_head ct_ev_waiters;
10941177 struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX];
10951178 uint32_t ctx_idx;
1179
+
1180
+ /* RAS Support */
1181
+ struct lpfc_ras_fwlog ras_fwlog;
10961182
10971183 uint8_t menlo_flag; /* menlo generic flags */
10981184 #define HBA_MENLO_SUPPORT 0x1 /* HBA supports menlo commands */
10991185 uint32_t iocb_cnt;
11001186 uint32_t iocb_max;
11011187 atomic_t sdev_cnt;
1102
- uint8_t fips_spec_rev;
1103
- uint8_t fips_level;
11041188 spinlock_t devicelock; /* lock for luns list */
11051189 mempool_t *device_data_mem_pool;
11061190 struct list_head luns;
....@@ -1118,16 +1202,11 @@
11181202 uint16_t sfp_warning;
11191203
11201204 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1121
-#define LPFC_CHECK_CPU_CNT 32
1122
- uint32_t cpucheck_rcv_io[LPFC_CHECK_CPU_CNT];
1123
- uint32_t cpucheck_xmt_io[LPFC_CHECK_CPU_CNT];
1124
- uint32_t cpucheck_cmpl_io[LPFC_CHECK_CPU_CNT];
1125
- uint32_t cpucheck_ccmpl_io[LPFC_CHECK_CPU_CNT];
1126
- uint16_t cpucheck_on;
1205
+ uint16_t hdwqstat_on;
11271206 #define LPFC_CHECK_OFF 0
11281207 #define LPFC_CHECK_NVME_IO 1
1129
-#define LPFC_CHECK_NVMET_RCV 2
1130
-#define LPFC_CHECK_NVMET_IO 4
1208
+#define LPFC_CHECK_NVMET_IO 2
1209
+#define LPFC_CHECK_SCSI_IO 4
11311210 uint16_t ktime_on;
11321211 uint64_t ktime_data_samples;
11331212 uint64_t ktime_status_samples;
....@@ -1163,6 +1242,24 @@
11631242 uint64_t ktime_seg10_min;
11641243 uint64_t ktime_seg10_max;
11651244 #endif
1245
+
1246
+ struct hlist_node cpuhp; /* used for cpuhp per hba callback */
1247
+ struct timer_list cpuhp_poll_timer;
1248
+ struct list_head poll_list; /* slowpath eq polling list */
1249
+#define LPFC_POLL_HB 1 /* slowpath heartbeat */
1250
+#define LPFC_POLL_FASTPATH 0 /* called from fastpath */
1251
+#define LPFC_POLL_SLOWPATH 1 /* called from slowpath */
1252
+
1253
+ char os_host_name[MAXHOSTNAMELEN];
1254
+
1255
+ /* SCSI host template information - for physical port */
1256
+ struct scsi_host_template port_template;
1257
+ /* SCSI host template information - for all vports */
1258
+ struct scsi_host_template vport_template;
1259
+ atomic_t dbg_log_idx;
1260
+ atomic_t dbg_log_cnt;
1261
+ atomic_t dbg_log_dmping;
1262
+ struct dbg_log_ent dbg_log[DBG_LOG_SZ];
11661263 };
11671264
11681265 static inline struct Scsi_Host *
....@@ -1251,3 +1348,72 @@
12511348 }
12521349 return &phba->sli.sli3_ring[LPFC_ELS_RING];
12531350 }
1351
+
1352
+/**
1353
+ * lpfc_next_online_cpu - Finds next online CPU on cpumask
1354
+ * @mask: Pointer to phba's cpumask member.
1355
+ * @start: starting cpu index
1356
+ *
1357
+ * Note: If no valid cpu found, then nr_cpu_ids is returned.
1358
+ *
1359
+ **/
1360
+static inline unsigned int
1361
+lpfc_next_online_cpu(const struct cpumask *mask, unsigned int start)
1362
+{
1363
+ unsigned int cpu_it;
1364
+
1365
+ for_each_cpu_wrap(cpu_it, mask, start) {
1366
+ if (cpu_online(cpu_it))
1367
+ break;
1368
+ }
1369
+
1370
+ return cpu_it;
1371
+}
1372
+/**
1373
+ * lpfc_sli4_mod_hba_eq_delay - update EQ delay
1374
+ * @phba: Pointer to HBA context object.
1375
+ * @q: The Event Queue to update.
1376
+ * @delay: The delay value (in us) to be written.
1377
+ *
1378
+ **/
1379
+static inline void
1380
+lpfc_sli4_mod_hba_eq_delay(struct lpfc_hba *phba, struct lpfc_queue *eq,
1381
+ u32 delay)
1382
+{
1383
+ struct lpfc_register reg_data;
1384
+
1385
+ reg_data.word0 = 0;
1386
+ bf_set(lpfc_sliport_eqdelay_id, &reg_data, eq->queue_id);
1387
+ bf_set(lpfc_sliport_eqdelay_delay, &reg_data, delay);
1388
+ writel(reg_data.word0, phba->sli4_hba.u.if_type2.EQDregaddr);
1389
+ eq->q_mode = delay;
1390
+}
1391
+
1392
+
1393
+/*
1394
+ * Macro that declares tables and a routine to perform enum type to
1395
+ * ascii string lookup.
1396
+ *
1397
+ * Defines a <key,value> table for an enum. Uses xxx_INIT defines for
1398
+ * the enum to populate the table. Macro defines a routine (named
1399
+ * by caller) that will search all elements of the table for the key
1400
+ * and return the name string if found or "Unrecognized" if not found.
1401
+ */
1402
+#define DECLARE_ENUM2STR_LOOKUP(routine, enum_name, enum_init) \
1403
+static struct { \
1404
+ enum enum_name value; \
1405
+ char *name; \
1406
+} fc_##enum_name##_e2str_names[] = enum_init; \
1407
+static const char *routine(enum enum_name table_key) \
1408
+{ \
1409
+ int i; \
1410
+ char *name = "Unrecognized"; \
1411
+ \
1412
+ for (i = 0; i < ARRAY_SIZE(fc_##enum_name##_e2str_names); i++) {\
1413
+ if (fc_##enum_name##_e2str_names[i].value == table_key) {\
1414
+ name = fc_##enum_name##_e2str_names[i].name; \
1415
+ break; \
1416
+ } \
1417
+ } \
1418
+ return name; \
1419
+}