Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0794d601 authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: Implement common IO buffers between NVME and SCSI



Currently, both NVME and SCSI get their IO buffers from separate
pools. XRI's are associated 1:1 with IO buffers, so XRI's are also split
between protocols.

Eliminate the independent pools and use a single pool. Each buffer
structure now has a common section and a protocol section. Per protocol
routines for SGL initialization are removed and replaced by common
routines. Initialization of the buffers is only done on the common area.
All other fields, which are protocol specific, are initialized when the
buffer is allocated for use in the per-protocol allocation routine.

In the past, the SCSI side allocated IO buffers as part of slave_alloc
calls until the maximum XRIs for SCSI was reached. As all XRIs are now
common and may be used for either protocol, allocation for everything is
done as part of adapter initialization and the scsi side has no action in
slave alloc.

As XRI's are no longer split, the lpfc_xri_split module parameter is
removed.

Adapters based on SLI3 will continue to use the older scsi_buf_list_get/put
routines.  All SLI4 adapters utilize the new IO buffer scheme

Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e960f5ab
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -617,8 +617,6 @@ struct lpfc_ras_fwlog {

struct lpfc_hba {
	/* SCSI interface function jump table entries */
	int (*lpfc_new_scsi_buf)
		(struct lpfc_vport *, int);
	struct lpfc_scsi_buf * (*lpfc_get_scsi_buf)
		(struct lpfc_hba *, struct lpfc_nodelist *);
	int (*lpfc_scsi_prep_dma_buf)
@@ -875,7 +873,6 @@ struct lpfc_hba {
	uint32_t cfg_enable_fc4_type;
	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
#define LPFC_ENABLE_BOTH 3
@@ -970,13 +967,13 @@ struct lpfc_hba {
	struct list_head lpfc_scsi_buf_list_get;
	struct list_head lpfc_scsi_buf_list_put;
	uint32_t total_scsi_bufs;
	spinlock_t nvme_buf_list_get_lock;  /* NVME buf alloc list lock */
	spinlock_t nvme_buf_list_put_lock;  /* NVME buf free list lock */
	struct list_head lpfc_nvme_buf_list_get;
	struct list_head lpfc_nvme_buf_list_put;
	uint32_t total_nvme_bufs;
	uint32_t get_nvme_bufs;
	uint32_t put_nvme_bufs;
	spinlock_t common_buf_list_get_lock;  /* Common buf alloc list lock */
	spinlock_t common_buf_list_put_lock;  /* Common buf free list lock */
	struct list_head lpfc_common_buf_list_get;
	struct list_head lpfc_common_buf_list_put;
	uint32_t total_common_bufs;
	uint32_t get_common_bufs;
	uint32_t put_common_bufs;
	struct list_head lpfc_iocb_list;
	uint32_t total_iocbq_bufs;
	struct list_head active_rrq_list;
+2 −21
Original line number Diff line number Diff line
@@ -334,11 +334,10 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,

	rcu_read_lock();
	scnprintf(tmp, sizeof(tmp),
		  "XRI Dist lpfc%d Total %d NVME %d SCSI %d ELS %d\n",
		  "XRI Dist lpfc%d Total %d IO %d ELS %d\n",
		  phba->brd_no,
		  phba->sli4_hba.max_cfg_param.max_xri,
		  phba->sli4_hba.nvme_xri_max,
		  phba->sli4_hba.scsi_xri_max,
		  phba->sli4_hba.common_xri_max,
		  lpfc_sli4_get_els_iocb_cnt(phba));
	if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
		goto buffer_done;
@@ -3730,22 +3729,6 @@ LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_FCP,
	    LPFC_ENABLE_FCP, LPFC_ENABLE_BOTH,
	    "Enable FC4 Protocol support - FCP / NVME");

/*
 * lpfc_xri_split: Defines the division of XRI resources between SCSI and NVME
 * This parameter is only used if:
 *     lpfc_enable_fc4_type is 3 - register both FCP and NVME and
 *     port is not configured for NVMET.
 *
 * ELS/CT always get 10% of XRIs, up to a maximum of 250
 * The remaining XRIs get split up based on lpfc_xri_split per port:
 *
 * Supported Values are in percentages
 * the xri_split value is the percentage the SCSI port will get. The remaining
 * percentage will go to NVME.
 */
LPFC_ATTR_R(xri_split, 50, 10, 90,
	    "Percentage of FCP XRI resources versus NVME");

/*
# lpfc_log_verbose: Only turn this flag on if you are willing to risk being
# deluged with LOTS of information.
@@ -5704,7 +5687,6 @@ struct device_attribute *lpfc_hba_attrs[] = {
	&dev_attr_lpfc_nodev_tmo,
	&dev_attr_lpfc_devloss_tmo,
	&dev_attr_lpfc_enable_fc4_type,
	&dev_attr_lpfc_xri_split,
	&dev_attr_lpfc_fcp_class,
	&dev_attr_lpfc_use_adisc,
	&dev_attr_lpfc_first_burst_size,
@@ -6865,7 +6847,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)

	phba->cfg_soft_wwnn = 0L;
	phba->cfg_soft_wwpn = 0L;
	lpfc_xri_split_init(phba, lpfc_xri_split);
	lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt);
	lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
	lpfc_hba_log_verbose_init(phba, lpfc_log_verbose);
+4 −2
Original line number Diff line number Diff line
@@ -520,8 +520,10 @@ int lpfc_sli4_read_config(struct lpfc_hba *);
void lpfc_sli4_node_prep(struct lpfc_hba *);
int lpfc_sli4_els_sgl_update(struct lpfc_hba *phba);
int lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba);
int lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba);
int lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba);
int lpfc_sli4_common_sgl_update(struct lpfc_hba *phba);
int lpfc_sli4_post_common_sgl_list(struct lpfc_hba *phba,
	struct list_head *blist, int xricnt);
int lpfc_new_common_buf(struct lpfc_hba *phba, int num_to_alloc);
void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *);
uint32_t lpfc_sli_port_speed_get(struct lpfc_hba *);
int lpfc_sli4_request_firmware_update(struct lpfc_hba *, uint8_t);
+277 −238

File changed.

Preview size limit exceeded, changes collapsed.

+63 −437

File changed.

Preview size limit exceeded, changes collapsed.

Loading