Skip to content

Commit 554a148

Browse files
Karan Tilak Kumarmartinkpetersen
authored andcommitted
scsi: fnic: Refactor and redefine fnic.h for multiqueue
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 <[email protected]> Reviewed-by: Arulprabhu Ponnusamy <[email protected]> Signed-off-by: Karan Tilak Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8c2a6f8 commit 554a148

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

drivers/scsi/fnic/fnic.h

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,29 @@ do { \
167167
#define FNIC_MAIN_NOTE(kern_level, host, fmt, args...) \
168168
shost_printk(kern_level, host, fmt, ##args)
169169

170+
#define FNIC_WQ_COPY_MAX 64
171+
#define FNIC_WQ_MAX 1
172+
#define FNIC_RQ_MAX 1
173+
#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
174+
#define FNIC_DFLT_IO_COMPLETIONS 256
175+
176+
#define FNIC_MQ_CQ_INDEX 2
177+
170178
extern const char *fnic_state_str[];
171179

172180
enum fnic_intx_intr_index {
173181
FNIC_INTX_WQ_RQ_COPYWQ,
174-
FNIC_INTX_ERR,
182+
FNIC_INTX_DUMMY,
175183
FNIC_INTX_NOTIFY,
184+
FNIC_INTX_ERR,
176185
FNIC_INTX_INTR_MAX,
177186
};
178187

179188
enum fnic_msix_intr_index {
180189
FNIC_MSIX_RQ,
181190
FNIC_MSIX_WQ,
182191
FNIC_MSIX_WQ_COPY,
183-
FNIC_MSIX_ERR_NOTIFY,
192+
FNIC_MSIX_ERR_NOTIFY = FNIC_MSIX_WQ_COPY + FNIC_WQ_COPY_MAX,
184193
FNIC_MSIX_INTR_MAX,
185194
};
186195

@@ -189,6 +198,7 @@ struct fnic_msix_entry {
189198
char devname[IFNAMSIZ + 11];
190199
irqreturn_t (*isr)(int, void *);
191200
void *devid;
201+
int irq_num;
192202
};
193203

194204
enum fnic_state {
@@ -198,12 +208,6 @@ enum fnic_state {
198208
FNIC_IN_ETH_TRANS_FC_MODE,
199209
};
200210

201-
#define FNIC_WQ_COPY_MAX 1
202-
#define FNIC_WQ_MAX 1
203-
#define FNIC_RQ_MAX 1
204-
#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
205-
#define FNIC_DFLT_IO_COMPLETIONS 256
206-
207211
struct mempool;
208212

209213
enum fnic_evt {
@@ -218,6 +222,13 @@ struct fnic_event {
218222
enum fnic_evt event;
219223
};
220224

225+
struct fnic_cpy_wq {
226+
unsigned long hw_lock_flags;
227+
u16 active_ioreq_count;
228+
u16 ioreq_table_size;
229+
____cacheline_aligned struct fnic_io_req **io_req_table;
230+
};
231+
221232
/* Per-instance private data structure */
222233
struct fnic {
223234
int fnic_num;
@@ -289,6 +300,7 @@ struct fnic {
289300
mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES];
290301
spinlock_t io_req_lock[FNIC_IO_LOCKS]; /* locks for scsi cmnds */
291302

303+
unsigned int copy_wq_base;
292304
struct work_struct link_work;
293305
struct work_struct frame_work;
294306
struct sk_buff_head frame_queue;
@@ -308,6 +320,8 @@ struct fnic {
308320

309321
/* copy work queue cache line section */
310322
____cacheline_aligned struct vnic_wq_copy hw_copy_wq[FNIC_WQ_COPY_MAX];
323+
____cacheline_aligned struct fnic_cpy_wq sw_copy_wq[FNIC_WQ_COPY_MAX];
324+
311325
/* completion queue cache line section */
312326
____cacheline_aligned struct vnic_cq cq[FNIC_CQ_MAX];
313327

0 commit comments

Comments
 (0)