aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cnic.h')
-rw-r--r--drivers/net/cnic.h146
1 files changed, 115 insertions, 31 deletions
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h
index 275c36114d85..3367a6d3a774 100644
--- a/drivers/net/cnic.h
+++ b/drivers/net/cnic.h
@@ -12,6 +12,13 @@
12#ifndef CNIC_H 12#ifndef CNIC_H
13#define CNIC_H 13#define CNIC_H
14 14
15#define HC_INDEX_ISCSI_EQ_CONS 6
16
17#define HC_INDEX_FCOE_EQ_CONS 3
18
19#define HC_SP_INDEX_ETH_ISCSI_CQ_CONS 5
20#define HC_SP_INDEX_ETH_ISCSI_RX_CQ_CONS 1
21
15#define KWQ_PAGE_CNT 4 22#define KWQ_PAGE_CNT 4
16#define KCQ_PAGE_CNT 16 23#define KCQ_PAGE_CNT 16
17 24
@@ -75,7 +82,7 @@ struct cnic_redirect_entry {
75#define MAX_ISCSI_TBL_SZ 256 82#define MAX_ISCSI_TBL_SZ 256
76 83
77#define CNIC_LOCAL_PORT_MIN 60000 84#define CNIC_LOCAL_PORT_MIN 60000
78#define CNIC_LOCAL_PORT_MAX 61000 85#define CNIC_LOCAL_PORT_MAX 61024
79#define CNIC_LOCAL_PORT_RANGE (CNIC_LOCAL_PORT_MAX - CNIC_LOCAL_PORT_MIN) 86#define CNIC_LOCAL_PORT_RANGE (CNIC_LOCAL_PORT_MAX - CNIC_LOCAL_PORT_MIN)
80 87
81#define KWQE_CNT (BCM_PAGE_SIZE / sizeof(struct kwqe)) 88#define KWQE_CNT (BCM_PAGE_SIZE / sizeof(struct kwqe))
@@ -161,8 +168,9 @@ struct cnic_context {
161 wait_queue_head_t waitq; 168 wait_queue_head_t waitq;
162 int wait_cond; 169 int wait_cond;
163 unsigned long timestamp; 170 unsigned long timestamp;
164 u32 ctx_flags; 171 unsigned long ctx_flags;
165#define CTX_FL_OFFLD_START 0x00000001 172#define CTX_FL_OFFLD_START 0
173#define CTX_FL_DELETE_WAIT 1
166 u8 ulp_proto_id; 174 u8 ulp_proto_id;
167 union { 175 union {
168 struct cnic_iscsi *iscsi; 176 struct cnic_iscsi *iscsi;
@@ -179,6 +187,31 @@ struct kcq_info {
179 u32 io_addr; 187 u32 io_addr;
180}; 188};
181 189
190struct iro {
191 u32 base;
192 u16 m1;
193 u16 m2;
194 u16 m3;
195 u16 size;
196};
197
198struct cnic_uio_dev {
199 struct uio_info cnic_uinfo;
200 u32 uio_dev;
201
202 int l2_ring_size;
203 void *l2_ring;
204 dma_addr_t l2_ring_map;
205
206 int l2_buf_size;
207 void *l2_buf;
208 dma_addr_t l2_buf_map;
209
210 struct cnic_dev *dev;
211 struct pci_dev *pdev;
212 struct list_head list;
213};
214
182struct cnic_local { 215struct cnic_local {
183 216
184 spinlock_t cnic_ulp_lock; 217 spinlock_t cnic_ulp_lock;
@@ -187,24 +220,21 @@ struct cnic_local {
187#define ULP_F_INIT 0 220#define ULP_F_INIT 0
188#define ULP_F_START 1 221#define ULP_F_START 1
189#define ULP_F_CALL_PENDING 2 222#define ULP_F_CALL_PENDING 2
190 struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; 223 struct cnic_ulp_ops __rcu *ulp_ops[MAX_CNIC_ULP_TYPE];
191 224
192 unsigned long cnic_local_flags; 225 unsigned long cnic_local_flags;
193#define CNIC_LCL_FL_KWQ_INIT 0x0 226#define CNIC_LCL_FL_KWQ_INIT 0x0
194#define CNIC_LCL_FL_L2_WAIT 0x1 227#define CNIC_LCL_FL_L2_WAIT 0x1
228#define CNIC_LCL_FL_RINGS_INITED 0x2
229#define CNIC_LCL_FL_STOP_ISCSI 0x4
195 230
196 struct cnic_dev *dev; 231 struct cnic_dev *dev;
197 232
198 struct cnic_eth_dev *ethdev; 233 struct cnic_eth_dev *ethdev;
199 234
200 void *l2_ring; 235 struct cnic_uio_dev *udev;
201 dma_addr_t l2_ring_map;
202 int l2_ring_size;
203 int l2_rx_ring_size;
204 236
205 void *l2_buf; 237 int l2_rx_ring_size;
206 dma_addr_t l2_buf_map;
207 int l2_buf_size;
208 int l2_single_buf_size; 238 int l2_single_buf_size;
209 239
210 u16 *rx_cons_ptr; 240 u16 *rx_cons_ptr;
@@ -212,6 +242,9 @@ struct cnic_local {
212 u16 rx_cons; 242 u16 rx_cons;
213 u16 tx_cons; 243 u16 tx_cons;
214 244
245 struct iro *iro_arr;
246#define IRO (((struct cnic_local *) dev->cnic_priv)->iro_arr)
247
215 struct cnic_dma kwq_info; 248 struct cnic_dma kwq_info;
216 struct kwqe **kwq; 249 struct kwqe **kwq;
217 250
@@ -226,16 +259,21 @@ struct cnic_local {
226 u16 kwq_con_idx; 259 u16 kwq_con_idx;
227 260
228 struct kcq_info kcq1; 261 struct kcq_info kcq1;
262 struct kcq_info kcq2;
229 263
230 union { 264 union {
231 void *gen; 265 void *gen;
232 struct status_block_msix *bnx2; 266 struct status_block_msix *bnx2;
233 struct host_status_block *bnx2x; 267 struct host_hc_status_block_e1x *bnx2x_e1x;
268 /* index values - which counter to update */
269 #define SM_RX_ID 0
270 #define SM_TX_ID 1
234 } status_blk; 271 } status_blk;
235 272
236 struct host_def_status_block *bnx2x_def_status_blk; 273 struct host_sp_status_block *bnx2x_def_status_blk;
237 274
238 u32 status_blk_num; 275 u32 status_blk_num;
276 u32 bnx2x_igu_sb_id;
239 u32 int_num; 277 u32 int_num;
240 u32 last_status_idx; 278 u32 last_status_idx;
241 struct tasklet_struct cnic_irq_task; 279 struct tasklet_struct cnic_irq_task;
@@ -254,6 +292,10 @@ struct cnic_local {
254 atomic_t iscsi_conn; 292 atomic_t iscsi_conn;
255 u32 iscsi_start_cid; 293 u32 iscsi_start_cid;
256 294
295 u32 fcoe_init_cid;
296 u32 fcoe_start_cid;
297 struct cnic_id_tbl fcoe_cid_tbl;
298
257 u32 max_cid_space; 299 u32 max_cid_space;
258 300
259 /* per connection parameters */ 301 /* per connection parameters */
@@ -264,6 +306,8 @@ struct cnic_local {
264 int hq_size; 306 int hq_size;
265 int num_cqs; 307 int num_cqs;
266 308
309 struct delayed_work delete_task;
310
267 struct cnic_ctx *ctx_arr; 311 struct cnic_ctx *ctx_arr;
268 int ctx_blks; 312 int ctx_blks;
269 int ctx_blk_size; 313 int ctx_blk_size;
@@ -272,11 +316,9 @@ struct cnic_local {
272 316
273 u32 chip_id; 317 u32 chip_id;
274 int func; 318 int func;
319 u32 pfid;
275 u32 shmem_base; 320 u32 shmem_base;
276 321
277 u32 uio_dev;
278 struct uio_info *cnic_uinfo;
279
280 struct cnic_ops *cnic_ops; 322 struct cnic_ops *cnic_ops;
281 int (*start_hw)(struct cnic_dev *); 323 int (*start_hw)(struct cnic_dev *);
282 void (*stop_hw)(struct cnic_dev *); 324 void (*stop_hw)(struct cnic_dev *);
@@ -320,11 +362,6 @@ struct bnx2x_bd_chain_next {
320#define BNX2X_CONTEXT_MEM_SIZE 1024 362#define BNX2X_CONTEXT_MEM_SIZE 1024
321#define BNX2X_FCOE_CID 16 363#define BNX2X_FCOE_CID 16
322 364
323/* iSCSI client IDs are 17, 19, 21, 23 */
324#define BNX2X_ISCSI_BASE_CL_ID 17
325#define BNX2X_ISCSI_CL_ID(vn) (BNX2X_ISCSI_BASE_CL_ID + ((vn) << 1))
326
327#define BNX2X_ISCSI_L2_CID 17
328#define BNX2X_ISCSI_START_CID 18 365#define BNX2X_ISCSI_START_CID 18
329#define BNX2X_ISCSI_NUM_CONNECTIONS 128 366#define BNX2X_ISCSI_NUM_CONNECTIONS 128
330#define BNX2X_ISCSI_TASK_CONTEXT_SIZE 128 367#define BNX2X_ISCSI_TASK_CONTEXT_SIZE 128
@@ -335,18 +372,40 @@ struct bnx2x_bd_chain_next {
335#define BNX2X_ISCSI_GLB_BUF_SIZE 64 372#define BNX2X_ISCSI_GLB_BUF_SIZE 64
336#define BNX2X_ISCSI_PBL_NOT_CACHED 0xff 373#define BNX2X_ISCSI_PBL_NOT_CACHED 0xff
337#define BNX2X_ISCSI_PDU_HEADER_NOT_CACHED 0xff 374#define BNX2X_ISCSI_PDU_HEADER_NOT_CACHED 0xff
338#define BNX2X_HW_CID(x, func) ((x) | (((func) % PORT_MAX) << 23) | \ 375
339 (((func) >> 1) << 17)) 376#define BNX2X_FCOE_NUM_CONNECTIONS 128
340#define BNX2X_SW_CID(x) (x & 0x1ffff) 377
378#define BNX2X_FCOE_L5_CID_BASE MAX_ISCSI_TBL_SZ
379
380#define BNX2X_CHIP_NUM_57710 0x164e
341#define BNX2X_CHIP_NUM_57711 0x164f 381#define BNX2X_CHIP_NUM_57711 0x164f
342#define BNX2X_CHIP_NUM_57711E 0x1650 382#define BNX2X_CHIP_NUM_57711E 0x1650
383#define BNX2X_CHIP_NUM_57712 0x1662
384#define BNX2X_CHIP_NUM_57712E 0x1663
385#define BNX2X_CHIP_NUM_57713 0x1651
386#define BNX2X_CHIP_NUM_57713E 0x1652
387
343#define BNX2X_CHIP_NUM(x) (x >> 16) 388#define BNX2X_CHIP_NUM(x) (x >> 16)
389#define BNX2X_CHIP_IS_57710(x) \
390 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57710)
344#define BNX2X_CHIP_IS_57711(x) \ 391#define BNX2X_CHIP_IS_57711(x) \
345 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711) 392 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711)
346#define BNX2X_CHIP_IS_57711E(x) \ 393#define BNX2X_CHIP_IS_57711E(x) \
347 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711E) 394 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711E)
348#define BNX2X_CHIP_IS_E1H(x) \ 395#define BNX2X_CHIP_IS_E1H(x) \
349 (BNX2X_CHIP_IS_57711(x) || BNX2X_CHIP_IS_57711E(x)) 396 (BNX2X_CHIP_IS_57711(x) || BNX2X_CHIP_IS_57711E(x))
397#define BNX2X_CHIP_IS_57712(x) \
398 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57712)
399#define BNX2X_CHIP_IS_57712E(x) \
400 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57712E)
401#define BNX2X_CHIP_IS_57713(x) \
402 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57713)
403#define BNX2X_CHIP_IS_57713E(x) \
404 (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57713E)
405#define BNX2X_CHIP_IS_E2(x) \
406 (BNX2X_CHIP_IS_57712(x) || BNX2X_CHIP_IS_57712E(x) || \
407 BNX2X_CHIP_IS_57713(x) || BNX2X_CHIP_IS_57713E(x))
408
350#define IS_E1H_OFFSET BNX2X_CHIP_IS_E1H(cp->chip_id) 409#define IS_E1H_OFFSET BNX2X_CHIP_IS_E1H(cp->chip_id)
351 410
352#define BNX2X_RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_bd)) 411#define BNX2X_RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_bd))
@@ -358,19 +417,44 @@ struct bnx2x_bd_chain_next {
358 (BNX2X_MAX_RCQ_DESC_CNT - 1)) ? \ 417 (BNX2X_MAX_RCQ_DESC_CNT - 1)) ? \
359 ((x) + 2) : ((x) + 1) 418 ((x) + 2) : ((x) + 1)
360 419
361#define BNX2X_DEF_SB_ID 16 420#define BNX2X_DEF_SB_ID HC_SP_SB_ID
362 421
363#define BNX2X_ISCSI_RX_SB_INDEX_NUM \ 422#define BNX2X_SHMEM_MF_BLK_OFFSET 0x7e4
364 ((HC_INDEX_DEF_U_ETH_ISCSI_RX_CQ_CONS << \
365 USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER_SHIFT) & \
366 USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER)
367 423
368#define BNX2X_SHMEM_ADDR(base, field) (base + \ 424#define BNX2X_SHMEM_ADDR(base, field) (base + \
369 offsetof(struct shmem_region, field)) 425 offsetof(struct shmem_region, field))
370 426
371#define CNIC_PORT(cp) ((cp)->func % PORT_MAX) 427#define BNX2X_SHMEM2_ADDR(base, field) (base + \
428 offsetof(struct shmem2_region, field))
429
430#define BNX2X_SHMEM2_HAS(base, field) \
431 ((base) && \
432 (CNIC_RD(dev, BNX2X_SHMEM2_ADDR(base, size)) > \
433 offsetof(struct shmem2_region, field)))
434
435#define BNX2X_MF_CFG_ADDR(base, field) \
436 ((base) + offsetof(struct mf_cfg, field))
437
438#ifndef ETH_MAX_RX_CLIENTS_E2
439#define ETH_MAX_RX_CLIENTS_E2 ETH_MAX_RX_CLIENTS_E1H
440#endif
441
442#define CNIC_PORT(cp) ((cp)->pfid & 1)
372#define CNIC_FUNC(cp) ((cp)->func) 443#define CNIC_FUNC(cp) ((cp)->func)
373#define CNIC_E1HVN(cp) ((cp)->func >> 1) 444#define CNIC_PATH(cp) (!BNX2X_CHIP_IS_E2(cp->chip_id) ? 0 :\
445 (CNIC_FUNC(cp) & 1))
446#define CNIC_E1HVN(cp) ((cp)->pfid >> 1)
447
448#define BNX2X_HW_CID(cp, x) ((CNIC_PORT(cp) << 23) | \
449 (CNIC_E1HVN(cp) << 17) | (x))
450
451#define BNX2X_SW_CID(x) (x & 0x1ffff)
452
453#define BNX2X_CL_QZONE_ID(cp, cli) \
454 (cli + (CNIC_PORT(cp) * (BNX2X_CHIP_IS_E2(cp->chip_id) ?\
455 ETH_MAX_RX_CLIENTS_E2 : \
456 ETH_MAX_RX_CLIENTS_E1H)))
374 457
458#define TCP_TSTORM_OOO_DROP_AND_PROC_ACK (0<<4)
375#endif 459#endif
376 460