diff options
author | Merav Sicron <meravs@broadcom.com> | 2012-06-19 03:48:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-19 17:34:34 -0400 |
commit | 65565884fba67d9254f32d239b0fb6c38fae88aa (patch) | |
tree | 29c4a4fe4e5ec89cc9deebe2312061a30d3911ab | |
parent | a052997ea32164b2466daff8db5f783131184dae (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>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 66 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 105 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 42 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 4 |
6 files changed, 139 insertions, 94 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) | 296 | enum { |
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 | ||
486 | enum bnx2x_tpa_mode_t { | 491 | enum 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 { | |||
1602 | extern int num_queues; | 1612 | extern 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) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index f4366f79c117..d99f20ace9df 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -40,12 +40,15 @@ | |||
40 | * Makes sure the contents of the bp->fp[to].napi is kept | 40 | * Makes sure the contents of the bp->fp[to].napi is kept |
41 | * intact. This is done by first copying the napi struct from | 41 | * intact. This is done by first copying the napi struct from |
42 | * the target to the source, and then mem copying the entire | 42 | * the target to the source, and then mem copying the entire |
43 | * source onto the target | 43 | * source onto the target. Update txdata pointers and related |
44 | * content. | ||
44 | */ | 45 | */ |
45 | static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to) | 46 | static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to) |
46 | { | 47 | { |
47 | struct bnx2x_fastpath *from_fp = &bp->fp[from]; | 48 | struct bnx2x_fastpath *from_fp = &bp->fp[from]; |
48 | struct bnx2x_fastpath *to_fp = &bp->fp[to]; | 49 | struct bnx2x_fastpath *to_fp = &bp->fp[to]; |
50 | int old_max_eth_txqs, new_max_eth_txqs; | ||
51 | int old_txdata_index = 0, new_txdata_index = 0; | ||
49 | 52 | ||
50 | /* Copy the NAPI object as it has been already initialized */ | 53 | /* Copy the NAPI object as it has been already initialized */ |
51 | from_fp->napi = to_fp->napi; | 54 | from_fp->napi = to_fp->napi; |
@@ -53,6 +56,24 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to) | |||
53 | /* Move bnx2x_fastpath contents */ | 56 | /* Move bnx2x_fastpath contents */ |
54 | memcpy(to_fp, from_fp, sizeof(*to_fp)); | 57 | memcpy(to_fp, from_fp, sizeof(*to_fp)); |
55 | to_fp->index = to; | 58 | to_fp->index = to; |
59 | |||
60 | /* Update txdata pointers in fp and move txdata content accordingly: | ||
61 | * Each fp consumes 'max_cos' txdata structures, so the index should be | ||
62 | * decremented by max_cos x delta. | ||
63 | */ | ||
64 | |||
65 | old_max_eth_txqs = BNX2X_NUM_ETH_QUEUES(bp) * (bp)->max_cos; | ||
66 | new_max_eth_txqs = (BNX2X_NUM_ETH_QUEUES(bp) - from + to) * | ||
67 | (bp)->max_cos; | ||
68 | if (from == FCOE_IDX(bp)) { | ||
69 | old_txdata_index = old_max_eth_txqs + FCOE_TXQ_IDX_OFFSET; | ||
70 | new_txdata_index = new_max_eth_txqs + FCOE_TXQ_IDX_OFFSET; | ||
71 | } | ||
72 | |||
73 | memcpy(&bp->bnx2x_txq[old_txdata_index], | ||
74 | &bp->bnx2x_txq[new_txdata_index], | ||
75 | sizeof(struct bnx2x_fp_txdata)); | ||
76 | to_fp->txdata_ptr[0] = &bp->bnx2x_txq[new_txdata_index]; | ||
56 | } | 77 | } |
57 | 78 | ||
58 | int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */ | 79 | int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */ |
@@ -888,7 +909,7 @@ static irqreturn_t bnx2x_msix_fp_int(int irq, void *fp_cookie) | |||
888 | prefetch(fp->rx_cons_sb); | 909 | prefetch(fp->rx_cons_sb); |
889 | 910 | ||
890 | for_each_cos_in_tx_queue(fp, cos) | 911 | for_each_cos_in_tx_queue(fp, cos) |
891 | prefetch(fp->txdata[cos].tx_cons_sb); | 912 | prefetch(fp->txdata_ptr[cos]->tx_cons_sb); |
892 | 913 | ||
893 | prefetch(&fp->sb_running_index[SM_RX_ID]); | 914 | prefetch(&fp->sb_running_index[SM_RX_ID]); |
894 | napi_schedule(&bnx2x_fp(bp, fp->index, napi)); | 915 | napi_schedule(&bnx2x_fp(bp, fp->index, napi)); |
@@ -1205,7 +1226,7 @@ static void bnx2x_free_tx_skbs(struct bnx2x *bp) | |||
1205 | for_each_tx_queue(bp, i) { | 1226 | for_each_tx_queue(bp, i) { |
1206 | struct bnx2x_fastpath *fp = &bp->fp[i]; | 1227 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
1207 | for_each_cos_in_tx_queue(fp, cos) { | 1228 | for_each_cos_in_tx_queue(fp, cos) { |
1208 | struct bnx2x_fp_txdata *txdata = &fp->txdata[cos]; | 1229 | struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; |
1209 | unsigned pkts_compl = 0, bytes_compl = 0; | 1230 | unsigned pkts_compl = 0, bytes_compl = 0; |
1210 | 1231 | ||
1211 | u16 sw_prod = txdata->tx_pkt_prod; | 1232 | u16 sw_prod = txdata->tx_pkt_prod; |
@@ -1217,7 +1238,8 @@ static void bnx2x_free_tx_skbs(struct bnx2x *bp) | |||
1217 | sw_cons++; | 1238 | sw_cons++; |
1218 | } | 1239 | } |
1219 | netdev_tx_reset_queue( | 1240 | netdev_tx_reset_queue( |
1220 | netdev_get_tx_queue(bp->dev, txdata->txq_index)); | 1241 | netdev_get_tx_queue(bp->dev, |
1242 | txdata->txq_index)); | ||
1221 | } | 1243 | } |
1222 | } | 1244 | } |
1223 | } | 1245 | } |
@@ -1579,6 +1601,8 @@ void bnx2x_set_num_queues(struct bnx2x *bp) | |||
1579 | #endif | 1601 | #endif |
1580 | /* Add special queues */ | 1602 | /* Add special queues */ |
1581 | bp->num_queues += NON_ETH_CONTEXT_USE; | 1603 | bp->num_queues += NON_ETH_CONTEXT_USE; |
1604 | |||
1605 | BNX2X_DEV_INFO("set number of queues to %d\n", bp->num_queues); | ||
1582 | } | 1606 | } |
1583 | 1607 | ||
1584 | /** | 1608 | /** |
@@ -1607,8 +1631,8 @@ static int bnx2x_set_real_num_queues(struct bnx2x *bp) | |||
1607 | { | 1631 | { |
1608 | int rc, tx, rx; | 1632 | int rc, tx, rx; |
1609 | 1633 | ||
1610 | tx = MAX_TXQS_PER_COS * bp->max_cos; | 1634 | tx = BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos; |
1611 | rx = BNX2X_NUM_ETH_QUEUES(bp); | 1635 | rx = BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE; |
1612 | 1636 | ||
1613 | /* account for fcoe queue */ | 1637 | /* account for fcoe queue */ |
1614 | #ifdef BCM_CNIC | 1638 | #ifdef BCM_CNIC |
@@ -1853,6 +1877,7 @@ bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err) | |||
1853 | static void bnx2x_bz_fp(struct bnx2x *bp, int index) | 1877 | static void bnx2x_bz_fp(struct bnx2x *bp, int index) |
1854 | { | 1878 | { |
1855 | struct bnx2x_fastpath *fp = &bp->fp[index]; | 1879 | struct bnx2x_fastpath *fp = &bp->fp[index]; |
1880 | int cos; | ||
1856 | struct napi_struct orig_napi = fp->napi; | 1881 | struct napi_struct orig_napi = fp->napi; |
1857 | /* bzero bnx2x_fastpath contents */ | 1882 | /* bzero bnx2x_fastpath contents */ |
1858 | if (bp->stats_init) | 1883 | if (bp->stats_init) |
@@ -1902,6 +1927,16 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) | |||
1902 | /* Special queues support only one CoS */ | 1927 | /* Special queues support only one CoS */ |
1903 | fp->max_cos = 1; | 1928 | fp->max_cos = 1; |
1904 | 1929 | ||
1930 | /* Init txdata pointers */ | ||
1931 | #ifdef BCM_CNIC | ||
1932 | if (IS_FCOE_FP(fp)) | ||
1933 | fp->txdata_ptr[0] = &bp->bnx2x_txq[FCOE_TXQ_IDX(bp)]; | ||
1934 | #endif | ||
1935 | if (IS_ETH_FP(fp)) | ||
1936 | for_each_cos_in_tx_queue(fp, cos) | ||
1937 | fp->txdata_ptr[cos] = &bp->bnx2x_txq[cos * | ||
1938 | BNX2X_NUM_ETH_QUEUES(bp) + index]; | ||
1939 | |||
1905 | /* | 1940 | /* |
1906 | * set the tpa flag for each queue. The tpa flag determines the queue | 1941 | * set the tpa flag for each queue. The tpa flag determines the queue |
1907 | * minimal size so it must be set prior to queue memory allocation | 1942 | * minimal size so it must be set prior to queue memory allocation |
@@ -1951,11 +1986,13 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1951 | /* | 1986 | /* |
1952 | * Zero fastpath structures preserving invariants like napi, which are | 1987 | * Zero fastpath structures preserving invariants like napi, which are |
1953 | * allocated only once, fp index, max_cos, bp pointer. | 1988 | * allocated only once, fp index, max_cos, bp pointer. |
1954 | * Also set fp->disable_tpa. | 1989 | * Also set fp->disable_tpa and txdata_ptr. |
1955 | */ | 1990 | */ |
1956 | DP(NETIF_MSG_IFUP, "num queues: %d", bp->num_queues); | 1991 | DP(NETIF_MSG_IFUP, "num queues: %d", bp->num_queues); |
1957 | for_each_queue(bp, i) | 1992 | for_each_queue(bp, i) |
1958 | bnx2x_bz_fp(bp, i); | 1993 | bnx2x_bz_fp(bp, i); |
1994 | memset(bp->bnx2x_txq, 0, bp->bnx2x_txq_size * | ||
1995 | sizeof(struct bnx2x_fp_txdata)); | ||
1959 | 1996 | ||
1960 | 1997 | ||
1961 | /* Set the receive queues buffer size */ | 1998 | /* Set the receive queues buffer size */ |
@@ -2302,6 +2339,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
2302 | 2339 | ||
2303 | /* Stop Tx */ | 2340 | /* Stop Tx */ |
2304 | bnx2x_tx_disable(bp); | 2341 | bnx2x_tx_disable(bp); |
2342 | netdev_reset_tc(bp->dev); | ||
2305 | 2343 | ||
2306 | #ifdef BCM_CNIC | 2344 | #ifdef BCM_CNIC |
2307 | bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); | 2345 | bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); |
@@ -2460,8 +2498,8 @@ int bnx2x_poll(struct napi_struct *napi, int budget) | |||
2460 | #endif | 2498 | #endif |
2461 | 2499 | ||
2462 | for_each_cos_in_tx_queue(fp, cos) | 2500 | for_each_cos_in_tx_queue(fp, cos) |
2463 | if (bnx2x_tx_queue_has_work(&fp->txdata[cos])) | 2501 | if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos])) |
2464 | bnx2x_tx_int(bp, &fp->txdata[cos]); | 2502 | bnx2x_tx_int(bp, fp->txdata_ptr[cos]); |
2465 | 2503 | ||
2466 | 2504 | ||
2467 | if (bnx2x_has_rx_work(fp)) { | 2505 | if (bnx2x_has_rx_work(fp)) { |
@@ -2838,7 +2876,6 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2838 | { | 2876 | { |
2839 | struct bnx2x *bp = netdev_priv(dev); | 2877 | struct bnx2x *bp = netdev_priv(dev); |
2840 | 2878 | ||
2841 | struct bnx2x_fastpath *fp; | ||
2842 | struct netdev_queue *txq; | 2879 | struct netdev_queue *txq; |
2843 | struct bnx2x_fp_txdata *txdata; | 2880 | struct bnx2x_fp_txdata *txdata; |
2844 | struct sw_tx_bd *tx_buf; | 2881 | struct sw_tx_bd *tx_buf; |
@@ -2848,7 +2885,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2848 | struct eth_tx_parse_bd_e2 *pbd_e2 = NULL; | 2885 | struct eth_tx_parse_bd_e2 *pbd_e2 = NULL; |
2849 | u32 pbd_e2_parsing_data = 0; | 2886 | u32 pbd_e2_parsing_data = 0; |
2850 | u16 pkt_prod, bd_prod; | 2887 | u16 pkt_prod, bd_prod; |
2851 | int nbd, txq_index, fp_index, txdata_index; | 2888 | int nbd, txq_index; |
2852 | dma_addr_t mapping; | 2889 | dma_addr_t mapping; |
2853 | u32 xmit_type = bnx2x_xmit_type(bp, skb); | 2890 | u32 xmit_type = bnx2x_xmit_type(bp, skb); |
2854 | int i; | 2891 | int i; |
@@ -2867,31 +2904,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2867 | 2904 | ||
2868 | BUG_ON(txq_index >= MAX_ETH_TXQ_IDX(bp) + FCOE_PRESENT); | 2905 | BUG_ON(txq_index >= MAX_ETH_TXQ_IDX(bp) + FCOE_PRESENT); |
2869 | 2906 | ||
2870 | /* decode the fastpath index and the cos index from the txq */ | 2907 | txdata = &bp->bnx2x_txq[txq_index]; |
2871 | fp_index = TXQ_TO_FP(txq_index); | ||
2872 | txdata_index = TXQ_TO_COS(txq_index); | ||
2873 | |||
2874 | #ifdef BCM_CNIC | ||
2875 | /* | ||
2876 | * Override the above for the FCoE queue: | ||
2877 | * - FCoE fp entry is right after the ETH entries. | ||
2878 | * - FCoE L2 queue uses bp->txdata[0] only. | ||
2879 | */ | ||
2880 | if (unlikely(!NO_FCOE(bp) && (txq_index == | ||
2881 | bnx2x_fcoe_tx(bp, txq_index)))) { | ||
2882 | fp_index = FCOE_IDX; | ||
2883 | txdata_index = 0; | ||
2884 | } | ||
2885 | #endif | ||
2886 | 2908 | ||
2887 | /* enable this debug print to view the transmission queue being used | 2909 | /* enable this debug print to view the transmission queue being used |
2888 | DP(NETIF_MSG_TX_QUEUED, "indices: txq %d, fp %d, txdata %d\n", | 2910 | DP(NETIF_MSG_TX_QUEUED, "indices: txq %d, fp %d, txdata %d\n", |
2889 | txq_index, fp_index, txdata_index); */ | 2911 | txq_index, fp_index, txdata_index); */ |
2890 | 2912 | ||
2891 | /* locate the fastpath and the txdata */ | ||
2892 | fp = &bp->fp[fp_index]; | ||
2893 | txdata = &fp->txdata[txdata_index]; | ||
2894 | |||
2895 | /* enable this debug print to view the tranmission details | 2913 | /* enable this debug print to view the tranmission details |
2896 | DP(NETIF_MSG_TX_QUEUED, | 2914 | DP(NETIF_MSG_TX_QUEUED, |
2897 | "transmitting packet cid %d fp index %d txdata_index %d tx_data ptr %p fp pointer %p\n", | 2915 | "transmitting packet cid %d fp index %d txdata_index %d tx_data ptr %p fp pointer %p\n", |
@@ -2899,7 +2917,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2899 | 2917 | ||
2900 | if (unlikely(bnx2x_tx_avail(bp, txdata) < | 2918 | if (unlikely(bnx2x_tx_avail(bp, txdata) < |
2901 | (skb_shinfo(skb)->nr_frags + 3))) { | 2919 | (skb_shinfo(skb)->nr_frags + 3))) { |
2902 | fp->eth_q_stats.driver_xoff++; | 2920 | txdata->parent_fp->eth_q_stats.driver_xoff++; |
2903 | netif_tx_stop_queue(txq); | 2921 | netif_tx_stop_queue(txq); |
2904 | BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); | 2922 | BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); |
2905 | return NETDEV_TX_BUSY; | 2923 | return NETDEV_TX_BUSY; |
@@ -3181,7 +3199,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3181 | * fp->bd_tx_cons */ | 3199 | * fp->bd_tx_cons */ |
3182 | smp_mb(); | 3200 | smp_mb(); |
3183 | 3201 | ||
3184 | fp->eth_q_stats.driver_xoff++; | 3202 | txdata->parent_fp->eth_q_stats.driver_xoff++; |
3185 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4) | 3203 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4) |
3186 | netif_tx_wake_queue(txq); | 3204 | netif_tx_wake_queue(txq); |
3187 | } | 3205 | } |
@@ -3247,7 +3265,7 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc) | |||
3247 | /* configure traffic class to transmission queue mapping */ | 3265 | /* configure traffic class to transmission queue mapping */ |
3248 | for (cos = 0; cos < bp->max_cos; cos++) { | 3266 | for (cos = 0; cos < bp->max_cos; cos++) { |
3249 | count = BNX2X_NUM_ETH_QUEUES(bp); | 3267 | count = BNX2X_NUM_ETH_QUEUES(bp); |
3250 | offset = cos * MAX_TXQS_PER_COS; | 3268 | offset = cos * BNX2X_NUM_NON_CNIC_QUEUES(bp); |
3251 | netdev_set_tc_queue(dev, cos, count, offset); | 3269 | netdev_set_tc_queue(dev, cos, count, offset); |
3252 | DP(BNX2X_MSG_SP | NETIF_MSG_IFUP, | 3270 | DP(BNX2X_MSG_SP | NETIF_MSG_IFUP, |
3253 | "mapping tc %d to offset %d count %d\n", | 3271 | "mapping tc %d to offset %d count %d\n", |
@@ -3346,7 +3364,7 @@ static void bnx2x_free_fp_mem_at(struct bnx2x *bp, int fp_index) | |||
3346 | if (!skip_tx_queue(bp, fp_index)) { | 3364 | if (!skip_tx_queue(bp, fp_index)) { |
3347 | /* fastpath tx rings: tx_buf tx_desc */ | 3365 | /* fastpath tx rings: tx_buf tx_desc */ |
3348 | for_each_cos_in_tx_queue(fp, cos) { | 3366 | for_each_cos_in_tx_queue(fp, cos) { |
3349 | struct bnx2x_fp_txdata *txdata = &fp->txdata[cos]; | 3367 | struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; |
3350 | 3368 | ||
3351 | DP(NETIF_MSG_IFDOWN, | 3369 | DP(NETIF_MSG_IFDOWN, |
3352 | "freeing tx memory of fp %d cos %d cid %d\n", | 3370 | "freeing tx memory of fp %d cos %d cid %d\n", |
@@ -3503,7 +3521,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) | |||
3503 | if (!skip_tx_queue(bp, index)) { | 3521 | if (!skip_tx_queue(bp, index)) { |
3504 | /* fastpath tx rings: tx_buf tx_desc */ | 3522 | /* fastpath tx rings: tx_buf tx_desc */ |
3505 | for_each_cos_in_tx_queue(fp, cos) { | 3523 | for_each_cos_in_tx_queue(fp, cos) { |
3506 | struct bnx2x_fp_txdata *txdata = &fp->txdata[cos]; | 3524 | struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; |
3507 | 3525 | ||
3508 | DP(NETIF_MSG_IFUP, | 3526 | DP(NETIF_MSG_IFUP, |
3509 | "allocating tx memory of fp %d cos %d\n", | 3527 | "allocating tx memory of fp %d cos %d\n", |
@@ -3586,7 +3604,7 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp) | |||
3586 | #ifdef BCM_CNIC | 3604 | #ifdef BCM_CNIC |
3587 | if (!NO_FCOE(bp)) | 3605 | if (!NO_FCOE(bp)) |
3588 | /* FCoE */ | 3606 | /* FCoE */ |
3589 | if (bnx2x_alloc_fp_mem_at(bp, FCOE_IDX)) | 3607 | if (bnx2x_alloc_fp_mem_at(bp, FCOE_IDX(bp))) |
3590 | /* we will fail load process instead of mark | 3608 | /* we will fail load process instead of mark |
3591 | * NO_FCOE_FLAG | 3609 | * NO_FCOE_FLAG |
3592 | */ | 3610 | */ |
@@ -3611,7 +3629,7 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp) | |||
3611 | */ | 3629 | */ |
3612 | 3630 | ||
3613 | /* move FCoE fp even NO_FCOE_FLAG is on */ | 3631 | /* move FCoE fp even NO_FCOE_FLAG is on */ |
3614 | bnx2x_move_fp(bp, FCOE_IDX, FCOE_IDX - delta); | 3632 | bnx2x_move_fp(bp, FCOE_IDX(bp), FCOE_IDX(bp) - delta); |
3615 | #endif | 3633 | #endif |
3616 | bp->num_queues -= delta; | 3634 | bp->num_queues -= delta; |
3617 | BNX2X_ERR("Adjusted num of queues from %d to %d\n", | 3635 | BNX2X_ERR("Adjusted num of queues from %d to %d\n", |
@@ -3624,6 +3642,7 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp) | |||
3624 | void bnx2x_free_mem_bp(struct bnx2x *bp) | 3642 | void bnx2x_free_mem_bp(struct bnx2x *bp) |
3625 | { | 3643 | { |
3626 | kfree(bp->fp); | 3644 | kfree(bp->fp); |
3645 | kfree(bp->bnx2x_txq); | ||
3627 | kfree(bp->msix_table); | 3646 | kfree(bp->msix_table); |
3628 | kfree(bp->ilt); | 3647 | kfree(bp->ilt); |
3629 | } | 3648 | } |
@@ -3648,6 +3667,16 @@ int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp) | |||
3648 | goto alloc_err; | 3667 | goto alloc_err; |
3649 | bp->fp = fp; | 3668 | bp->fp = fp; |
3650 | 3669 | ||
3670 | /* Allocate memory for the transmission queues array */ | ||
3671 | bp->bnx2x_txq_size = BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS; | ||
3672 | #ifdef BCM_CNIC | ||
3673 | bp->bnx2x_txq_size++; | ||
3674 | #endif | ||
3675 | bp->bnx2x_txq = kcalloc(bp->bnx2x_txq_size, | ||
3676 | sizeof(struct bnx2x_fp_txdata), GFP_KERNEL); | ||
3677 | if (!bp->bnx2x_txq) | ||
3678 | goto alloc_err; | ||
3679 | |||
3651 | /* msix table */ | 3680 | /* msix table */ |
3652 | tbl = kcalloc(msix_table_size, sizeof(*tbl), GFP_KERNEL); | 3681 | tbl = kcalloc(msix_table_size, sizeof(*tbl), GFP_KERNEL); |
3653 | if (!tbl) | 3682 | if (!tbl) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index bb479843d59c..112ffccb3121 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | |||
@@ -728,7 +728,7 @@ static inline bool bnx2x_has_tx_work(struct bnx2x_fastpath *fp) | |||
728 | { | 728 | { |
729 | u8 cos; | 729 | u8 cos; |
730 | for_each_cos_in_tx_queue(fp, cos) | 730 | for_each_cos_in_tx_queue(fp, cos) |
731 | if (bnx2x_tx_queue_has_work(&fp->txdata[cos])) | 731 | if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos])) |
732 | return true; | 732 | return true; |
733 | return false; | 733 | return false; |
734 | } | 734 | } |
@@ -1066,12 +1066,14 @@ static inline u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp) | |||
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | static inline void bnx2x_init_txdata(struct bnx2x *bp, | 1068 | static inline void bnx2x_init_txdata(struct bnx2x *bp, |
1069 | struct bnx2x_fp_txdata *txdata, u32 cid, int txq_index, | 1069 | struct bnx2x_fp_txdata *txdata, u32 cid, |
1070 | __le16 *tx_cons_sb) | 1070 | int txq_index, __le16 *tx_cons_sb, |
1071 | struct bnx2x_fastpath *fp) | ||
1071 | { | 1072 | { |
1072 | txdata->cid = cid; | 1073 | txdata->cid = cid; |
1073 | txdata->txq_index = txq_index; | 1074 | txdata->txq_index = txq_index; |
1074 | txdata->tx_cons_sb = tx_cons_sb; | 1075 | txdata->tx_cons_sb = tx_cons_sb; |
1076 | txdata->parent_fp = fp; | ||
1075 | 1077 | ||
1076 | DP(NETIF_MSG_IFUP, "created tx data cid %d, txq %d\n", | 1078 | DP(NETIF_MSG_IFUP, "created tx data cid %d, txq %d\n", |
1077 | txdata->cid, txdata->txq_index); | 1079 | txdata->cid, txdata->txq_index); |
@@ -1114,9 +1116,9 @@ static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp) | |||
1114 | bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID; | 1116 | bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID; |
1115 | bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id; | 1117 | bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id; |
1116 | bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX; | 1118 | bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX; |
1117 | 1119 | bnx2x_init_txdata(bp, bnx2x_fcoe(bp, txdata_ptr[0]), | |
1118 | bnx2x_init_txdata(bp, &bnx2x_fcoe(bp, txdata[0]), | 1120 | fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX, |
1119 | fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX); | 1121 | fp); |
1120 | 1122 | ||
1121 | DP(NETIF_MSG_IFUP, "created fcoe tx data (fp index %d)\n", fp->index); | 1123 | DP(NETIF_MSG_IFUP, "created fcoe tx data (fp index %d)\n", fp->index); |
1122 | 1124 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index d096813994b2..b46822356a1c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
@@ -1959,7 +1959,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode) | |||
1959 | unsigned char *packet; | 1959 | unsigned char *packet; |
1960 | struct bnx2x_fastpath *fp_rx = &bp->fp[0]; | 1960 | struct bnx2x_fastpath *fp_rx = &bp->fp[0]; |
1961 | struct bnx2x_fastpath *fp_tx = &bp->fp[0]; | 1961 | struct bnx2x_fastpath *fp_tx = &bp->fp[0]; |
1962 | struct bnx2x_fp_txdata *txdata = &fp_tx->txdata[0]; | 1962 | struct bnx2x_fp_txdata *txdata = fp_tx->txdata_ptr[0]; |
1963 | u16 tx_start_idx, tx_idx; | 1963 | u16 tx_start_idx, tx_idx; |
1964 | u16 rx_start_idx, rx_idx; | 1964 | u16 rx_start_idx, rx_idx; |
1965 | u16 pkt_prod, bd_prod; | 1965 | u16 pkt_prod, bd_prod; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 9b216e64c4fc..e1c011e188aa 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -758,7 +758,7 @@ void bnx2x_panic_dump(struct bnx2x *bp) | |||
758 | /* Tx */ | 758 | /* Tx */ |
759 | for_each_cos_in_tx_queue(fp, cos) | 759 | for_each_cos_in_tx_queue(fp, cos) |
760 | { | 760 | { |
761 | txdata = fp->txdata[cos]; | 761 | txdata = *fp->txdata_ptr[cos]; |
762 | BNX2X_ERR("fp%d: tx_pkt_prod(0x%x) tx_pkt_cons(0x%x) tx_bd_prod(0x%x) tx_bd_cons(0x%x) *tx_cons_sb(0x%x)\n", | 762 | BNX2X_ERR("fp%d: tx_pkt_prod(0x%x) tx_pkt_cons(0x%x) tx_bd_prod(0x%x) tx_bd_cons(0x%x) *tx_cons_sb(0x%x)\n", |
763 | i, txdata.tx_pkt_prod, | 763 | i, txdata.tx_pkt_prod, |
764 | txdata.tx_pkt_cons, txdata.tx_bd_prod, | 764 | txdata.tx_pkt_cons, txdata.tx_bd_prod, |
@@ -876,7 +876,7 @@ void bnx2x_panic_dump(struct bnx2x *bp) | |||
876 | for_each_tx_queue(bp, i) { | 876 | for_each_tx_queue(bp, i) { |
877 | struct bnx2x_fastpath *fp = &bp->fp[i]; | 877 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
878 | for_each_cos_in_tx_queue(fp, cos) { | 878 | for_each_cos_in_tx_queue(fp, cos) { |
879 | struct bnx2x_fp_txdata *txdata = &fp->txdata[cos]; | 879 | struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; |
880 | 880 | ||
881 | start = TX_BD(le16_to_cpu(*txdata->tx_cons_sb) - 10); | 881 | start = TX_BD(le16_to_cpu(*txdata->tx_cons_sb) - 10); |
882 | end = TX_BD(le16_to_cpu(*txdata->tx_cons_sb) + 245); | 882 | end = TX_BD(le16_to_cpu(*txdata->tx_cons_sb) + 245); |
@@ -1710,7 +1710,7 @@ irqreturn_t bnx2x_interrupt(int irq, void *dev_instance) | |||
1710 | /* Handle Rx or Tx according to SB id */ | 1710 | /* Handle Rx or Tx according to SB id */ |
1711 | prefetch(fp->rx_cons_sb); | 1711 | prefetch(fp->rx_cons_sb); |
1712 | for_each_cos_in_tx_queue(fp, cos) | 1712 | for_each_cos_in_tx_queue(fp, cos) |
1713 | prefetch(fp->txdata[cos].tx_cons_sb); | 1713 | prefetch(fp->txdata_ptr[cos]->tx_cons_sb); |
1714 | prefetch(&fp->sb_running_index[SM_RX_ID]); | 1714 | prefetch(&fp->sb_running_index[SM_RX_ID]); |
1715 | napi_schedule(&bnx2x_fp(bp, fp->index, napi)); | 1715 | napi_schedule(&bnx2x_fp(bp, fp->index, napi)); |
1716 | status &= ~mask; | 1716 | status &= ~mask; |
@@ -2921,7 +2921,7 @@ static void bnx2x_pf_tx_q_prep(struct bnx2x *bp, | |||
2921 | struct bnx2x_fastpath *fp, struct bnx2x_txq_setup_params *txq_init, | 2921 | struct bnx2x_fastpath *fp, struct bnx2x_txq_setup_params *txq_init, |
2922 | u8 cos) | 2922 | u8 cos) |
2923 | { | 2923 | { |
2924 | txq_init->dscr_map = fp->txdata[cos].tx_desc_mapping; | 2924 | txq_init->dscr_map = fp->txdata_ptr[cos]->tx_desc_mapping; |
2925 | txq_init->sb_cq_index = HC_INDEX_ETH_FIRST_TX_CQ_CONS + cos; | 2925 | txq_init->sb_cq_index = HC_INDEX_ETH_FIRST_TX_CQ_CONS + cos; |
2926 | txq_init->traffic_type = LLFC_TRAFFIC_TYPE_NW; | 2926 | txq_init->traffic_type = LLFC_TRAFFIC_TYPE_NW; |
2927 | txq_init->fw_sb_id = fp->fw_sb_id; | 2927 | txq_init->fw_sb_id = fp->fw_sb_id; |
@@ -3068,11 +3068,11 @@ static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp) | |||
3068 | /* insert FCoE stats from ramrod response */ | 3068 | /* insert FCoE stats from ramrod response */ |
3069 | if (!NO_FCOE(bp)) { | 3069 | if (!NO_FCOE(bp)) { |
3070 | struct tstorm_per_queue_stats *fcoe_q_tstorm_stats = | 3070 | struct tstorm_per_queue_stats *fcoe_q_tstorm_stats = |
3071 | &bp->fw_stats_data->queue_stats[FCOE_IDX]. | 3071 | &bp->fw_stats_data->queue_stats[FCOE_IDX(bp)]. |
3072 | tstorm_queue_statistics; | 3072 | tstorm_queue_statistics; |
3073 | 3073 | ||
3074 | struct xstorm_per_queue_stats *fcoe_q_xstorm_stats = | 3074 | struct xstorm_per_queue_stats *fcoe_q_xstorm_stats = |
3075 | &bp->fw_stats_data->queue_stats[FCOE_IDX]. | 3075 | &bp->fw_stats_data->queue_stats[FCOE_IDX(bp)]. |
3076 | xstorm_queue_statistics; | 3076 | xstorm_queue_statistics; |
3077 | 3077 | ||
3078 | struct fcoe_statistics_params *fw_fcoe_stat = | 3078 | struct fcoe_statistics_params *fw_fcoe_stat = |
@@ -4741,7 +4741,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp) | |||
4741 | 4741 | ||
4742 | #ifdef BCM_CNIC | 4742 | #ifdef BCM_CNIC |
4743 | if (!NO_FCOE(bp)) { | 4743 | if (!NO_FCOE(bp)) { |
4744 | fp = &bp->fp[FCOE_IDX]; | 4744 | fp = &bp->fp[FCOE_IDX(bp)]; |
4745 | queue_params.q_obj = &fp->q_obj; | 4745 | queue_params.q_obj = &fp->q_obj; |
4746 | 4746 | ||
4747 | /* clear pending completion bit */ | 4747 | /* clear pending completion bit */ |
@@ -4778,7 +4778,7 @@ static struct bnx2x_queue_sp_obj *bnx2x_cid_to_q_obj( | |||
4778 | return &bnx2x_fcoe(bp, q_obj); | 4778 | return &bnx2x_fcoe(bp, q_obj); |
4779 | else | 4779 | else |
4780 | #endif | 4780 | #endif |
4781 | return &bnx2x_fp(bp, CID_TO_FP(cid), q_obj); | 4781 | return &bnx2x_fp(bp, CID_TO_FP(cid, bp), q_obj); |
4782 | } | 4782 | } |
4783 | 4783 | ||
4784 | static void bnx2x_eq_int(struct bnx2x *bp) | 4784 | static void bnx2x_eq_int(struct bnx2x *bp) |
@@ -5660,11 +5660,11 @@ static void bnx2x_init_eth_fp(struct bnx2x *bp, int fp_idx) | |||
5660 | 5660 | ||
5661 | /* init tx data */ | 5661 | /* init tx data */ |
5662 | for_each_cos_in_tx_queue(fp, cos) { | 5662 | for_each_cos_in_tx_queue(fp, cos) { |
5663 | bnx2x_init_txdata(bp, &fp->txdata[cos], | 5663 | bnx2x_init_txdata(bp, fp->txdata_ptr[cos], |
5664 | CID_COS_TO_TX_ONLY_CID(fp->cid, cos), | 5664 | CID_COS_TO_TX_ONLY_CID(fp->cid, cos, bp), |
5665 | FP_COS_TO_TXQ(fp, cos), | 5665 | FP_COS_TO_TXQ(fp, cos, bp), |
5666 | BNX2X_TX_SB_INDEX_BASE + cos); | 5666 | BNX2X_TX_SB_INDEX_BASE + cos, fp); |
5667 | cids[cos] = fp->txdata[cos].cid; | 5667 | cids[cos] = fp->txdata_ptr[cos]->cid; |
5668 | } | 5668 | } |
5669 | 5669 | ||
5670 | bnx2x_init_queue_obj(bp, &fp->q_obj, fp->cl_id, cids, fp->max_cos, | 5670 | bnx2x_init_queue_obj(bp, &fp->q_obj, fp->cl_id, cids, fp->max_cos, |
@@ -5719,7 +5719,7 @@ static void bnx2x_init_tx_rings(struct bnx2x *bp) | |||
5719 | 5719 | ||
5720 | for_each_tx_queue(bp, i) | 5720 | for_each_tx_queue(bp, i) |
5721 | for_each_cos_in_tx_queue(&bp->fp[i], cos) | 5721 | for_each_cos_in_tx_queue(&bp->fp[i], cos) |
5722 | bnx2x_init_tx_ring_one(&bp->fp[i].txdata[cos]); | 5722 | bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[cos]); |
5723 | } | 5723 | } |
5724 | 5724 | ||
5725 | void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) | 5725 | void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) |
@@ -7807,8 +7807,8 @@ static void bnx2x_pf_q_prep_init(struct bnx2x *bp, | |||
7807 | 7807 | ||
7808 | /* set the context pointers queue object */ | 7808 | /* set the context pointers queue object */ |
7809 | for (cos = FIRST_TX_COS_INDEX; cos < init_params->max_cos; cos++) { | 7809 | for (cos = FIRST_TX_COS_INDEX; cos < init_params->max_cos; cos++) { |
7810 | cxt_index = fp->txdata[cos].cid / ILT_PAGE_CIDS; | 7810 | cxt_index = fp->txdata_ptr[cos]->cid / ILT_PAGE_CIDS; |
7811 | cxt_offset = fp->txdata[cos].cid - (cxt_index * | 7811 | cxt_offset = fp->txdata_ptr[cos]->cid - (cxt_index * |
7812 | ILT_PAGE_CIDS); | 7812 | ILT_PAGE_CIDS); |
7813 | init_params->cxts[cos] = | 7813 | init_params->cxts[cos] = |
7814 | &bp->context[cxt_index].vcxt[cxt_offset].eth; | 7814 | &bp->context[cxt_index].vcxt[cxt_offset].eth; |
@@ -7961,7 +7961,7 @@ static int bnx2x_stop_queue(struct bnx2x *bp, int index) | |||
7961 | tx_index++){ | 7961 | tx_index++){ |
7962 | 7962 | ||
7963 | /* ascertain this is a normal queue*/ | 7963 | /* ascertain this is a normal queue*/ |
7964 | txdata = &fp->txdata[tx_index]; | 7964 | txdata = fp->txdata_ptr[tx_index]; |
7965 | 7965 | ||
7966 | DP(NETIF_MSG_IFDOWN, "stopping tx-only queue %d\n", | 7966 | DP(NETIF_MSG_IFDOWN, "stopping tx-only queue %d\n", |
7967 | txdata->txq_index); | 7967 | txdata->txq_index); |
@@ -8328,7 +8328,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode) | |||
8328 | struct bnx2x_fastpath *fp = &bp->fp[i]; | 8328 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
8329 | 8329 | ||
8330 | for_each_cos_in_tx_queue(fp, cos) | 8330 | for_each_cos_in_tx_queue(fp, cos) |
8331 | rc = bnx2x_clean_tx_queue(bp, &fp->txdata[cos]); | 8331 | rc = bnx2x_clean_tx_queue(bp, fp->txdata_ptr[cos]); |
8332 | #ifdef BNX2X_STOP_ON_ERROR | 8332 | #ifdef BNX2X_STOP_ON_ERROR |
8333 | if (rc) | 8333 | if (rc) |
8334 | return; | 8334 | return; |
@@ -11769,7 +11769,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
11769 | struct bnx2x *bp; | 11769 | struct bnx2x *bp; |
11770 | int pcie_width, pcie_speed; | 11770 | int pcie_width, pcie_speed; |
11771 | int rc, max_non_def_sbs; | 11771 | int rc, max_non_def_sbs; |
11772 | int rx_count, tx_count, rss_count; | 11772 | int rx_count, tx_count, rss_count, doorbell_size; |
11773 | /* | 11773 | /* |
11774 | * An estimated maximum supported CoS number according to the chip | 11774 | * An estimated maximum supported CoS number according to the chip |
11775 | * version. | 11775 | * version. |
@@ -11863,8 +11863,10 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
11863 | * Map doorbels here as we need the real value of bp->max_cos which | 11863 | * Map doorbels here as we need the real value of bp->max_cos which |
11864 | * is initialized in bnx2x_init_bp(). | 11864 | * is initialized in bnx2x_init_bp(). |
11865 | */ | 11865 | */ |
11866 | doorbell_size = (rss_count * max_cos_est + NON_ETH_CONTEXT_USE + | ||
11867 | CNIC_PRESENT) * (1 << BNX2X_DB_SHIFT); | ||
11866 | bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2), | 11868 | bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2), |
11867 | min_t(u64, BNX2X_DB_SIZE(bp), | 11869 | min_t(u64, doorbell_size, |
11868 | pci_resource_len(pdev, 2))); | 11870 | pci_resource_len(pdev, 2))); |
11869 | if (!bp->doorbells) { | 11871 | if (!bp->doorbells) { |
11870 | dev_err(&bp->pdev->dev, | 11872 | dev_err(&bp->pdev->dev, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c index 0e8bdcb9c748..776b52163b11 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | |||
@@ -1432,7 +1432,7 @@ static void bnx2x_prep_fw_stats_req(struct bnx2x *bp) | |||
1432 | query[first_queue_query_index + i]; | 1432 | query[first_queue_query_index + i]; |
1433 | 1433 | ||
1434 | cur_query_entry->kind = STATS_TYPE_QUEUE; | 1434 | cur_query_entry->kind = STATS_TYPE_QUEUE; |
1435 | cur_query_entry->index = bnx2x_stats_id(&bp->fp[FCOE_IDX]); | 1435 | cur_query_entry->index = bnx2x_stats_id(&bp->fp[FCOE_IDX(bp)]); |
1436 | cur_query_entry->funcID = cpu_to_le16(BP_FUNC(bp)); | 1436 | cur_query_entry->funcID = cpu_to_le16(BP_FUNC(bp)); |
1437 | cur_query_entry->address.hi = | 1437 | cur_query_entry->address.hi = |
1438 | cpu_to_le32(U64_HI(cur_data_offset)); | 1438 | cpu_to_le32(U64_HI(cur_data_offset)); |
@@ -1573,7 +1573,7 @@ void bnx2x_afex_collect_stats(struct bnx2x *bp, void *void_afex_stats, | |||
1573 | struct afex_stats *afex_stats = (struct afex_stats *)void_afex_stats; | 1573 | struct afex_stats *afex_stats = (struct afex_stats *)void_afex_stats; |
1574 | struct bnx2x_eth_stats *estats = &bp->eth_stats; | 1574 | struct bnx2x_eth_stats *estats = &bp->eth_stats; |
1575 | struct per_queue_stats *fcoe_q_stats = | 1575 | struct per_queue_stats *fcoe_q_stats = |
1576 | &bp->fw_stats_data->queue_stats[FCOE_IDX]; | 1576 | &bp->fw_stats_data->queue_stats[FCOE_IDX(bp)]; |
1577 | 1577 | ||
1578 | struct tstorm_per_queue_stats *fcoe_q_tstorm_stats = | 1578 | struct tstorm_per_queue_stats *fcoe_q_tstorm_stats = |
1579 | &fcoe_q_stats->tstorm_queue_statistics; | 1579 | &fcoe_q_stats->tstorm_queue_statistics; |