linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: fnic: refactor code in fnic probe to initialize scsi layer
@ 2022-07-07 20:51 Karan Tilak Kumar
  2022-07-14  3:21 ` Martin K. Petersen
  2022-07-19  3:08 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Karan Tilak Kumar @ 2022-07-07 20:51 UTC (permalink / raw)
  To: sebaddel
  Cc: arulponn, djhawar, gcboffa, satishkh, gvaradar, jejb,
	martin.petersen, linux-scsi, linux-kernel, Karan Tilak Kumar

Refactor code from fnic probe into a different function so that
scsi layer initialization code is grouped together.
Also, add log messages for better debugging.

Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
---
 drivers/scsi/fnic/fnic_main.c | 45 ++++++++++++++++++++++++++---------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 51e7c344ddc3..a666bf90f384 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -556,6 +556,39 @@ static void fnic_set_vlan(struct fnic *fnic, u16 vlan_id)
 	vnic_dev_set_default_vlan(fnic->vdev, vlan_id);
 }
 
+static int fnic_scsi_drv_init(struct fnic *fnic)
+{
+	struct Scsi_Host *host = fnic->lport->host;
+
+	/* Configure maximum outstanding IO reqs*/
+	if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD)
+		host->can_queue = min_t(u32, FNIC_MAX_IO_REQ,
+					max_t(u32, FNIC_MIN_IO_REQ,
+					fnic->config.io_throttle_count));
+
+	fnic->fnic_max_tag_id = host->can_queue;
+	host->max_lun = fnic->config.luns_per_tgt;
+	host->max_id = FNIC_MAX_FCP_TARGET;
+	host->max_cmd_len = FCOE_MAX_CMD_LEN;
+
+	host->nr_hw_queues = fnic->wq_copy_count;
+	if (host->nr_hw_queues > 1)
+		shost_printk(KERN_ERR, host,
+				"fnic: blk-mq is not supported");
+
+	host->nr_hw_queues = fnic->wq_copy_count = 1;
+
+	shost_printk(KERN_INFO, host,
+			"fnic: can_queue: %d max_lun: %llu",
+			host->can_queue, host->max_lun);
+
+	shost_printk(KERN_INFO, host,
+			"fnic: max_id: %d max_cmd_len: %d nr_hw_queues: %d",
+			host->max_id, host->max_cmd_len, host->nr_hw_queues);
+
+	return 0;
+}
+
 static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct Scsi_Host *host;
@@ -696,17 +729,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto err_out_dev_close;
 	}
 
-	/* Configure Maximum Outstanding IO reqs*/
-	if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) {
-		host->can_queue = min_t(u32, FNIC_MAX_IO_REQ,
-					max_t(u32, FNIC_MIN_IO_REQ,
-					fnic->config.io_throttle_count));
-	}
-	fnic->fnic_max_tag_id = host->can_queue;
-
-	host->max_lun = fnic->config.luns_per_tgt;
-	host->max_id = FNIC_MAX_FCP_TARGET;
-	host->max_cmd_len = FCOE_MAX_CMD_LEN;
+	fnic_scsi_drv_init(fnic);
 
 	fnic_get_res_counts(fnic);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: fnic: refactor code in fnic probe to initialize scsi layer
  2022-07-07 20:51 [PATCH] scsi: fnic: refactor code in fnic probe to initialize scsi layer Karan Tilak Kumar
@ 2022-07-14  3:21 ` Martin K. Petersen
  2022-07-19  3:08 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-07-14  3:21 UTC (permalink / raw)
  To: Karan Tilak Kumar
  Cc: sebaddel, arulponn, djhawar, gcboffa, satishkh, gvaradar, jejb,
	martin.petersen, linux-scsi, linux-kernel


Karan,

> Refactor code from fnic probe into a different function so that scsi
> layer initialization code is grouped together.  Also, add log messages
> for better debugging.

Applied to 5.20/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: fnic: refactor code in fnic probe to initialize scsi layer
  2022-07-07 20:51 [PATCH] scsi: fnic: refactor code in fnic probe to initialize scsi layer Karan Tilak Kumar
  2022-07-14  3:21 ` Martin K. Petersen
@ 2022-07-19  3:08 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-07-19  3:08 UTC (permalink / raw)
  To: sebaddel, Karan Tilak Kumar
  Cc: Martin K . Petersen, gvaradar, djhawar, jejb, satishkh, gcboffa,
	linux-kernel, linux-scsi, arulponn

On Thu, 7 Jul 2022 13:51:55 -0700, Karan Tilak Kumar wrote:

> Refactor code from fnic probe into a different function so that
> scsi layer initialization code is grouped together.
> Also, add log messages for better debugging.
> 
> 

Applied to 5.20/scsi-queue, thanks!

[1/1] scsi: fnic: refactor code in fnic probe to initialize scsi layer
      https://git.kernel.org/mkp/scsi/c/aec95e3a8ded

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-19  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 20:51 [PATCH] scsi: fnic: refactor code in fnic probe to initialize scsi layer Karan Tilak Kumar
2022-07-14  3:21 ` Martin K. Petersen
2022-07-19  3:08 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).