diff mbox series

[v2,06/13] scsi: fnic: Refactor and redefine fnic.h for multiqueue

Message ID 20231027180302.418676-7-kartilak@cisco.com
State Superseded
Headers show
Series Introduce support for multiqueue (MQ) in fnic | expand

Commit Message

Karan Tilak Kumar Oct. 27, 2023, 6:02 p.m. UTC
Refactor and re-define values in fnic.h to implement
multiqueue(MQ) functionality.

VIC firmware allows fnic to create up to 64 copy
workqueues. Update the copy workqueue max to 64.
Modify the interrupt index to be in sync with the firmware
to support MQ.
Add irq number to the MSIX entry.
Define a software workqueue table to track the status of
io_reqs. Define a base for the copy workqueue.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
---
 drivers/scsi/fnic/fnic.h | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

Comments

Hannes Reinecke Nov. 2, 2023, 7:36 a.m. UTC | #1
On 10/27/23 20:02, Karan Tilak Kumar wrote:
> Refactor and re-define values in fnic.h to implement
> multiqueue(MQ) functionality.
> 
> VIC firmware allows fnic to create up to 64 copy
> workqueues. Update the copy workqueue max to 64.
> Modify the interrupt index to be in sync with the firmware
> to support MQ.
> Add irq number to the MSIX entry.
> Define a software workqueue table to track the status of
> io_reqs. Define a base for the copy workqueue.
> 
> Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
> Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
> ---
>   drivers/scsi/fnic/fnic.h | 30 ++++++++++++++++++++++--------
>   1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
> index 9fd01a867788..f4390fc96323 100644
> --- a/drivers/scsi/fnic/fnic.h
> +++ b/drivers/scsi/fnic/fnic.h
> @@ -163,12 +163,21 @@ do {								\
>   #define FNIC_MAIN_NOTE(kern_level, host, fmt, args...)          \
>   	shost_printk(kern_level, host, fmt, ##args)
>   
> +#define FNIC_WQ_COPY_MAX 64
> +#define FNIC_WQ_MAX 1
> +#define FNIC_RQ_MAX 1
> +#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
> +#define FNIC_DFLT_IO_COMPLETIONS 256
> +
> +#define FNIC_MQ_CQ_INDEX        2
> +
>   extern const char *fnic_state_str[];
>   
>   enum fnic_intx_intr_index {
>   	FNIC_INTX_WQ_RQ_COPYWQ,
> -	FNIC_INTX_ERR,
> +	FNIC_INTX_DUMMY,
>   	FNIC_INTX_NOTIFY,
> +	FNIC_INTX_ERR,
>   	FNIC_INTX_INTR_MAX,
>   };
>   
> @@ -176,7 +185,7 @@ enum fnic_msix_intr_index {
>   	FNIC_MSIX_RQ,
>   	FNIC_MSIX_WQ,
>   	FNIC_MSIX_WQ_COPY,
> -	FNIC_MSIX_ERR_NOTIFY,
> +	FNIC_MSIX_ERR_NOTIFY = FNIC_MSIX_WQ_COPY + FNIC_WQ_COPY_MAX,
>   	FNIC_MSIX_INTR_MAX,
>   };
>   
> @@ -185,6 +194,7 @@ struct fnic_msix_entry {
>   	char devname[IFNAMSIZ + 11];
>   	irqreturn_t (*isr)(int, void *);
>   	void *devid;
> +	int irq_num;
>   };
>   
>   enum fnic_state {
> @@ -194,12 +204,6 @@ enum fnic_state {
>   	FNIC_IN_ETH_TRANS_FC_MODE,
>   };
>   
> -#define FNIC_WQ_COPY_MAX 1
> -#define FNIC_WQ_MAX 1
> -#define FNIC_RQ_MAX 1
> -#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
> -#define FNIC_DFLT_IO_COMPLETIONS 256
> -
>   struct mempool;
>   
>   enum fnic_evt {
> @@ -214,6 +218,13 @@ struct fnic_event {
>   	enum fnic_evt event;
>   };
>   
> +struct fnic_cpy_wq {
> +	unsigned long hw_lock_flags;
> +	u16 active_ioreq_count;
> +	u16 ioreq_table_size;
> +	____cacheline_aligned struct fnic_io_req **io_req_table;
> +};
> +
>   /* Per-instance private data structure */
>   struct fnic {
>   	int fnic_num;
> @@ -283,6 +294,7 @@ struct fnic {
>   	mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES];
>   	spinlock_t io_req_lock[FNIC_IO_LOCKS];	/* locks for scsi cmnds */
>   
> +	unsigned int cpy_wq_base;

Please name it 'copy_wq_base'; all other instances in the driver
always names the structures 'copy', not 'cpy' too.
You are not really saving anything by omitting a single character.

Cheers,

Hannes
Karan Tilak Kumar Nov. 6, 2023, 8:11 p.m. UTC | #2
On Thursday, November 2, 2023 12:37 AM, Hannes Reinecke <hare@suse.de> wrote:
>
> Please name it 'copy_wq_base'; all other instances in the driver always names the structures 'copy', not 'cpy' too.
> You are not really saving anything by omitting a single character.

Sure, I'll make suitable changes in v3.

Regards,
Karan
diff mbox series

Patch

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 9fd01a867788..f4390fc96323 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -163,12 +163,21 @@  do {								\
 #define FNIC_MAIN_NOTE(kern_level, host, fmt, args...)          \
 	shost_printk(kern_level, host, fmt, ##args)
 
+#define FNIC_WQ_COPY_MAX 64
+#define FNIC_WQ_MAX 1
+#define FNIC_RQ_MAX 1
+#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
+#define FNIC_DFLT_IO_COMPLETIONS 256
+
+#define FNIC_MQ_CQ_INDEX        2
+
 extern const char *fnic_state_str[];
 
 enum fnic_intx_intr_index {
 	FNIC_INTX_WQ_RQ_COPYWQ,
-	FNIC_INTX_ERR,
+	FNIC_INTX_DUMMY,
 	FNIC_INTX_NOTIFY,
+	FNIC_INTX_ERR,
 	FNIC_INTX_INTR_MAX,
 };
 
@@ -176,7 +185,7 @@  enum fnic_msix_intr_index {
 	FNIC_MSIX_RQ,
 	FNIC_MSIX_WQ,
 	FNIC_MSIX_WQ_COPY,
-	FNIC_MSIX_ERR_NOTIFY,
+	FNIC_MSIX_ERR_NOTIFY = FNIC_MSIX_WQ_COPY + FNIC_WQ_COPY_MAX,
 	FNIC_MSIX_INTR_MAX,
 };
 
@@ -185,6 +194,7 @@  struct fnic_msix_entry {
 	char devname[IFNAMSIZ + 11];
 	irqreturn_t (*isr)(int, void *);
 	void *devid;
+	int irq_num;
 };
 
 enum fnic_state {
@@ -194,12 +204,6 @@  enum fnic_state {
 	FNIC_IN_ETH_TRANS_FC_MODE,
 };
 
-#define FNIC_WQ_COPY_MAX 1
-#define FNIC_WQ_MAX 1
-#define FNIC_RQ_MAX 1
-#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
-#define FNIC_DFLT_IO_COMPLETIONS 256
-
 struct mempool;
 
 enum fnic_evt {
@@ -214,6 +218,13 @@  struct fnic_event {
 	enum fnic_evt event;
 };
 
+struct fnic_cpy_wq {
+	unsigned long hw_lock_flags;
+	u16 active_ioreq_count;
+	u16 ioreq_table_size;
+	____cacheline_aligned struct fnic_io_req **io_req_table;
+};
+
 /* Per-instance private data structure */
 struct fnic {
 	int fnic_num;
@@ -283,6 +294,7 @@  struct fnic {
 	mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES];
 	spinlock_t io_req_lock[FNIC_IO_LOCKS];	/* locks for scsi cmnds */
 
+	unsigned int cpy_wq_base;
 	struct work_struct link_work;
 	struct work_struct frame_work;
 	struct sk_buff_head frame_queue;
@@ -302,6 +314,8 @@  struct fnic {
 
 	/* copy work queue cache line section */
 	____cacheline_aligned struct vnic_wq_copy hw_copy_wq[FNIC_WQ_COPY_MAX];
+	____cacheline_aligned struct fnic_cpy_wq sw_copy_wq[FNIC_WQ_COPY_MAX];
+
 	/* completion queue cache line section */
 	____cacheline_aligned struct vnic_cq cq[FNIC_CQ_MAX];