OSDN Git Service

scsi: qla2xxx: Add ql2xnvme_queues module param to configure number of NVMe queues
authorShreyas Deodhar <sdeodhar@marvell.com>
Mon, 10 Jan 2022 05:02:10 +0000 (21:02 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 25 Jan 2022 04:57:31 +0000 (23:57 -0500)
Add ql2xnvme_queues module parameter to configure number of NVMe queues

Usage:

Number of NVMe Queues that can be configured.

Final value will be min(ql2xnvme_queues, num_cpus, num_chip_queues),

  1 - Minimum number of queues supported
  8 - Default value
128 - Maximum number of queues supported

Link: https://lore.kernel.org/r/20220110050218.3958-10-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Shreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_nvme.c
drivers/scsi/qla2xxx/qla_nvme.h
drivers/scsi/qla2xxx/qla_os.c

index 3f8b8bb..cedc347 100644 (file)
@@ -192,6 +192,7 @@ extern int ql2xfulldump_on_mpifail;
 extern int ql2xsecenable;
 extern int ql2xenforce_iocb_limit;
 extern int ql2xabts_wait_nvme;
+extern u32 ql2xnvme_queues;
 
 extern int qla2x00_loop_reset(scsi_qla_host_t *);
 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
index e22ec7c..718c761 100644 (file)
@@ -710,7 +710,7 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = {
        .fcp_io         = qla_nvme_post_cmd,
        .fcp_abort      = qla_nvme_fcp_abort,
        .map_queues     = qla_nvme_map_queues,
-       .max_hw_queues  = 8,
+       .max_hw_queues  = DEF_NVME_HW_QUEUES,
        .max_sgl_segments = 1024,
        .max_dif_sgl_segments = 64,
        .dma_boundary = 0xFFFFFFFF,
@@ -779,10 +779,22 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 
        WARN_ON(vha->nvme_local_port);
 
+       if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
+               ql_log(ql_log_warn, vha, 0xfffd,
+                   "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
+                   ql2xnvme_queues, MIN_NVME_HW_QUEUES, MAX_NVME_HW_QUEUES,
+                   DEF_NVME_HW_QUEUES);
+               ql2xnvme_queues = DEF_NVME_HW_QUEUES;
+       }
+
        qla_nvme_fc_transport.max_hw_queues =
-           min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),
+           min((uint8_t)(ql2xnvme_queues),
                (uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
 
+       ql_log(ql_log_info, vha, 0xfffb,
+           "Number of NVME queues used for this port: %d\n",
+           qla_nvme_fc_transport.max_hw_queues);
+
        pinfo.node_name = wwn_to_u64(vha->node_name);
        pinfo.port_name = wwn_to_u64(vha->port_name);
        pinfo.port_role = FC_PORT_ROLE_NVME_INITIATOR;
index f81f219..d0e3c0e 100644 (file)
 #include "qla_def.h"
 #include "qla_dsd.h"
 
+#define MIN_NVME_HW_QUEUES 1
+#define MAX_NVME_HW_QUEUES 128
+#define DEF_NVME_HW_QUEUES 8
+
 #define NVME_ATIO_CMD_OFF 32
 #define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF)
 #define Q2T_NVME_NUM_TAGS 2048
index c4b4b44..7d51593 100644 (file)
@@ -338,6 +338,14 @@ static void qla2x00_free_device(scsi_qla_host_t *);
 static int qla2xxx_map_queues(struct Scsi_Host *shost);
 static void qla2x00_destroy_deferred_work(struct qla_hw_data *);
 
+u32 ql2xnvme_queues = DEF_NVME_HW_QUEUES;
+module_param(ql2xnvme_queues, uint, S_IRUGO);
+MODULE_PARM_DESC(ql2xnvme_queues,
+       "Number of NVMe Queues that can be configured.\n"
+       "Final value will be min(ql2xnvme_queues, num_cpus,num_chip_queues)\n"
+       "1 - Minimum number of queues supported\n"
+       "128 - Maximum number of queues supported\n"
+       "8 - Default value");
 
 static struct scsi_transport_template *qla2xxx_transport_template = NULL;
 struct scsi_transport_template *qla2xxx_transport_vport_template = NULL;