bnx2x.h (a052997ea32164b2466daff8db5f783131184dae) | bnx2x.h (65565884fba67d9254f32d239b0fb6c38fae88aa) |
---|---|
1/* bnx2x.h: Broadcom Everest network driver. 2 * 3 * Copyright (c) 2007-2012 Broadcom Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation. 8 * --- 262 unchanged lines hidden (view full) --- 271 272#define SM_RX_ID 0 273#define SM_TX_ID 1 274 275/* defines for multiple tx priority indices */ 276#define FIRST_TX_ONLY_COS_INDEX 1 277#define FIRST_TX_COS_INDEX 0 278 | 1/* bnx2x.h: Broadcom Everest network driver. 2 * 3 * Copyright (c) 2007-2012 Broadcom Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation. 8 * --- 262 unchanged lines hidden (view full) --- 271 272#define SM_RX_ID 0 273#define SM_TX_ID 1 274 275/* defines for multiple tx priority indices */ 276#define FIRST_TX_ONLY_COS_INDEX 1 277#define FIRST_TX_COS_INDEX 0 278 |
279/* defines for decodeing the fastpath index and the cos index out of the 280 * transmission queue index 281 */ | |
282#define MAX_TXQS_PER_COS FP_SB_MAX_E1x 283 | 279#define MAX_TXQS_PER_COS FP_SB_MAX_E1x 280 |
284#define TXQ_TO_FP(txq_index) ((txq_index) % MAX_TXQS_PER_COS) 285#define TXQ_TO_COS(txq_index) ((txq_index) / MAX_TXQS_PER_COS) 286 | |
287/* rules for calculating the cids of tx-only connections */ | 281/* rules for calculating the cids of tx-only connections */ |
288#define CID_TO_FP(cid) ((cid) % MAX_TXQS_PER_COS) 289#define CID_COS_TO_TX_ONLY_CID(cid, cos) (cid + cos * MAX_TXQS_PER_COS) | 282#define CID_TO_FP(cid, bp) ((cid) % BNX2X_NUM_NON_CNIC_QUEUES(bp)) 283#define CID_COS_TO_TX_ONLY_CID(cid, cos, bp) \ 284 (cid + cos * BNX2X_NUM_NON_CNIC_QUEUES(bp)) |
290 291/* fp index inside class of service range */ | 285 286/* fp index inside class of service range */ |
292#define FP_COS_TO_TXQ(fp, cos) ((fp)->index + cos * MAX_TXQS_PER_COS) | 287#define FP_COS_TO_TXQ(fp, cos, bp) \ 288 ((fp)->index + cos * BNX2X_NUM_NON_CNIC_QUEUES(bp)) |
293 | 289 |
294/* 295 * 0..15 eth cos0 296 * 16..31 eth cos1 if applicable 297 * 32..47 eth cos2 If applicable 298 * fcoe queue follows eth queues (16, 32, 48 depending on cos) | 290/* Indexes for transmission queues array: 291 * txdata for RSS i CoS j is at location i + (j * num of RSS) 292 * txdata for FCoE (if exist) is at location max cos * num of RSS 293 * txdata for FWD (if exist) is one location after FCoE 294 * txdata for OOO (if exist) is one location after FWD |
299 */ | 295 */ |
300#define MAX_ETH_TXQ_IDX(bp) (MAX_TXQS_PER_COS * (bp)->max_cos) 301#define FCOE_TXQ_IDX(bp) (MAX_ETH_TXQ_IDX(bp)) | 296enum { 297 FCOE_TXQ_IDX_OFFSET, 298 FWD_TXQ_IDX_OFFSET, 299 OOO_TXQ_IDX_OFFSET, 300}; 301#define MAX_ETH_TXQ_IDX(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) * (bp)->max_cos) 302#ifdef BCM_CNIC 303#define FCOE_TXQ_IDX(bp) (MAX_ETH_TXQ_IDX(bp) + FCOE_TXQ_IDX_OFFSET) 304#endif |
302 303/* fast path */ 304/* 305 * This driver uses new build_skb() API : 306 * RX ring buffer contains pointer to kmalloc() data only, 307 * skb are built only after Hardware filled the frame. 308 */ 309struct sw_rx_bd { --- 166 unchanged lines hidden (view full) --- 476 u16 tx_bd_prod; 477 u16 tx_bd_cons; 478 479 unsigned long tx_pkt; 480 481 __le16 *tx_cons_sb; 482 483 int txq_index; | 305 306/* fast path */ 307/* 308 * This driver uses new build_skb() API : 309 * RX ring buffer contains pointer to kmalloc() data only, 310 * skb are built only after Hardware filled the frame. 311 */ 312struct sw_rx_bd { --- 166 unchanged lines hidden (view full) --- 479 u16 tx_bd_prod; 480 u16 tx_bd_cons; 481 482 unsigned long tx_pkt; 483 484 __le16 *tx_cons_sb; 485 486 int txq_index; |
487 struct bnx2x_fastpath *parent_fp; 488 int tx_ring_size; |
|
484}; 485 486enum bnx2x_tpa_mode_t { 487 TPA_MODE_LRO, 488 TPA_MODE_GRO 489}; 490 491struct bnx2x_fastpath { --- 10 unchanged lines hidden (view full) --- 502 503 u32 rx_buf_size; 504 505 dma_addr_t status_blk_mapping; 506 507 enum bnx2x_tpa_mode_t mode; 508 509 u8 max_cos; /* actual number of active tx coses */ | 489}; 490 491enum bnx2x_tpa_mode_t { 492 TPA_MODE_LRO, 493 TPA_MODE_GRO 494}; 495 496struct bnx2x_fastpath { --- 10 unchanged lines hidden (view full) --- 507 508 u32 rx_buf_size; 509 510 dma_addr_t status_blk_mapping; 511 512 enum bnx2x_tpa_mode_t mode; 513 514 u8 max_cos; /* actual number of active tx coses */ |
510 struct bnx2x_fp_txdata txdata[BNX2X_MULTI_TX_COS]; | 515 struct bnx2x_fp_txdata *txdata_ptr[BNX2X_MULTI_TX_COS]; |
511 512 struct sw_rx_bd *rx_buf_ring; /* BDs mappings ring */ 513 struct sw_rx_page *rx_page_ring; /* SGE pages mappings ring */ 514 515 struct eth_rx_bd *rx_desc_ring; 516 dma_addr_t rx_desc_mapping; 517 518 union eth_rx_cqe *rx_comp_ring; --- 55 unchanged lines hidden (view full) --- 574 575}; 576 577#define bnx2x_fp(bp, nr, var) (bp->fp[nr].var) 578 579/* Use 2500 as a mini-jumbo MTU for FCoE */ 580#define BNX2X_FCOE_MINI_JUMBO_MTU 2500 581 | 516 517 struct sw_rx_bd *rx_buf_ring; /* BDs mappings ring */ 518 struct sw_rx_page *rx_page_ring; /* SGE pages mappings ring */ 519 520 struct eth_rx_bd *rx_desc_ring; 521 dma_addr_t rx_desc_mapping; 522 523 union eth_rx_cqe *rx_comp_ring; --- 55 unchanged lines hidden (view full) --- 579 580}; 581 582#define bnx2x_fp(bp, nr, var) (bp->fp[nr].var) 583 584/* Use 2500 as a mini-jumbo MTU for FCoE */ 585#define BNX2X_FCOE_MINI_JUMBO_MTU 2500 586 |
582/* FCoE L2 `fastpath' entry is right after the eth entries */ 583#define FCOE_IDX BNX2X_NUM_ETH_QUEUES(bp) 584#define bnx2x_fcoe_fp(bp) (&bp->fp[FCOE_IDX]) 585#define bnx2x_fcoe(bp, var) (bnx2x_fcoe_fp(bp)->var) 586#define bnx2x_fcoe_tx(bp, var) (bnx2x_fcoe_fp(bp)-> \ 587 txdata[FIRST_TX_COS_INDEX].var) | 587#define FCOE_IDX_OFFSET 0 |
588 | 588 |
589#define FCOE_IDX(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) + \ 590 FCOE_IDX_OFFSET) 591#define bnx2x_fcoe_fp(bp) (&bp->fp[FCOE_IDX(bp)]) 592#define bnx2x_fcoe(bp, var) (bnx2x_fcoe_fp(bp)->var) 593#define bnx2x_fcoe_tx(bp, var) (bnx2x_fcoe_fp(bp)-> \ 594 txdata_ptr[FIRST_TX_COS_INDEX] \ 595 ->var) |
|
589 | 596 |
597 |
|
590#define IS_ETH_FP(fp) (fp->index < \ 591 BNX2X_NUM_ETH_QUEUES(fp->bp)) 592#ifdef BCM_CNIC | 598#define IS_ETH_FP(fp) (fp->index < \ 599 BNX2X_NUM_ETH_QUEUES(fp->bp)) 600#ifdef BCM_CNIC |
593#define IS_FCOE_FP(fp) (fp->index == FCOE_IDX) 594#define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX) | 601#define IS_FCOE_FP(fp) (fp->index == FCOE_IDX(fp->bp)) 602#define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX(bp)) |
595#else 596#define IS_FCOE_FP(fp) false 597#define IS_FCOE_IDX(idx) false 598#endif 599 600 601/* MC hsi */ 602#define MAX_FETCH_BD 13 /* HW max BDs per packet */ --- 579 unchanged lines hidden (view full) --- 1182 struct list_head list; 1183}; 1184 1185struct bnx2x { 1186 /* Fields used in the tx and intr/napi performance paths 1187 * are grouped together in the beginning of the structure 1188 */ 1189 struct bnx2x_fastpath *fp; | 603#else 604#define IS_FCOE_FP(fp) false 605#define IS_FCOE_IDX(idx) false 606#endif 607 608 609/* MC hsi */ 610#define MAX_FETCH_BD 13 /* HW max BDs per packet */ --- 579 unchanged lines hidden (view full) --- 1190 struct list_head list; 1191}; 1192 1193struct bnx2x { 1194 /* Fields used in the tx and intr/napi performance paths 1195 * are grouped together in the beginning of the structure 1196 */ 1197 struct bnx2x_fastpath *fp; |
1198 struct bnx2x_fp_txdata *bnx2x_txq; 1199 int bnx2x_txq_size; |
|
1190 void __iomem *regview; 1191 void __iomem *doorbells; 1192 u16 db_size; 1193 1194 u8 pf_num; /* absolute PF number */ 1195 u8 pfid; /* per-path PF number */ 1196 int base_fw_ndsb; /**/ 1197#define BP_PATH(bp) (CHIP_IS_E1x(bp) ? 0 : (bp->pf_num & 1)) --- 186 unchanged lines hidden (view full) --- 1384#define BNX2X_RX_MODE_NORMAL 1 1385#define BNX2X_RX_MODE_ALLMULTI 2 1386#define BNX2X_RX_MODE_PROMISC 3 1387#define BNX2X_MAX_MULTICAST 64 1388 1389 u8 igu_dsb_id; 1390 u8 igu_base_sb; 1391 u8 igu_sb_cnt; | 1200 void __iomem *regview; 1201 void __iomem *doorbells; 1202 u16 db_size; 1203 1204 u8 pf_num; /* absolute PF number */ 1205 u8 pfid; /* per-path PF number */ 1206 int base_fw_ndsb; /**/ 1207#define BP_PATH(bp) (CHIP_IS_E1x(bp) ? 0 : (bp->pf_num & 1)) --- 186 unchanged lines hidden (view full) --- 1394#define BNX2X_RX_MODE_NORMAL 1 1395#define BNX2X_RX_MODE_ALLMULTI 2 1396#define BNX2X_RX_MODE_PROMISC 3 1397#define BNX2X_MAX_MULTICAST 64 1398 1399 u8 igu_dsb_id; 1400 u8 igu_base_sb; 1401 u8 igu_sb_cnt; |
1402 |
|
1392 dma_addr_t def_status_blk_mapping; 1393 1394 struct bnx2x_slowpath *slowpath; 1395 dma_addr_t slowpath_mapping; 1396 1397 /* Total number of FW statistics requests */ 1398 u8 fw_stats_num; 1399 --- 38 unchanged lines hidden (view full) --- 1438/* 1439 * Maximum CID count that might be required by the bnx2x: 1440 * Max Tss * Max_Tx_Multi_Cos + CNIC L2 Clients (FCoE and iSCSI related) 1441 */ 1442#define BNX2X_L2_CID_COUNT(bp) (MAX_TXQS_PER_COS * BNX2X_MULTI_TX_COS +\ 1443 NON_ETH_CONTEXT_USE + CNIC_PRESENT) 1444#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ 1445 ILT_PAGE_CIDS)) | 1403 dma_addr_t def_status_blk_mapping; 1404 1405 struct bnx2x_slowpath *slowpath; 1406 dma_addr_t slowpath_mapping; 1407 1408 /* Total number of FW statistics requests */ 1409 u8 fw_stats_num; 1410 --- 38 unchanged lines hidden (view full) --- 1449/* 1450 * Maximum CID count that might be required by the bnx2x: 1451 * Max Tss * Max_Tx_Multi_Cos + CNIC L2 Clients (FCoE and iSCSI related) 1452 */ 1453#define BNX2X_L2_CID_COUNT(bp) (MAX_TXQS_PER_COS * BNX2X_MULTI_TX_COS +\ 1454 NON_ETH_CONTEXT_USE + CNIC_PRESENT) 1455#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ 1456 ILT_PAGE_CIDS)) |
1446#define BNX2X_DB_SIZE(bp) (BNX2X_L2_CID_COUNT(bp) * (1 << BNX2X_DB_SHIFT)) | |
1447 1448 int qm_cid_count; 1449 1450 int dropless_fc; 1451 1452#ifdef BCM_CNIC 1453 u32 cnic_flags; 1454#define BNX2X_CNIC_FLAG_MAC_SET 1 --- 142 unchanged lines hidden (view full) --- 1597 /* priority to cos mapping */ 1598 u8 prio_to_cos[8]; 1599}; 1600 1601/* Tx queues may be less or equal to Rx queues */ 1602extern int num_queues; 1603#define BNX2X_NUM_QUEUES(bp) (bp->num_queues) 1604#define BNX2X_NUM_ETH_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE) | 1457 1458 int qm_cid_count; 1459 1460 int dropless_fc; 1461 1462#ifdef BCM_CNIC 1463 u32 cnic_flags; 1464#define BNX2X_CNIC_FLAG_MAC_SET 1 --- 142 unchanged lines hidden (view full) --- 1607 /* priority to cos mapping */ 1608 u8 prio_to_cos[8]; 1609}; 1610 1611/* Tx queues may be less or equal to Rx queues */ 1612extern int num_queues; 1613#define BNX2X_NUM_QUEUES(bp) (bp->num_queues) 1614#define BNX2X_NUM_ETH_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE) |
1615#define BNX2X_NUM_NON_CNIC_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - \ 1616 NON_ETH_CONTEXT_USE) |
|
1605#define BNX2X_NUM_RX_QUEUES(bp) BNX2X_NUM_QUEUES(bp) 1606 1607#define is_multi(bp) (BNX2X_NUM_QUEUES(bp) > 1) 1608 1609#define BNX2X_MAX_QUEUES(bp) BNX2X_MAX_RSS_COUNT(bp) 1610/* #define is_eth_multi(bp) (BNX2X_NUM_ETH_QUEUES(bp) > 1) */ 1611 1612#define RSS_IPV4_CAP_MASK \ --- 553 unchanged lines hidden --- | 1617#define BNX2X_NUM_RX_QUEUES(bp) BNX2X_NUM_QUEUES(bp) 1618 1619#define is_multi(bp) (BNX2X_NUM_QUEUES(bp) > 1) 1620 1621#define BNX2X_MAX_QUEUES(bp) BNX2X_MAX_RSS_COUNT(bp) 1622/* #define is_eth_multi(bp) (BNX2X_NUM_ETH_QUEUES(bp) > 1) */ 1623 1624#define RSS_IPV4_CAP_MASK \ --- 553 unchanged lines hidden --- |