39
39
40
40
#define DRV_NAME "fnic"
41
41
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
42
- #define DRV_VERSION "1.6 .0.53 "
42
+ #define DRV_VERSION "1.7 .0.0 "
43
43
#define PFX DRV_NAME ": "
44
44
#define DFX DRV_NAME "%d: "
45
45
48
48
#define FNIC_MIN_IO_REQ 256 /* Min IO throttle count */
49
49
#define FNIC_MAX_IO_REQ 1024 /* scsi_cmnd tag map entries */
50
50
#define FNIC_DFLT_IO_REQ 256 /* Default scsi_cmnd tag map entries */
51
- #define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */
52
51
#define FNIC_DFLT_QUEUE_DEPTH 256
53
52
#define FNIC_STATS_RATE_LIMIT 4 /* limit rate at which stats are pulled up */
54
53
89
88
#define FNIC_DEV_RST_ABTS_PENDING BIT(21)
90
89
91
90
/*
92
- * Usage of the scsi_cmnd scratchpad .
91
+ * fnic private data per SCSI command .
93
92
* These fields are locked by the hashed io_req_lock.
94
93
*/
95
- #define CMD_SP (Cmnd ) ((Cmnd)->SCp.ptr)
96
- #define CMD_STATE (Cmnd ) ((Cmnd)->SCp.phase)
97
- #define CMD_ABTS_STATUS (Cmnd ) ((Cmnd)->SCp.Message)
98
- #define CMD_LR_STATUS (Cmnd ) ((Cmnd)->SCp.have_data_in)
99
- #define CMD_TAG (Cmnd ) ((Cmnd)->SCp.sent_command)
100
- #define CMD_FLAGS (Cmnd ) ((Cmnd)->SCp.Status)
94
+ struct fnic_cmd_priv {
95
+ struct fnic_io_req * io_req ;
96
+ enum fnic_ioreq_state state ;
97
+ u32 flags ;
98
+ u16 abts_status ;
99
+ u16 lr_status ;
100
+ };
101
+
102
+ static inline struct fnic_cmd_priv * fnic_priv (struct scsi_cmnd * cmd )
103
+ {
104
+ return scsi_cmd_priv (cmd );
105
+ }
106
+
107
+ static inline u64 fnic_flags_and_state (struct scsi_cmnd * cmd )
108
+ {
109
+ struct fnic_cmd_priv * fcmd = fnic_priv (cmd );
110
+
111
+ return ((u64 )fcmd -> flags << 32 ) | fcmd -> state ;
112
+ }
101
113
102
114
#define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */
103
115
108
120
#define FNIC_ABT_TERM_DELAY_TIMEOUT 500 /* mSec */
109
121
110
122
#define FNIC_MAX_FCP_TARGET 256
111
-
123
+ #define FNIC_PCI_OFFSET 2
112
124
/**
113
125
* state_flags to identify host state along along with fnic's state
114
126
**/
@@ -143,39 +155,56 @@ do { \
143
155
} while (0); \
144
156
} while (0)
145
157
146
- #define FNIC_MAIN_DBG (kern_level , host , fmt , args ...) \
158
+ #define FNIC_MAIN_DBG (kern_level , host , fnic_num , fmt , args ...) \
147
159
FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING, \
148
- shost_printk(kern_level, host, fmt, ##args);)
160
+ shost_printk(kern_level, host, \
161
+ "fnic<%d>: %s: %d: " fmt, fnic_num,\
162
+ __func__, __LINE__, ##args);)
149
163
150
- #define FNIC_FCS_DBG (kern_level , host , fmt , args ...) \
164
+ #define FNIC_FCS_DBG (kern_level , host , fnic_num , fmt , args ...) \
151
165
FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING, \
152
- shost_printk(kern_level, host, fmt, ##args);)
166
+ shost_printk(kern_level, host, \
167
+ "fnic<%d>: %s: %d: " fmt, fnic_num,\
168
+ __func__, __LINE__, ##args);)
153
169
154
- #define FNIC_SCSI_DBG (kern_level , host , fmt , args ...) \
170
+ #define FNIC_SCSI_DBG (kern_level , host , fnic_num , fmt , args ...) \
155
171
FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING, \
156
- shost_printk(kern_level, host, fmt, ##args);)
172
+ shost_printk(kern_level, host, \
173
+ "fnic<%d>: %s: %d: " fmt, fnic_num,\
174
+ __func__, __LINE__, ##args);)
157
175
158
- #define FNIC_ISR_DBG (kern_level , host , fmt , args ...) \
176
+ #define FNIC_ISR_DBG (kern_level , host , fnic_num , fmt , args ...) \
159
177
FNIC_CHECK_LOGGING(FNIC_ISR_LOGGING, \
160
- shost_printk(kern_level, host, fmt, ##args);)
178
+ shost_printk(kern_level, host, \
179
+ "fnic<%d>: %s: %d: " fmt, fnic_num,\
180
+ __func__, __LINE__, ##args);)
161
181
162
182
#define FNIC_MAIN_NOTE (kern_level , host , fmt , args ...) \
163
183
shost_printk(kern_level, host, fmt, ##args)
164
184
185
+ #define FNIC_WQ_COPY_MAX 64
186
+ #define FNIC_WQ_MAX 1
187
+ #define FNIC_RQ_MAX 1
188
+ #define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
189
+ #define FNIC_DFLT_IO_COMPLETIONS 256
190
+
191
+ #define FNIC_MQ_CQ_INDEX 2
192
+
165
193
extern const char * fnic_state_str [];
166
194
167
195
enum fnic_intx_intr_index {
168
196
FNIC_INTX_WQ_RQ_COPYWQ ,
169
- FNIC_INTX_ERR ,
197
+ FNIC_INTX_DUMMY ,
170
198
FNIC_INTX_NOTIFY ,
199
+ FNIC_INTX_ERR ,
171
200
FNIC_INTX_INTR_MAX ,
172
201
};
173
202
174
203
enum fnic_msix_intr_index {
175
204
FNIC_MSIX_RQ ,
176
205
FNIC_MSIX_WQ ,
177
206
FNIC_MSIX_WQ_COPY ,
178
- FNIC_MSIX_ERR_NOTIFY ,
207
+ FNIC_MSIX_ERR_NOTIFY = FNIC_MSIX_WQ_COPY + FNIC_WQ_COPY_MAX ,
179
208
FNIC_MSIX_INTR_MAX ,
180
209
};
181
210
@@ -184,6 +213,7 @@ struct fnic_msix_entry {
184
213
char devname [IFNAMSIZ + 11 ];
185
214
irqreturn_t (* isr )(int , void * );
186
215
void * devid ;
216
+ int irq_num ;
187
217
};
188
218
189
219
enum fnic_state {
@@ -193,12 +223,6 @@ enum fnic_state {
193
223
FNIC_IN_ETH_TRANS_FC_MODE ,
194
224
};
195
225
196
- #define FNIC_WQ_COPY_MAX 1
197
- #define FNIC_WQ_MAX 1
198
- #define FNIC_RQ_MAX 1
199
- #define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
200
- #define FNIC_DFLT_IO_COMPLETIONS 256
201
-
202
226
struct mempool ;
203
227
204
228
enum fnic_evt {
@@ -213,8 +237,16 @@ struct fnic_event {
213
237
enum fnic_evt event ;
214
238
};
215
239
240
+ struct fnic_cpy_wq {
241
+ unsigned long hw_lock_flags ;
242
+ u16 active_ioreq_count ;
243
+ u16 ioreq_table_size ;
244
+ ____cacheline_aligned struct fnic_io_req * * io_req_table ;
245
+ };
246
+
216
247
/* Per-instance private data structure */
217
248
struct fnic {
249
+ int fnic_num ;
218
250
struct fc_lport * lport ;
219
251
struct fcoe_ctlr ctlr ; /* FIP FCoE controller structure */
220
252
struct vnic_dev_bar bar0 ;
@@ -235,6 +267,9 @@ struct fnic {
235
267
unsigned int wq_count ;
236
268
unsigned int cq_count ;
237
269
270
+ struct mutex sgreset_mutex ;
271
+ spinlock_t sgreset_lock ; /* lock for sgreset */
272
+ struct scsi_cmnd * sgreset_sc ;
238
273
struct dentry * fnic_stats_debugfs_host ;
239
274
struct dentry * fnic_stats_debugfs_file ;
240
275
struct dentry * fnic_reset_debugfs_file ;
@@ -278,10 +313,11 @@ struct fnic {
278
313
struct fnic_host_tag * tags ;
279
314
mempool_t * io_req_pool ;
280
315
mempool_t * io_sgl_pool [FNIC_SGL_NUM_CACHES ];
281
- spinlock_t io_req_lock [FNIC_IO_LOCKS ]; /* locks for scsi cmnds */
282
316
317
+ unsigned int copy_wq_base ;
283
318
struct work_struct link_work ;
284
319
struct work_struct frame_work ;
320
+ struct work_struct flush_work ;
285
321
struct sk_buff_head frame_queue ;
286
322
struct sk_buff_head tx_queue ;
287
323
@@ -298,7 +334,9 @@ struct fnic {
298
334
/*** FIP related data members -- end ***/
299
335
300
336
/* copy work queue cache line section */
301
- ____cacheline_aligned struct vnic_wq_copy wq_copy [FNIC_WQ_COPY_MAX ];
337
+ ____cacheline_aligned struct vnic_wq_copy hw_copy_wq [FNIC_WQ_COPY_MAX ];
338
+ ____cacheline_aligned struct fnic_cpy_wq sw_copy_wq [FNIC_WQ_COPY_MAX ];
339
+
302
340
/* completion queue cache line section */
303
341
____cacheline_aligned struct vnic_cq cq [FNIC_CQ_MAX ];
304
342
@@ -326,6 +364,7 @@ extern struct device_attribute *fnic_attrs[];
326
364
327
365
void fnic_clear_intr_mode (struct fnic * fnic );
328
366
int fnic_set_intr_mode (struct fnic * fnic );
367
+ int fnic_set_intr_mode_msix (struct fnic * fnic );
329
368
void fnic_free_intr (struct fnic * fnic );
330
369
int fnic_request_intr (struct fnic * fnic );
331
370
@@ -337,7 +376,7 @@ void fnic_handle_event(struct work_struct *work);
337
376
int fnic_rq_cmpl_handler (struct fnic * fnic , int );
338
377
int fnic_alloc_rq_frame (struct vnic_rq * rq );
339
378
void fnic_free_rq_buf (struct vnic_rq * rq , struct vnic_rq_buf * buf );
340
- void fnic_flush_tx (struct fnic * );
379
+ void fnic_flush_tx (struct work_struct * work );
341
380
void fnic_eth_send (struct fcoe_ctlr * , struct sk_buff * skb );
342
381
void fnic_set_port_id (struct fc_lport * , u32 , struct fc_frame * );
343
382
void fnic_update_mac (struct fc_lport * , u8 * new );
@@ -352,15 +391,15 @@ void fnic_scsi_cleanup(struct fc_lport *);
352
391
void fnic_scsi_abort_io (struct fc_lport * );
353
392
void fnic_empty_scsi_cleanup (struct fc_lport * );
354
393
void fnic_exch_mgr_reset (struct fc_lport * , u32 , u32 );
355
- int fnic_wq_copy_cmpl_handler (struct fnic * fnic , int );
394
+ int fnic_wq_copy_cmpl_handler (struct fnic * fnic , int copy_work_to_do , unsigned int cq_index );
356
395
int fnic_wq_cmpl_handler (struct fnic * fnic , int );
357
396
int fnic_flogi_reg_handler (struct fnic * fnic , u32 );
358
397
void fnic_wq_copy_cleanup_handler (struct vnic_wq_copy * wq ,
359
398
struct fcpio_host_req * desc );
360
399
int fnic_fw_reset_handler (struct fnic * fnic );
361
400
void fnic_terminate_rport_io (struct fc_rport * );
362
401
const char * fnic_state_to_str (unsigned int state );
363
-
402
+ void fnic_mq_map_queues_cpus ( struct Scsi_Host * host );
364
403
void fnic_log_q_error (struct fnic * fnic );
365
404
void fnic_handle_link_event (struct fnic * fnic );
366
405
0 commit comments