scsi: fnic: Get copy workqueue count and interrupt mode from config
authorKaran Tilak Kumar <kartilak@cisco.com>
Mon, 11 Dec 2023 17:36:09 +0000 (09:36 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 14 Dec 2023 03:11:33 +0000 (22:11 -0500)
Get the copy workqueue count and interrupt mode from the configuration. The
config can be changed via UCSM.  Add logs to print the interrupt mode and
copy workqueue count.  Add logs to print the vNIC resources.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20231211173617.932990-6-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fnic/fnic_res.c

index 109316cc4ad9b9c31f3300d0f9b4f6e5dd5be236..33dd27f6f24e82e95f2b80e672efb20a8bebf73b 100644 (file)
@@ -57,6 +57,8 @@ int fnic_get_vnic_config(struct fnic *fnic)
        GET_CONFIG(port_down_timeout);
        GET_CONFIG(port_down_io_retries);
        GET_CONFIG(luns_per_tgt);
+       GET_CONFIG(intr_mode);
+       GET_CONFIG(wq_copy_count);
 
        c->wq_enet_desc_count =
                min_t(u32, VNIC_FNIC_WQ_DESCS_MAX,
@@ -131,6 +133,12 @@ int fnic_get_vnic_config(struct fnic *fnic)
        c->intr_timer = min_t(u16, VNIC_INTR_TIMER_MAX, c->intr_timer);
        c->intr_timer_type = c->intr_timer_type;
 
+       /* for older firmware, GET_CONFIG will not return anything */
+       if (c->wq_copy_count == 0)
+               c->wq_copy_count = 1;
+
+       c->wq_copy_count = min_t(u16, FNIC_WQ_COPY_MAX, c->wq_copy_count);
+
        shost_printk(KERN_INFO, fnic->lport->host,
                     "vNIC MAC addr %pM "
                     "wq/wq_copy/rq %d/%d/%d\n",
@@ -161,6 +169,10 @@ int fnic_get_vnic_config(struct fnic *fnic)
        shost_printk(KERN_INFO, fnic->lport->host,
                     "vNIC port dn io retries %d port dn timeout %d\n",
                     c->port_down_io_retries, c->port_down_timeout);
+       shost_printk(KERN_INFO, fnic->lport->host,
+                       "vNIC wq_copy_count: %d\n", c->wq_copy_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+                       "vNIC intr mode: %d\n", c->intr_mode);
 
        return 0;
 }
@@ -187,12 +199,25 @@ int fnic_set_nic_config(struct fnic *fnic, u8 rss_default_cpu,
 void fnic_get_res_counts(struct fnic *fnic)
 {
        fnic->wq_count = vnic_dev_get_res_count(fnic->vdev, RES_TYPE_WQ);
-       fnic->raw_wq_count = fnic->wq_count - 1;
-       fnic->wq_copy_count = fnic->wq_count - fnic->raw_wq_count;
+       fnic->raw_wq_count = 1;
+       fnic->wq_copy_count = fnic->config.wq_copy_count;
        fnic->rq_count = vnic_dev_get_res_count(fnic->vdev, RES_TYPE_RQ);
        fnic->cq_count = vnic_dev_get_res_count(fnic->vdev, RES_TYPE_CQ);
        fnic->intr_count = vnic_dev_get_res_count(fnic->vdev,
                RES_TYPE_INTR_CTRL);
+
+       shost_printk(KERN_INFO, fnic->lport->host,
+               "vNIC fw resources wq_count: %d\n", fnic->wq_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+               "vNIC fw resources raw_wq_count: %d\n", fnic->raw_wq_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+               "vNIC fw resources wq_copy_count: %d\n", fnic->wq_copy_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+               "vNIC fw resources rq_count: %d\n", fnic->rq_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+               "vNIC fw resources cq_count: %d\n", fnic->cq_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+               "vNIC fw resources intr_count: %d\n", fnic->intr_count);
 }
 
 void fnic_free_vnic_resources(struct fnic *fnic)
@@ -234,10 +259,15 @@ int fnic_alloc_vnic_resources(struct fnic *fnic)
                     intr_mode == VNIC_DEV_INTR_MODE_MSIX ?
                     "MSI-X" : "unknown");
 
-       shost_printk(KERN_INFO, fnic->lport->host, "vNIC resources avail: "
-                    "wq %d cp_wq %d raw_wq %d rq %d cq %d intr %d\n",
-                    fnic->wq_count, fnic->wq_copy_count, fnic->raw_wq_count,
-                    fnic->rq_count, fnic->cq_count, fnic->intr_count);
+       shost_printk(KERN_INFO, fnic->lport->host,
+                       "vNIC resources avail: wq %d cp_wq %d raw_wq %d rq %d",
+                       fnic->wq_count, fnic->wq_copy_count,
+                       fnic->raw_wq_count, fnic->rq_count);
+
+       shost_printk(KERN_INFO, fnic->lport->host,
+                       "vNIC resources avail: cq %d intr %d cpy-wq desc count %d\n",
+                       fnic->cq_count, fnic->intr_count,
+                       fnic->config.wq_copy_desc_count);
 
        /* Allocate Raw WQ used for FCS frames */
        for (i = 0; i < fnic->raw_wq_count; i++) {