Skip to content

Commit 8c2a6f8

Browse files
Karan Tilak Kumarmartinkpetersen
authored andcommitted
scsi: fnic: Get copy workqueue count and interrupt mode from config
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>
1 parent 86b86a7 commit 8c2a6f8

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

drivers/scsi/fnic/fnic_res.c

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ int fnic_get_vnic_config(struct fnic *fnic)
5757
GET_CONFIG(port_down_timeout);
5858
GET_CONFIG(port_down_io_retries);
5959
GET_CONFIG(luns_per_tgt);
60+
GET_CONFIG(intr_mode);
61+
GET_CONFIG(wq_copy_count);
6062

6163
c->wq_enet_desc_count =
6264
min_t(u32, VNIC_FNIC_WQ_DESCS_MAX,
@@ -131,6 +133,12 @@ int fnic_get_vnic_config(struct fnic *fnic)
131133
c->intr_timer = min_t(u16, VNIC_INTR_TIMER_MAX, c->intr_timer);
132134
c->intr_timer_type = c->intr_timer_type;
133135

136+
/* for older firmware, GET_CONFIG will not return anything */
137+
if (c->wq_copy_count == 0)
138+
c->wq_copy_count = 1;
139+
140+
c->wq_copy_count = min_t(u16, FNIC_WQ_COPY_MAX, c->wq_copy_count);
141+
134142
shost_printk(KERN_INFO, fnic->lport->host,
135143
"vNIC MAC addr %pM "
136144
"wq/wq_copy/rq %d/%d/%d\n",
@@ -161,6 +169,10 @@ int fnic_get_vnic_config(struct fnic *fnic)
161169
shost_printk(KERN_INFO, fnic->lport->host,
162170
"vNIC port dn io retries %d port dn timeout %d\n",
163171
c->port_down_io_retries, c->port_down_timeout);
172+
shost_printk(KERN_INFO, fnic->lport->host,
173+
"vNIC wq_copy_count: %d\n", c->wq_copy_count);
174+
shost_printk(KERN_INFO, fnic->lport->host,
175+
"vNIC intr mode: %d\n", c->intr_mode);
164176

165177
return 0;
166178
}
@@ -187,12 +199,25 @@ int fnic_set_nic_config(struct fnic *fnic, u8 rss_default_cpu,
187199
void fnic_get_res_counts(struct fnic *fnic)
188200
{
189201
fnic->wq_count = vnic_dev_get_res_count(fnic->vdev, RES_TYPE_WQ);
190-
fnic->raw_wq_count = fnic->wq_count - 1;
191-
fnic->wq_copy_count = fnic->wq_count - fnic->raw_wq_count;
202+
fnic->raw_wq_count = 1;
203+
fnic->wq_copy_count = fnic->config.wq_copy_count;
192204
fnic->rq_count = vnic_dev_get_res_count(fnic->vdev, RES_TYPE_RQ);
193205
fnic->cq_count = vnic_dev_get_res_count(fnic->vdev, RES_TYPE_CQ);
194206
fnic->intr_count = vnic_dev_get_res_count(fnic->vdev,
195207
RES_TYPE_INTR_CTRL);
208+
209+
shost_printk(KERN_INFO, fnic->lport->host,
210+
"vNIC fw resources wq_count: %d\n", fnic->wq_count);
211+
shost_printk(KERN_INFO, fnic->lport->host,
212+
"vNIC fw resources raw_wq_count: %d\n", fnic->raw_wq_count);
213+
shost_printk(KERN_INFO, fnic->lport->host,
214+
"vNIC fw resources wq_copy_count: %d\n", fnic->wq_copy_count);
215+
shost_printk(KERN_INFO, fnic->lport->host,
216+
"vNIC fw resources rq_count: %d\n", fnic->rq_count);
217+
shost_printk(KERN_INFO, fnic->lport->host,
218+
"vNIC fw resources cq_count: %d\n", fnic->cq_count);
219+
shost_printk(KERN_INFO, fnic->lport->host,
220+
"vNIC fw resources intr_count: %d\n", fnic->intr_count);
196221
}
197222

198223
void fnic_free_vnic_resources(struct fnic *fnic)
@@ -234,10 +259,15 @@ int fnic_alloc_vnic_resources(struct fnic *fnic)
234259
intr_mode == VNIC_DEV_INTR_MODE_MSIX ?
235260
"MSI-X" : "unknown");
236261

237-
shost_printk(KERN_INFO, fnic->lport->host, "vNIC resources avail: "
238-
"wq %d cp_wq %d raw_wq %d rq %d cq %d intr %d\n",
239-
fnic->wq_count, fnic->wq_copy_count, fnic->raw_wq_count,
240-
fnic->rq_count, fnic->cq_count, fnic->intr_count);
262+
shost_printk(KERN_INFO, fnic->lport->host,
263+
"vNIC resources avail: wq %d cp_wq %d raw_wq %d rq %d",
264+
fnic->wq_count, fnic->wq_copy_count,
265+
fnic->raw_wq_count, fnic->rq_count);
266+
267+
shost_printk(KERN_INFO, fnic->lport->host,
268+
"vNIC resources avail: cq %d intr %d cpy-wq desc count %d\n",
269+
fnic->cq_count, fnic->intr_count,
270+
fnic->config.wq_copy_desc_count);
241271

242272
/* Allocate Raw WQ used for FCS frames */
243273
for (i = 0; i < fnic->raw_wq_count; i++) {

0 commit comments

Comments
 (0)