Skip to content

Commit

Permalink
scsi: lpfc: Add push-to-adapter support to sli4
Browse files Browse the repository at this point in the history
New if_type=6 adapters support an additional BAR that provides
apertures to allow direct WQE to adapter push support - termed
Direct Packet Push (DPP). WQ creation differs slightly to ask for
a WQ to be DPP-ized. When submitting a WQE to a DPP WQ, it is
submitted to the host memory for the WQ normally, but is also
written by the host cpu directly to a BAR aperture.  Write buffer
coalescing in hardware is (hopefully) turned on, enabling single
pci write operation support. The doorbell is thing rung to indicate
the WQE is available and was pushed to the aperture.

This patch:
- Updates the WQ Create commands for the DPP options
- Adds the bar mapping for if_type=6 DPP bar
- Adds the WQE pushing to the DDP aperture received from WQ create
- Adds a new module parameter to disable DPP operation if desired.
  Default is enabled.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
James Smart authored and Martin K. Petersen committed Feb 23, 2018
1 parent 27d6ac0 commit 1351e69
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 87 deletions.
3 changes: 2 additions & 1 deletion drivers/scsi/lpfc/lpfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ struct lpfc_hba {
uint32_t cfg_enable_SmartSAN;
uint32_t cfg_enable_mds_diags;
uint32_t cfg_enable_fc4_type;
uint32_t cfg_enable_bbcr; /*Enable BB Credit Recovery*/
uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */
uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */
uint32_t cfg_xri_split;
#define LPFC_ENABLE_FCP 1
#define LPFC_ENABLE_NVME 2
Expand Down
10 changes: 10 additions & 0 deletions drivers/scsi/lpfc/lpfc_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5186,6 +5186,14 @@ LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics");
*/
LPFC_BBCR_ATTR_RW(enable_bbcr, 1, 0, 1, "Enable BBC Recovery");

/*
* lpfc_enable_dpp: Enable DPP on G7
* 0 = DPP on G7 disabled
* 1 = DPP on G7 enabled (default)
* Value range is [0,1]. Default value is 1.
*/
LPFC_ATTR_RW(enable_dpp, 1, 0, 1, "Enable Direct Packet Push");

struct device_attribute *lpfc_hba_attrs[] = {
&dev_attr_nvme_info,
&dev_attr_bg_info,
Expand Down Expand Up @@ -5294,6 +5302,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
&dev_attr_lpfc_xlane_supported,
&dev_attr_lpfc_enable_mds_diags,
&dev_attr_lpfc_enable_bbcr,
&dev_attr_lpfc_enable_dpp,
NULL,
};

Expand Down Expand Up @@ -6306,6 +6315,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_fcp_io_channel_init(phba, lpfc_fcp_io_channel);
lpfc_nvme_io_channel_init(phba, lpfc_nvme_io_channel);
lpfc_enable_bbcr_init(phba, lpfc_enable_bbcr);
lpfc_enable_dpp_init(phba, lpfc_enable_dpp);

if (phba->sli_rev != LPFC_SLI_REV4) {
/* NVME only supported on SLI4 */
Expand Down
31 changes: 31 additions & 0 deletions drivers/scsi/lpfc/lpfc_hw4.h
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,15 @@ struct lpfc_mbx_wq_create {
#define lpfc_mbx_wq_create_page_size_MASK 0x000000FF
#define lpfc_mbx_wq_create_page_size_WORD word1
#define LPFC_WQ_PAGE_SIZE_4096 0x1
#define lpfc_mbx_wq_create_dpp_req_SHIFT 15
#define lpfc_mbx_wq_create_dpp_req_MASK 0x00000001
#define lpfc_mbx_wq_create_dpp_req_WORD word1
#define lpfc_mbx_wq_create_doe_SHIFT 14
#define lpfc_mbx_wq_create_doe_MASK 0x00000001
#define lpfc_mbx_wq_create_doe_WORD word1
#define lpfc_mbx_wq_create_toe_SHIFT 13
#define lpfc_mbx_wq_create_toe_MASK 0x00000001
#define lpfc_mbx_wq_create_toe_WORD word1
#define lpfc_mbx_wq_create_wqe_size_SHIFT 8
#define lpfc_mbx_wq_create_wqe_size_MASK 0x0000000F
#define lpfc_mbx_wq_create_wqe_size_WORD word1
Expand Down Expand Up @@ -1400,6 +1409,28 @@ struct lpfc_mbx_wq_create {
#define lpfc_mbx_wq_create_db_format_MASK 0x0000FFFF
#define lpfc_mbx_wq_create_db_format_WORD word2
} response;
struct {
uint32_t word0;
#define lpfc_mbx_wq_create_dpp_rsp_SHIFT 31
#define lpfc_mbx_wq_create_dpp_rsp_MASK 0x00000001
#define lpfc_mbx_wq_create_dpp_rsp_WORD word0
#define lpfc_mbx_wq_create_v1_q_id_SHIFT 0
#define lpfc_mbx_wq_create_v1_q_id_MASK 0x0000FFFF
#define lpfc_mbx_wq_create_v1_q_id_WORD word0
uint32_t word1;
#define lpfc_mbx_wq_create_v1_bar_set_SHIFT 0
#define lpfc_mbx_wq_create_v1_bar_set_MASK 0x0000000F
#define lpfc_mbx_wq_create_v1_bar_set_WORD word1
uint32_t doorbell_offset;
uint32_t word3;
#define lpfc_mbx_wq_create_dpp_id_SHIFT 16
#define lpfc_mbx_wq_create_dpp_id_MASK 0x0000001F
#define lpfc_mbx_wq_create_dpp_id_WORD word3
#define lpfc_mbx_wq_create_dpp_bar_SHIFT 0
#define lpfc_mbx_wq_create_dpp_bar_MASK 0x0000000F
#define lpfc_mbx_wq_create_dpp_bar_WORD word3
uint32_t dpp_offset;
} response_1;
} u;
};

Expand Down
18 changes: 18 additions & 0 deletions drivers/scsi/lpfc/lpfc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -9611,6 +9611,24 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
}
}

if (if_type == LPFC_SLI_INTF_IF_TYPE_6 &&
pci_resource_start(pdev, PCI_64BIT_BAR4)) {
/*
* Map SLI4 if type 6 HBA DPP Register base to a kernel
* virtual address and setup the registers.
*/
phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4);
bar2map_len = pci_resource_len(pdev, PCI_64BIT_BAR4);
phba->sli4_hba.dpp_regs_memmap_p =
ioremap(phba->pci_bar2_map, bar2map_len);
if (!phba->sli4_hba.dpp_regs_memmap_p) {
dev_err(&pdev->dev,
"ioremap failed for SLI4 HBA dpp registers.\n");
goto out_iounmap_ctrl;
}
phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p;
}

/* Set up the EQ/CQ register handeling functions now */
switch (if_type) {
case LPFC_SLI_INTF_IF_TYPE_0:
Expand Down
Loading

0 comments on commit 1351e69

Please sign in to comment.