scsi: qedi: Use qed count from set_fp_int in msix allocation
authorManish Rangankar <mrangankar@marvell.com>
Tue, 8 Sep 2020 09:56:50 +0000 (02:56 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Sep 2020 02:40:20 +0000 (22:40 -0400)
To avoid unnecessary vector allocation when the number of fast-path queues
is less then available msix vectors, use return count from module
qed->set_fp_int.

Link: https://lore.kernel.org/r/20200908095657.26821-2-mrangankar@marvell.com
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qedi/qedi.h
drivers/scsi/qedi/qedi_main.c

index 9498279..9c19ec9 100644 (file)
@@ -305,6 +305,7 @@ struct qedi_ctx {
        u32 max_sqes;
        u8 num_queues;
        u32 max_active_conns;
+       s32 msix_count;
 
        struct iscsi_cid_queue cid_que;
        struct qedi_endpoint **ep_tbl;
index e42437e..c6842af 100644 (file)
@@ -1356,7 +1356,7 @@ static int qedi_request_msix_irq(struct qedi_ctx *qedi)
        u16 idx;
 
        cpu = cpumask_first(cpu_online_mask);
-       for (i = 0; i < qedi->int_info.msix_cnt; i++) {
+       for (i = 0; i < qedi->msix_count; i++) {
                idx = i * qedi->dev_info.common.num_hwfns +
                          qedi_ops->common->get_affin_hwfn_idx(qedi->cdev);
 
@@ -1386,7 +1386,12 @@ static int qedi_setup_int(struct qedi_ctx *qedi)
 {
        int rc = 0;
 
-       rc = qedi_ops->common->set_fp_int(qedi->cdev, num_online_cpus());
+       rc = qedi_ops->common->set_fp_int(qedi->cdev, qedi->num_queues);
+       if (rc < 0)
+               goto exit_setup_int;
+
+       qedi->msix_count = rc;
+
        rc = qedi_ops->common->get_fp_int(qedi->cdev, &qedi->int_info);
        if (rc)
                goto exit_setup_int;