aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x
diff options
context:
space:
mode:
authorVladislav Zolotarov <vladz@broadcom.com>2011-07-18 21:45:02 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-19 12:57:49 -0400
commit53e51e2f480aaa000b0a7d2704ce2b4b646a73c7 (patch)
tree24b372ced7a414d4f72aa431517c96e2d90df419 /drivers/net/bnx2x
parentf5219d8eb8b32eb32522063d2163f95e1cf7bb5c (diff)
bnx2x: fix memory barriers
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c8
-rw-r--r--drivers/net/bnx2x/bnx2x_sp.c86
2 files changed, 75 insertions, 19 deletions
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 7a891824fab2..e4dea114d04a 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -2984,8 +2984,12 @@ static inline void bnx2x_sp_prod_update(struct bnx2x *bp)
2984{ 2984{
2985 int func = BP_FUNC(bp); 2985 int func = BP_FUNC(bp);
2986 2986
2987 /* Make sure that BD data is updated before writing the producer */ 2987 /*
2988 wmb(); 2988 * Make sure that BD data is updated before writing the producer:
2989 * BD data is written to the memory, the producer is read from the
2990 * memory, thus we need a full memory barrier to ensure the ordering.
2991 */
2992 mb();
2989 2993
2990 REG_WR16(bp, BAR_XSTRORM_INTMEM + XSTORM_SPQ_PROD_OFFSET(func), 2994 REG_WR16(bp, BAR_XSTRORM_INTMEM + XSTORM_SPQ_PROD_OFFSET(func),
2991 bp->spq_prod_idx); 2995 bp->spq_prod_idx);
diff --git a/drivers/net/bnx2x/bnx2x_sp.c b/drivers/net/bnx2x/bnx2x_sp.c
index 5a213e476d85..cce87d5e7609 100644
--- a/drivers/net/bnx2x/bnx2x_sp.c
+++ b/drivers/net/bnx2x/bnx2x_sp.c
@@ -1563,8 +1563,13 @@ static int bnx2x_execute_vlan_mac(struct bnx2x *bp,
1563 idx++; 1563 idx++;
1564 } 1564 }
1565 1565
1566 /* Commit the data writes towards the memory */ 1566 /*
1567 mb(); 1567 * No need for an explicit memory barrier here as long we would
1568 * need to ensure the ordering of writing to the SPQ element
1569 * and updating of the SPQ producer which involves a memory
1570 * read and we will have to put a full memory barrier there
1571 * (inside bnx2x_sp_post()).
1572 */
1568 1573
1569 rc = bnx2x_sp_post(bp, o->ramrod_cmd, r->cid, 1574 rc = bnx2x_sp_post(bp, o->ramrod_cmd, r->cid,
1570 U64_HI(r->rdata_mapping), 1575 U64_HI(r->rdata_mapping),
@@ -2224,8 +2229,13 @@ static int bnx2x_set_rx_mode_e2(struct bnx2x *bp,
2224 data->header.rule_cnt, p->rx_accept_flags, 2229 data->header.rule_cnt, p->rx_accept_flags,
2225 p->tx_accept_flags); 2230 p->tx_accept_flags);
2226 2231
2227 /* Commit writes towards the memory before sending a ramrod */ 2232 /*
2228 mb(); 2233 * No need for an explicit memory barrier here as long we would
2234 * need to ensure the ordering of writing to the SPQ element
2235 * and updating of the SPQ producer which involves a memory
2236 * read and we will have to put a full memory barrier there
2237 * (inside bnx2x_sp_post()).
2238 */
2229 2239
2230 /* Send a ramrod */ 2240 /* Send a ramrod */
2231 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_FILTER_RULES, p->cid, 2241 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_FILTER_RULES, p->cid,
@@ -2918,16 +2928,22 @@ static int bnx2x_mcast_setup_e2(struct bnx2x *bp,
2918 if (!o->total_pending_num) 2928 if (!o->total_pending_num)
2919 bnx2x_mcast_refresh_registry_e2(bp, o); 2929 bnx2x_mcast_refresh_registry_e2(bp, o);
2920 2930
2921 /* Commit writes towards the memory before sending a ramrod */ 2931 /*
2922 mb(); 2932 * If CLEAR_ONLY was requested - don't send a ramrod and clear
2923
2924 /* If CLEAR_ONLY was requested - don't send a ramrod and clear
2925 * RAMROD_PENDING status immediately. 2933 * RAMROD_PENDING status immediately.
2926 */ 2934 */
2927 if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { 2935 if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) {
2928 raw->clear_pending(raw); 2936 raw->clear_pending(raw);
2929 return 0; 2937 return 0;
2930 } else { 2938 } else {
2939 /*
2940 * No need for an explicit memory barrier here as long we would
2941 * need to ensure the ordering of writing to the SPQ element
2942 * and updating of the SPQ producer which involves a memory
2943 * read and we will have to put a full memory barrier there
2944 * (inside bnx2x_sp_post()).
2945 */
2946
2931 /* Send a ramrod */ 2947 /* Send a ramrod */
2932 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_MULTICAST_RULES, 2948 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_MULTICAST_RULES,
2933 raw->cid, U64_HI(raw->rdata_mapping), 2949 raw->cid, U64_HI(raw->rdata_mapping),
@@ -3404,16 +3420,22 @@ static int bnx2x_mcast_setup_e1(struct bnx2x *bp,
3404 if (rc) 3420 if (rc)
3405 return rc; 3421 return rc;
3406 3422
3407 /* Commit writes towards the memory before sending a ramrod */ 3423 /*
3408 mb(); 3424 * If CLEAR_ONLY was requested - don't send a ramrod and clear
3409
3410 /* If CLEAR_ONLY was requested - don't send a ramrod and clear
3411 * RAMROD_PENDING status immediately. 3425 * RAMROD_PENDING status immediately.
3412 */ 3426 */
3413 if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { 3427 if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) {
3414 raw->clear_pending(raw); 3428 raw->clear_pending(raw);
3415 return 0; 3429 return 0;
3416 } else { 3430 } else {
3431 /*
3432 * No need for an explicit memory barrier here as long we would
3433 * need to ensure the ordering of writing to the SPQ element
3434 * and updating of the SPQ producer which involves a memory
3435 * read and we will have to put a full memory barrier there
3436 * (inside bnx2x_sp_post()).
3437 */
3438
3417 /* Send a ramrod */ 3439 /* Send a ramrod */
3418 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, raw->cid, 3440 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, raw->cid,
3419 U64_HI(raw->rdata_mapping), 3441 U64_HI(raw->rdata_mapping),
@@ -4038,8 +4060,13 @@ static int bnx2x_setup_rss(struct bnx2x *bp,
4038 data->capabilities |= ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY; 4060 data->capabilities |= ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY;
4039 } 4061 }
4040 4062
4041 /* Commit writes towards the memory before sending a ramrod */ 4063 /*
4042 mb(); 4064 * No need for an explicit memory barrier here as long we would
4065 * need to ensure the ordering of writing to the SPQ element
4066 * and updating of the SPQ producer which involves a memory
4067 * read and we will have to put a full memory barrier there
4068 * (inside bnx2x_sp_post()).
4069 */
4043 4070
4044 /* Send a ramrod */ 4071 /* Send a ramrod */
4045 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_RSS_UPDATE, r->cid, 4072 rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_RSS_UPDATE, r->cid,
@@ -4505,7 +4532,13 @@ static inline int bnx2x_q_send_setup_e1x(struct bnx2x *bp,
4505 /* Fill the ramrod data */ 4532 /* Fill the ramrod data */
4506 bnx2x_q_fill_setup_data_cmn(bp, params, rdata); 4533 bnx2x_q_fill_setup_data_cmn(bp, params, rdata);
4507 4534
4508 mb(); 4535 /*
4536 * No need for an explicit memory barrier here as long we would
4537 * need to ensure the ordering of writing to the SPQ element
4538 * and updating of the SPQ producer which involves a memory
4539 * read and we will have to put a full memory barrier there
4540 * (inside bnx2x_sp_post()).
4541 */
4509 4542
4510 return bnx2x_sp_post(bp, ramrod, o->cids[BNX2X_PRIMARY_CID_INDEX], 4543 return bnx2x_sp_post(bp, ramrod, o->cids[BNX2X_PRIMARY_CID_INDEX],
4511 U64_HI(data_mapping), 4544 U64_HI(data_mapping),
@@ -4528,6 +4561,13 @@ static inline int bnx2x_q_send_setup_e2(struct bnx2x *bp,
4528 bnx2x_q_fill_setup_data_cmn(bp, params, rdata); 4561 bnx2x_q_fill_setup_data_cmn(bp, params, rdata);
4529 bnx2x_q_fill_setup_data_e2(bp, params, rdata); 4562 bnx2x_q_fill_setup_data_e2(bp, params, rdata);
4530 4563
4564 /*
4565 * No need for an explicit memory barrier here as long we would
4566 * need to ensure the ordering of writing to the SPQ element
4567 * and updating of the SPQ producer which involves a memory
4568 * read and we will have to put a full memory barrier there
4569 * (inside bnx2x_sp_post()).
4570 */
4531 4571
4532 return bnx2x_sp_post(bp, ramrod, o->cids[BNX2X_PRIMARY_CID_INDEX], 4572 return bnx2x_sp_post(bp, ramrod, o->cids[BNX2X_PRIMARY_CID_INDEX],
4533 U64_HI(data_mapping), 4573 U64_HI(data_mapping),
@@ -4665,7 +4705,13 @@ static inline int bnx2x_q_send_update(struct bnx2x *bp,
4665 /* Fill the ramrod data */ 4705 /* Fill the ramrod data */
4666 bnx2x_q_fill_update_data(bp, o, update_params, rdata); 4706 bnx2x_q_fill_update_data(bp, o, update_params, rdata);
4667 4707
4668 mb(); 4708 /*
4709 * No need for an explicit memory barrier here as long we would
4710 * need to ensure the ordering of writing to the SPQ element
4711 * and updating of the SPQ producer which involves a memory
4712 * read and we will have to put a full memory barrier there
4713 * (inside bnx2x_sp_post()).
4714 */
4669 4715
4670 return bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_CLIENT_UPDATE, 4716 return bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_CLIENT_UPDATE,
4671 o->cids[cid_index], U64_HI(data_mapping), 4717 o->cids[cid_index], U64_HI(data_mapping),
@@ -5484,7 +5530,13 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp,
5484 rdata->path_id = BP_PATH(bp); 5530 rdata->path_id = BP_PATH(bp);
5485 rdata->network_cos_mode = start_params->network_cos_mode; 5531 rdata->network_cos_mode = start_params->network_cos_mode;
5486 5532
5487 mb(); 5533 /*
5534 * No need for an explicit memory barrier here as long we would
5535 * need to ensure the ordering of writing to the SPQ element
5536 * and updating of the SPQ producer which involves a memory
5537 * read and we will have to put a full memory barrier there
5538 * (inside bnx2x_sp_post()).
5539 */
5488 5540
5489 return bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_FUNCTION_START, 0, 5541 return bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_FUNCTION_START, 0,
5490 U64_HI(data_mapping), 5542 U64_HI(data_mapping),