aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
diff options
context:
space:
mode:
authorMerav Sicron <meravs@broadcom.com>2012-06-19 03:48:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-19 17:34:34 -0400
commit65565884fba67d9254f32d239b0fb6c38fae88aa (patch)
tree29c4a4fe4e5ec89cc9deebe2312061a30d3911ab /drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
parenta052997ea32164b2466daff8db5f783131184dae (diff)
bnx2x: Make the transmission queues adjacent
In the current scheme the transmission queues of traffic-class 0 were 0-15, the transmission queues of traffic-class 1 were 16-31 and so on. If the number of RSS queues was smaller than 16, there were gaps in transmission queues numbering, as well as in CIDs numbering. This is both a waste (especially when 16 is increased to 64), and may causes problems with flushing queues when reducing the number of RSS queues (using ethtool -L). The new scheme eliminates the gaps. Signed-off-by: Merav Sicron <meravs@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x.h')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h66
1 files changed, 39 insertions, 27 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index c0c539fd2490..d06064b0d063 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -276,29 +276,32 @@ enum {
276#define FIRST_TX_ONLY_COS_INDEX 1 276#define FIRST_TX_ONLY_COS_INDEX 1
277#define FIRST_TX_COS_INDEX 0 277#define FIRST_TX_COS_INDEX 0
278 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 279#define MAX_TXQS_PER_COS FP_SB_MAX_E1x
283 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) 282#define CID_TO_FP(cid, bp) ((cid) % BNX2X_NUM_NON_CNIC_QUEUES(bp))
289#define CID_COS_TO_TX_ONLY_CID(cid, cos) (cid + cos * MAX_TXQS_PER_COS) 283#define CID_COS_TO_TX_ONLY_CID(cid, cos, bp) \
284 (cid + cos * BNX2X_NUM_NON_CNIC_QUEUES(bp))
290 285
291/* fp index inside class of service range */ 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) \
293 288 ((fp)->index + cos * BNX2X_NUM_NON_CNIC_QUEUES(bp))
294/* 289
295 * 0..15 eth cos0 290/* Indexes for transmission queues array:
296 * 16..31 eth cos1 if applicable 291 * txdata for RSS i CoS j is at location i + (j * num of RSS)
297 * 32..47 eth cos2 If applicable 292 * txdata for FCoE (if exist) is at location max cos * num of RSS
298 * fcoe queue follows eth queues (16, 32, 48 depending on cos) 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) 296enum {
301#define FCOE_TXQ_IDX(bp) (MAX_ETH_TXQ_IDX(bp)) 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 305
303/* fast path */ 306/* fast path */
304/* 307/*
@@ -481,6 +484,8 @@ struct bnx2x_fp_txdata {
481 __le16 *tx_cons_sb; 484 __le16 *tx_cons_sb;
482 485
483 int txq_index; 486 int txq_index;
487 struct bnx2x_fastpath *parent_fp;
488 int tx_ring_size;
484}; 489};
485 490
486enum bnx2x_tpa_mode_t { 491enum bnx2x_tpa_mode_t {
@@ -507,7 +512,7 @@ struct bnx2x_fastpath {
507 enum bnx2x_tpa_mode_t mode; 512 enum bnx2x_tpa_mode_t mode;
508 513
509 u8 max_cos; /* actual number of active tx coses */ 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 516
512 struct sw_rx_bd *rx_buf_ring; /* BDs mappings ring */ 517 struct sw_rx_bd *rx_buf_ring; /* BDs mappings ring */
513 struct sw_rx_page *rx_page_ring; /* SGE pages mappings ring */ 518 struct sw_rx_page *rx_page_ring; /* SGE pages mappings ring */
@@ -579,19 +584,22 @@ struct bnx2x_fastpath {
579/* Use 2500 as a mini-jumbo MTU for FCoE */ 584/* Use 2500 as a mini-jumbo MTU for FCoE */
580#define BNX2X_FCOE_MINI_JUMBO_MTU 2500 585#define BNX2X_FCOE_MINI_JUMBO_MTU 2500
581 586
582/* FCoE L2 `fastpath' entry is right after the eth entries */ 587#define FCOE_IDX_OFFSET 0
583#define FCOE_IDX BNX2X_NUM_ETH_QUEUES(bp) 588
584#define bnx2x_fcoe_fp(bp) (&bp->fp[FCOE_IDX]) 589#define FCOE_IDX(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) + \
585#define bnx2x_fcoe(bp, var) (bnx2x_fcoe_fp(bp)->var) 590 FCOE_IDX_OFFSET)
586#define bnx2x_fcoe_tx(bp, var) (bnx2x_fcoe_fp(bp)-> \ 591#define bnx2x_fcoe_fp(bp) (&bp->fp[FCOE_IDX(bp)])
587 txdata[FIRST_TX_COS_INDEX].var) 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)
588 596
589 597
590#define IS_ETH_FP(fp) (fp->index < \ 598#define IS_ETH_FP(fp) (fp->index < \
591 BNX2X_NUM_ETH_QUEUES(fp->bp)) 599 BNX2X_NUM_ETH_QUEUES(fp->bp))
592#ifdef BCM_CNIC 600#ifdef BCM_CNIC
593#define IS_FCOE_FP(fp) (fp->index == FCOE_IDX) 601#define IS_FCOE_FP(fp) (fp->index == FCOE_IDX(fp->bp))
594#define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX) 602#define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX(bp))
595#else 603#else
596#define IS_FCOE_FP(fp) false 604#define IS_FCOE_FP(fp) false
597#define IS_FCOE_IDX(idx) false 605#define IS_FCOE_IDX(idx) false
@@ -1187,6 +1195,8 @@ struct bnx2x {
1187 * are grouped together in the beginning of the structure 1195 * are grouped together in the beginning of the structure
1188 */ 1196 */
1189 struct bnx2x_fastpath *fp; 1197 struct bnx2x_fastpath *fp;
1198 struct bnx2x_fp_txdata *bnx2x_txq;
1199 int bnx2x_txq_size;
1190 void __iomem *regview; 1200 void __iomem *regview;
1191 void __iomem *doorbells; 1201 void __iomem *doorbells;
1192 u16 db_size; 1202 u16 db_size;
@@ -1389,6 +1399,7 @@ struct bnx2x {
1389 u8 igu_dsb_id; 1399 u8 igu_dsb_id;
1390 u8 igu_base_sb; 1400 u8 igu_base_sb;
1391 u8 igu_sb_cnt; 1401 u8 igu_sb_cnt;
1402
1392 dma_addr_t def_status_blk_mapping; 1403 dma_addr_t def_status_blk_mapping;
1393 1404
1394 struct bnx2x_slowpath *slowpath; 1405 struct bnx2x_slowpath *slowpath;
@@ -1443,7 +1454,6 @@ struct bnx2x {
1443 NON_ETH_CONTEXT_USE + CNIC_PRESENT) 1454 NON_ETH_CONTEXT_USE + CNIC_PRESENT)
1444#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ 1455#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\
1445 ILT_PAGE_CIDS)) 1456 ILT_PAGE_CIDS))
1446#define BNX2X_DB_SIZE(bp) (BNX2X_L2_CID_COUNT(bp) * (1 << BNX2X_DB_SHIFT))
1447 1457
1448 int qm_cid_count; 1458 int qm_cid_count;
1449 1459
@@ -1602,6 +1612,8 @@ struct bnx2x {
1602extern int num_queues; 1612extern int num_queues;
1603#define BNX2X_NUM_QUEUES(bp) (bp->num_queues) 1613#define BNX2X_NUM_QUEUES(bp) (bp->num_queues)
1604#define BNX2X_NUM_ETH_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE) 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) 1617#define BNX2X_NUM_RX_QUEUES(bp) BNX2X_NUM_QUEUES(bp)
1606 1618
1607#define is_multi(bp) (BNX2X_NUM_QUEUES(bp) > 1) 1619#define is_multi(bp) (BNX2X_NUM_QUEUES(bp) > 1)