| .. | .. |
|---|
| 1 | 1 | /******************************************************************* |
|---|
| 2 | 2 | * This file is part of the Emulex Linux Device Driver for * |
|---|
| 3 | 3 | * 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 * |
|---|
| 5 | 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * |
|---|
| 6 | 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * |
|---|
| 7 | 7 | * EMULEX and SLI are trademarks of Emulex. * |
|---|
| .. | .. |
|---|
| 51 | 51 | cmnd for menlo needs nearly twice as for firmware |
|---|
| 52 | 52 | downloads using bsg */ |
|---|
| 53 | 53 | |
|---|
| 54 | +#define LPFC_DEFAULT_XPSGL_SIZE 256 |
|---|
| 55 | +#define LPFC_MAX_SG_TABLESIZE 0xffff |
|---|
| 54 | 56 | #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 */ |
|---|
| 56 | 58 | #define LPFC_MAX_SG_SEG_CNT_DIF 512 /* sg element count per scsi cmnd */ |
|---|
| 57 | 59 | #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */ |
|---|
| 58 | 60 | #define LPFC_MIN_SG_SEG_CNT 32 /* sg element count per scsi cmnd */ |
|---|
| .. | .. |
|---|
| 83 | 85 | |
|---|
| 84 | 86 | #define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */ |
|---|
| 85 | 87 | #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 */ |
|---|
| 88 | 88 | |
|---|
| 89 | 89 | /* Error Attention event polling interval */ |
|---|
| 90 | 90 | #define LPFC_ERATT_POLL_INTERVAL 5 /* EATT poll interval in seconds */ |
|---|
| .. | .. |
|---|
| 143 | 143 | |
|---|
| 144 | 144 | struct lpfc_nvmet_ctxbuf { |
|---|
| 145 | 145 | struct list_head list; |
|---|
| 146 | | - struct lpfc_nvmet_rcv_ctx *context; |
|---|
| 146 | + struct lpfc_async_xchg_ctx *context; |
|---|
| 147 | 147 | struct lpfc_iocbq *iocbq; |
|---|
| 148 | 148 | struct lpfc_sglq *sglq; |
|---|
| 149 | + struct work_struct defer_work; |
|---|
| 149 | 150 | }; |
|---|
| 150 | 151 | |
|---|
| 151 | 152 | struct lpfc_dma_pool { |
|---|
| .. | .. |
|---|
| 206 | 207 | } rev; |
|---|
| 207 | 208 | struct { |
|---|
| 208 | 209 | #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 */ |
|---|
| 211 | 211 | uint32_t rsvd2 : 3; /* Reserved */ |
|---|
| 212 | 212 | uint32_t cbg : 1; /* Configure BlockGuard */ |
|---|
| 213 | 213 | uint32_t cmv : 1; /* Configure Max VPIs */ |
|---|
| .. | .. |
|---|
| 229 | 229 | uint32_t cmv : 1; /* Configure Max VPIs */ |
|---|
| 230 | 230 | uint32_t cbg : 1; /* Configure BlockGuard */ |
|---|
| 231 | 231 | 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 */ |
|---|
| 234 | 233 | #endif |
|---|
| 235 | 234 | } sli3Feat; |
|---|
| 236 | 235 | } lpfc_vpd_t; |
|---|
| 237 | | - |
|---|
| 238 | | -struct lpfc_scsi_buf; |
|---|
| 239 | 236 | |
|---|
| 240 | 237 | |
|---|
| 241 | 238 | /* |
|---|
| .. | .. |
|---|
| 263 | 260 | uint32_t elsRcvPRLI; |
|---|
| 264 | 261 | uint32_t elsRcvLIRR; |
|---|
| 265 | 262 | uint32_t elsRcvRLS; |
|---|
| 266 | | - uint32_t elsRcvRPS; |
|---|
| 267 | 263 | uint32_t elsRcvRPL; |
|---|
| 268 | 264 | uint32_t elsRcvRRQ; |
|---|
| 269 | 265 | uint32_t elsRcvRTV; |
|---|
| .. | .. |
|---|
| 277 | 273 | uint32_t elsXmitADISC; |
|---|
| 278 | 274 | uint32_t elsXmitLOGO; |
|---|
| 279 | 275 | uint32_t elsXmitSCR; |
|---|
| 276 | + uint32_t elsXmitRSCN; |
|---|
| 280 | 277 | uint32_t elsXmitRNID; |
|---|
| 281 | 278 | uint32_t elsXmitFARP; |
|---|
| 282 | 279 | uint32_t elsXmitFARPR; |
|---|
| .. | .. |
|---|
| 335 | 332 | LPFC_HBA_ERROR = -1 |
|---|
| 336 | 333 | }; |
|---|
| 337 | 334 | |
|---|
| 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 | + |
|---|
| 338 | 347 | struct lpfc_vport { |
|---|
| 339 | 348 | struct lpfc_hba *phba; |
|---|
| 340 | 349 | struct list_head listentry; |
|---|
| .. | .. |
|---|
| 365 | 374 | #define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */ |
|---|
| 366 | 375 | #define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */ |
|---|
| 367 | 376 | #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 */ |
|---|
| 368 | 378 | #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */ |
|---|
| 369 | 379 | #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */ |
|---|
| 370 | 380 | #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */ |
|---|
| .. | .. |
|---|
| 454 | 464 | uint32_t cfg_use_adisc; |
|---|
| 455 | 465 | uint32_t cfg_discovery_threads; |
|---|
| 456 | 466 | uint32_t cfg_log_verbose; |
|---|
| 467 | + uint32_t cfg_enable_fc4_type; |
|---|
| 457 | 468 | uint32_t cfg_max_luns; |
|---|
| 458 | 469 | uint32_t cfg_enable_da_id; |
|---|
| 459 | 470 | uint32_t cfg_max_scsicmpl_time; |
|---|
| .. | .. |
|---|
| 467 | 478 | struct dentry *debug_disc_trc; |
|---|
| 468 | 479 | struct dentry *debug_nodelist; |
|---|
| 469 | 480 | 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; |
|---|
| 472 | 484 | struct dentry *vport_debugfs_root; |
|---|
| 473 | 485 | struct lpfc_debugfs_trc *disc_trc; |
|---|
| 474 | 486 | atomic_t disc_trc_cnt; |
|---|
| .. | .. |
|---|
| 584 | 596 | struct list_head ext_dmabuf_list; |
|---|
| 585 | 597 | }; |
|---|
| 586 | 598 | |
|---|
| 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 | + |
|---|
| 587 | 652 | struct lpfc_hba { |
|---|
| 588 | 653 | /* 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); |
|---|
| 593 | 657 | int (*lpfc_scsi_prep_dma_buf) |
|---|
| 594 | | - (struct lpfc_hba *, struct lpfc_scsi_buf *); |
|---|
| 658 | + (struct lpfc_hba *, struct lpfc_io_buf *); |
|---|
| 595 | 659 | void (*lpfc_scsi_unprep_dma_buf) |
|---|
| 596 | | - (struct lpfc_hba *, struct lpfc_scsi_buf *); |
|---|
| 660 | + (struct lpfc_hba *, struct lpfc_io_buf *); |
|---|
| 597 | 661 | void (*lpfc_release_scsi_buf) |
|---|
| 598 | | - (struct lpfc_hba *, struct lpfc_scsi_buf *); |
|---|
| 662 | + (struct lpfc_hba *, struct lpfc_io_buf *); |
|---|
| 599 | 663 | void (*lpfc_rampdown_queue_depth) |
|---|
| 600 | 664 | (struct lpfc_hba *); |
|---|
| 601 | 665 | void (*lpfc_scsi_prep_cmnd) |
|---|
| 602 | | - (struct lpfc_vport *, struct lpfc_scsi_buf *, |
|---|
| 666 | + (struct lpfc_vport *, struct lpfc_io_buf *, |
|---|
| 603 | 667 | struct lpfc_nodelist *); |
|---|
| 604 | 668 | |
|---|
| 605 | 669 | /* IOCB interface function jump table entries */ |
|---|
| .. | .. |
|---|
| 642 | 706 | (struct lpfc_hba *); |
|---|
| 643 | 707 | |
|---|
| 644 | 708 | int (*lpfc_bg_scsi_prep_dma_buf) |
|---|
| 645 | | - (struct lpfc_hba *, struct lpfc_scsi_buf *); |
|---|
| 709 | + (struct lpfc_hba *, struct lpfc_io_buf *); |
|---|
| 646 | 710 | /* Add new entries here */ |
|---|
| 711 | + |
|---|
| 712 | + /* expedite pool */ |
|---|
| 713 | + struct lpfc_epd_pool epd_pool; |
|---|
| 647 | 714 | |
|---|
| 648 | 715 | /* SLI4 specific HBA data structure */ |
|---|
| 649 | 716 | struct lpfc_sli4_hba sli4_hba; |
|---|
| 650 | 717 | |
|---|
| 651 | 718 | 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; |
|---|
| 652 | 723 | |
|---|
| 653 | 724 | struct lpfc_sli sli; |
|---|
| 654 | 725 | uint8_t pci_dev_grp; /* lpfc PCI dev group: 0x0, 0x1, 0x2,... */ |
|---|
| .. | .. |
|---|
| 665 | 736 | uint32_t iocb_cmd_size; |
|---|
| 666 | 737 | uint32_t iocb_rsp_size; |
|---|
| 667 | 738 | |
|---|
| 739 | + struct lpfc_trunk_link trunk_link; |
|---|
| 668 | 740 | enum hba_state link_state; |
|---|
| 669 | 741 | uint32_t link_flag; /* link state flags */ |
|---|
| 670 | 742 | #define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */ |
|---|
| .. | .. |
|---|
| 681 | 753 | #define HBA_FCOE_MODE 0x4 /* HBA function in FCoE Mode */ |
|---|
| 682 | 754 | #define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/ |
|---|
| 683 | 755 | #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 */ |
|---|
| 686 | 758 | #define ASYNC_EVENT 0x80 |
|---|
| 687 | 759 | #define LINK_DISABLED 0x100 /* Link disabled by user */ |
|---|
| 688 | 760 | #define FCF_TS_INPROG 0x200 /* FCF table scan in progress */ |
|---|
| .. | .. |
|---|
| 691 | 763 | #define HBA_AER_ENABLED 0x1000 /* AER enabled with HBA */ |
|---|
| 692 | 764 | #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ |
|---|
| 693 | 765 | #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 */ |
|---|
| 696 | 767 | #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ |
|---|
| 697 | 768 | #define HBA_FORCED_LINK_SPEED 0x40000 /* |
|---|
| 698 | 769 | * Firmware supports Forced Link Speed |
|---|
| 699 | 770 | * capability |
|---|
| 700 | 771 | */ |
|---|
| 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 */ |
|---|
| 702 | 774 | |
|---|
| 775 | + struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ |
|---|
| 703 | 776 | uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ |
|---|
| 704 | 777 | struct lpfc_dmabuf slim2p; |
|---|
| 705 | 778 | |
|---|
| .. | .. |
|---|
| 751 | 824 | uint8_t nvmet_support; /* driver supports NVMET */ |
|---|
| 752 | 825 | #define LPFC_NVMET_MAX_PORTS 32 |
|---|
| 753 | 826 | uint8_t mds_diags_support; |
|---|
| 754 | | - uint32_t initial_imax; |
|---|
| 755 | 827 | uint8_t bbcredit_support; |
|---|
| 756 | 828 | uint8_t enab_exp_wqcq_pages; |
|---|
| 829 | + u8 nsler; /* Firmware supports FC-NVMe-2 SLER */ |
|---|
| 757 | 830 | |
|---|
| 758 | 831 | /* HBA Config Parameters */ |
|---|
| 759 | 832 | uint32_t cfg_ack0; |
|---|
| 833 | + uint32_t cfg_xri_rebalancing; |
|---|
| 834 | + uint32_t cfg_xpsgl; |
|---|
| 760 | 835 | uint32_t cfg_enable_npiv; |
|---|
| 761 | 836 | uint32_t cfg_enable_rrq; |
|---|
| 762 | 837 | uint32_t cfg_topology; |
|---|
| .. | .. |
|---|
| 765 | 840 | #define LPFC_FCF_PRIORITY 2 /* Priority fcf failover */ |
|---|
| 766 | 841 | uint32_t cfg_fcf_failover_policy; |
|---|
| 767 | 842 | uint32_t cfg_fcp_io_sched; |
|---|
| 843 | + uint32_t cfg_ns_query; |
|---|
| 768 | 844 | uint32_t cfg_fcp2_no_tgt_reset; |
|---|
| 769 | 845 | uint32_t cfg_cr_delay; |
|---|
| 770 | 846 | uint32_t cfg_cr_count; |
|---|
| .. | .. |
|---|
| 777 | 853 | uint32_t cfg_use_msi; |
|---|
| 778 | 854 | uint32_t cfg_auto_imax; |
|---|
| 779 | 855 | 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; |
|---|
| 780 | 859 | 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; |
|---|
| 782 | 863 | uint32_t cfg_suppress_rsp; |
|---|
| 783 | 864 | uint32_t cfg_nvme_oas; |
|---|
| 784 | 865 | uint32_t cfg_nvme_embed_cmd; |
|---|
| 785 | | - uint32_t cfg_nvme_io_channel; |
|---|
| 786 | 866 | uint32_t cfg_nvmet_mrq_post; |
|---|
| 787 | 867 | uint32_t cfg_nvmet_mrq; |
|---|
| 788 | 868 | uint32_t cfg_enable_nvmet; |
|---|
| .. | .. |
|---|
| 791 | 871 | uint32_t cfg_total_seg_cnt; |
|---|
| 792 | 872 | uint32_t cfg_sg_seg_cnt; |
|---|
| 793 | 873 | uint32_t cfg_nvme_seg_cnt; |
|---|
| 874 | + uint32_t cfg_scsi_seg_cnt; |
|---|
| 794 | 875 | uint32_t cfg_sg_dma_buf_size; |
|---|
| 795 | 876 | uint64_t cfg_soft_wwnn; |
|---|
| 796 | 877 | uint64_t cfg_soft_wwpn; |
|---|
| .. | .. |
|---|
| 817 | 898 | uint32_t cfg_prot_guard; |
|---|
| 818 | 899 | uint32_t cfg_hostmem_hgp; |
|---|
| 819 | 900 | 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 |
|---|
| 820 | 912 | uint32_t cfg_aer_support; |
|---|
| 821 | 913 | uint32_t cfg_sriov_nr_virtfn; |
|---|
| 822 | 914 | uint32_t cfg_request_firmware_upgrade; |
|---|
| 823 | | - uint32_t cfg_iocb_cnt; |
|---|
| 824 | 915 | uint32_t cfg_suppress_link_up; |
|---|
| 825 | 916 | uint32_t cfg_rrq_xri_bitmap_sz; |
|---|
| 826 | 917 | uint32_t cfg_delay_discovery; |
|---|
| .. | .. |
|---|
| 828 | 919 | #define LPFC_INITIALIZE_LINK 0 /* do normal init_link mbox */ |
|---|
| 829 | 920 | #define LPFC_DELAY_INIT_LINK 1 /* layered driver hold off */ |
|---|
| 830 | 921 | #define LPFC_DELAY_INIT_LINK_INDEFINITELY 2 /* wait, manual intervention */ |
|---|
| 831 | | - uint32_t cfg_enable_dss; |
|---|
| 832 | 922 | uint32_t cfg_fdmi_on; |
|---|
| 833 | 923 | #define LPFC_FDMI_NO_SUPPORT 0 /* FDMI not supported */ |
|---|
| 834 | 924 | #define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */ |
|---|
| 835 | 925 | uint32_t cfg_enable_SmartSAN; |
|---|
| 836 | 926 | 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; |
|---|
| 838 | 930 | uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */ |
|---|
| 839 | 931 | 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 |
|---|
| 844 | 932 | uint32_t cfg_enable_pbde; |
|---|
| 845 | | - uint32_t io_channel_irqs; /* number of irqs for io channels */ |
|---|
| 846 | 933 | struct nvmet_fc_target_port *targetport; |
|---|
| 847 | 934 | lpfc_vpd_t vpd; /* vital product data */ |
|---|
| 848 | 935 | |
|---|
| .. | .. |
|---|
| 856 | 943 | wait_queue_head_t work_waitq; |
|---|
| 857 | 944 | struct task_struct *worker_thread; |
|---|
| 858 | 945 | unsigned long data_flags; |
|---|
| 946 | + uint32_t border_sge_num; |
|---|
| 859 | 947 | |
|---|
| 860 | 948 | uint32_t hbq_in_use; /* HBQs in use flag */ |
|---|
| 861 | 949 | uint32_t hbq_count; /* Count of configured HBQs */ |
|---|
| .. | .. |
|---|
| 896 | 984 | int brd_no; /* FC board number */ |
|---|
| 897 | 985 | char SerialNumber[32]; /* adapter Serial Number */ |
|---|
| 898 | 986 | char OptionROMVersion[32]; /* adapter BIOS / Fcode version */ |
|---|
| 987 | + char BIOSVersion[16]; /* Boot BIOS version */ |
|---|
| 899 | 988 | char ModelDesc[256]; /* Model Description */ |
|---|
| 900 | 989 | char ModelName[80]; /* Model Name */ |
|---|
| 901 | 990 | char ProgramType[256]; /* Program Type */ |
|---|
| .. | .. |
|---|
| 914 | 1003 | struct timer_list eratt_poll; |
|---|
| 915 | 1004 | uint32_t eratt_poll_interval; |
|---|
| 916 | 1005 | |
|---|
| 917 | | - /* |
|---|
| 918 | | - * stat counters |
|---|
| 919 | | - */ |
|---|
| 920 | | - atomic_t fc4ScsiInputRequests; |
|---|
| 921 | | - atomic_t fc4ScsiOutputRequests; |
|---|
| 922 | | - atomic_t fc4ScsiControlRequests; |
|---|
| 923 | | - atomic_t fc4ScsiIoCmpls; |
|---|
| 924 | | - |
|---|
| 925 | 1006 | uint64_t bg_guard_err_cnt; |
|---|
| 926 | 1007 | uint64_t bg_apptag_err_cnt; |
|---|
| 927 | 1008 | uint64_t bg_reftag_err_cnt; |
|---|
| .. | .. |
|---|
| 932 | 1013 | struct list_head lpfc_scsi_buf_list_get; |
|---|
| 933 | 1014 | struct list_head lpfc_scsi_buf_list_put; |
|---|
| 934 | 1015 | 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; |
|---|
| 942 | 1016 | struct list_head lpfc_iocb_list; |
|---|
| 943 | 1017 | uint32_t total_iocbq_bufs; |
|---|
| 944 | 1018 | struct list_head active_rrq_list; |
|---|
| .. | .. |
|---|
| 951 | 1025 | struct dma_pool *lpfc_drb_pool; /* data receive buffer pool */ |
|---|
| 952 | 1026 | struct dma_pool *lpfc_nvmet_drb_pool; /* data receive buffer pool */ |
|---|
| 953 | 1027 | 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; |
|---|
| 955 | 1029 | struct lpfc_dma_pool lpfc_mbuf_safety_pool; |
|---|
| 956 | 1030 | |
|---|
| 957 | 1031 | mempool_t *mbox_mem_pool; |
|---|
| .. | .. |
|---|
| 960 | 1034 | mempool_t *active_rrq_pool; |
|---|
| 961 | 1035 | |
|---|
| 962 | 1036 | struct fc_host_statistics link_stats; |
|---|
| 1037 | + enum lpfc_irq_chann_mode irq_chann_mode; |
|---|
| 963 | 1038 | enum intr_type_t intr_type; |
|---|
| 964 | 1039 | uint32_t intr_mode; |
|---|
| 965 | 1040 | #define LPFC_INTR_ERROR 0xFFFFFFFF |
|---|
| 966 | 1041 | struct list_head port_list; |
|---|
| 1042 | + spinlock_t port_list_lock; /* lock for port_list mutations */ |
|---|
| 967 | 1043 | struct lpfc_vport *pport; /* physical lpfc_vport pointer */ |
|---|
| 968 | 1044 | uint16_t max_vpi; /* Maximum virtual nports */ |
|---|
| 969 | 1045 | #define LPFC_MAX_VPI 0xFF /* Max number VPI supported 0 - 0xff */ |
|---|
| .. | .. |
|---|
| 994 | 1070 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
|---|
| 995 | 1071 | struct dentry *hba_debugfs_root; |
|---|
| 996 | 1072 | atomic_t debugfs_vport_count; |
|---|
| 1073 | + struct dentry *debug_multixri_pools; |
|---|
| 997 | 1074 | struct dentry *debug_hbqinfo; |
|---|
| 998 | 1075 | struct dentry *debug_dumpHostSlim; |
|---|
| 999 | 1076 | struct dentry *debug_dumpHBASlim; |
|---|
| 1000 | | - struct dentry *debug_dumpData; /* BlockGuard BPL */ |
|---|
| 1001 | | - struct dentry *debug_dumpDif; /* BlockGuard BPL */ |
|---|
| 1002 | 1077 | struct dentry *debug_InjErrLBA; /* LBA to inject errors at */ |
|---|
| 1003 | 1078 | struct dentry *debug_InjErrNPortID; /* NPortID to inject errors at */ |
|---|
| 1004 | 1079 | struct dentry *debug_InjErrWWPN; /* WWPN to inject errors at */ |
|---|
| .. | .. |
|---|
| 1011 | 1086 | |
|---|
| 1012 | 1087 | struct dentry *debug_nvmeio_trc; |
|---|
| 1013 | 1088 | 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; |
|---|
| 1014 | 1094 | atomic_t nvmeio_trc_cnt; |
|---|
| 1015 | 1095 | uint32_t nvmeio_trc_size; |
|---|
| 1016 | 1096 | uint32_t nvmeio_trc_output_idx; |
|---|
| .. | .. |
|---|
| 1051 | 1131 | |
|---|
| 1052 | 1132 | uint8_t temp_sensor_support; |
|---|
| 1053 | 1133 | /* Fields used for heart beat. */ |
|---|
| 1054 | | - unsigned long last_eqdelay_time; |
|---|
| 1055 | 1134 | unsigned long last_completion_time; |
|---|
| 1056 | 1135 | unsigned long skipped_hb; |
|---|
| 1057 | 1136 | struct timer_list hb_tmofunc; |
|---|
| .. | .. |
|---|
| 1089 | 1168 | uint16_t vlan_id; |
|---|
| 1090 | 1169 | struct list_head fcf_conn_rec_list; |
|---|
| 1091 | 1170 | |
|---|
| 1171 | + bool defer_flogi_acc_flag; |
|---|
| 1172 | + uint16_t defer_flogi_acc_rx_id; |
|---|
| 1173 | + uint16_t defer_flogi_acc_ox_id; |
|---|
| 1174 | + |
|---|
| 1092 | 1175 | spinlock_t ct_ev_lock; /* synchronize access to ct_ev_waiters */ |
|---|
| 1093 | 1176 | struct list_head ct_ev_waiters; |
|---|
| 1094 | 1177 | struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX]; |
|---|
| 1095 | 1178 | uint32_t ctx_idx; |
|---|
| 1179 | + |
|---|
| 1180 | + /* RAS Support */ |
|---|
| 1181 | + struct lpfc_ras_fwlog ras_fwlog; |
|---|
| 1096 | 1182 | |
|---|
| 1097 | 1183 | uint8_t menlo_flag; /* menlo generic flags */ |
|---|
| 1098 | 1184 | #define HBA_MENLO_SUPPORT 0x1 /* HBA supports menlo commands */ |
|---|
| 1099 | 1185 | uint32_t iocb_cnt; |
|---|
| 1100 | 1186 | uint32_t iocb_max; |
|---|
| 1101 | 1187 | atomic_t sdev_cnt; |
|---|
| 1102 | | - uint8_t fips_spec_rev; |
|---|
| 1103 | | - uint8_t fips_level; |
|---|
| 1104 | 1188 | spinlock_t devicelock; /* lock for luns list */ |
|---|
| 1105 | 1189 | mempool_t *device_data_mem_pool; |
|---|
| 1106 | 1190 | struct list_head luns; |
|---|
| .. | .. |
|---|
| 1118 | 1202 | uint16_t sfp_warning; |
|---|
| 1119 | 1203 | |
|---|
| 1120 | 1204 | #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; |
|---|
| 1127 | 1206 | #define LPFC_CHECK_OFF 0 |
|---|
| 1128 | 1207 | #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 |
|---|
| 1131 | 1210 | uint16_t ktime_on; |
|---|
| 1132 | 1211 | uint64_t ktime_data_samples; |
|---|
| 1133 | 1212 | uint64_t ktime_status_samples; |
|---|
| .. | .. |
|---|
| 1163 | 1242 | uint64_t ktime_seg10_min; |
|---|
| 1164 | 1243 | uint64_t ktime_seg10_max; |
|---|
| 1165 | 1244 | #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]; |
|---|
| 1166 | 1263 | }; |
|---|
| 1167 | 1264 | |
|---|
| 1168 | 1265 | static inline struct Scsi_Host * |
|---|
| .. | .. |
|---|
| 1251 | 1348 | } |
|---|
| 1252 | 1349 | return &phba->sli.sli3_ring[LPFC_ELS_RING]; |
|---|
| 1253 | 1350 | } |
|---|
| 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, ®_data, eq->queue_id); |
|---|
| 1387 | + bf_set(lpfc_sliport_eqdelay_delay, ®_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 | +} |
|---|