aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAriel Elior <ariele@broadcom.com>2013-10-20 10:51:32 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-21 18:31:35 -0400
commit32316a46f2bbd4a898acf86547197cff8476f442 (patch)
tree815a114bcc30968e82c73e3b8b534f722ed00969 /drivers/net
parent6b991c3763e15a0884095fc0c133980c5577e9c7 (diff)
bnx2x: Lock DMAE when used by statistic flow
bnx2x has several clients to its DMAE machines - all of them with the exception of the statistics flow used the same locking mechanisms to synchronize the DMAE machines' usage. Since statistics (which are periodically entered) use DMAE without taking the locks, they may erase the commands which were previously set - e.g., it may cause a VF to timeout while waiting for a PF answer on the VF-PF channel as that command header would have been overwritten by the statistics' header. This patch makes certain that all flows utilizing DMAE will use the same API, assuring that the locking scheme will be kept by all said flows. Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c14
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c2
4 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 275b1261e533..310c57aa9221 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -2073,7 +2073,8 @@ u32 bnx2x_dmae_opcode(struct bnx2x *bp, u8 src_type, u8 dst_type,
2073 2073
2074void bnx2x_prep_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae, 2074void bnx2x_prep_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
2075 u8 src_type, u8 dst_type); 2075 u8 src_type, u8 dst_type);
2076int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae); 2076int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
2077 u32 *comp);
2077 2078
2078/* FLR related routines */ 2079/* FLR related routines */
2079u32 bnx2x_flr_clnup_poll_count(struct bnx2x *bp); 2080u32 bnx2x_flr_clnup_poll_count(struct bnx2x *bp);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index c2609c41340e..236707228f67 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -503,9 +503,9 @@ void bnx2x_prep_dmae_with_comp(struct bnx2x *bp,
503} 503}
504 504
505/* issue a dmae command over the init-channel and wait for completion */ 505/* issue a dmae command over the init-channel and wait for completion */
506int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae) 506int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
507 u32 *comp)
507{ 508{
508 u32 *wb_comp = bnx2x_sp(bp, wb_comp);
509 int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 4000; 509 int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 4000;
510 int rc = 0; 510 int rc = 0;
511 511
@@ -518,14 +518,14 @@ int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae)
518 spin_lock_bh(&bp->dmae_lock); 518 spin_lock_bh(&bp->dmae_lock);
519 519
520 /* reset completion */ 520 /* reset completion */
521 *wb_comp = 0; 521 *comp = 0;
522 522
523 /* post the command on the channel used for initializations */ 523 /* post the command on the channel used for initializations */
524 bnx2x_post_dmae(bp, dmae, INIT_DMAE_C(bp)); 524 bnx2x_post_dmae(bp, dmae, INIT_DMAE_C(bp));
525 525
526 /* wait for completion */ 526 /* wait for completion */
527 udelay(5); 527 udelay(5);
528 while ((*wb_comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) { 528 while ((*comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) {
529 529
530 if (!cnt || 530 if (!cnt ||
531 (bp->recovery_state != BNX2X_RECOVERY_DONE && 531 (bp->recovery_state != BNX2X_RECOVERY_DONE &&
@@ -537,7 +537,7 @@ int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae)
537 cnt--; 537 cnt--;
538 udelay(50); 538 udelay(50);
539 } 539 }
540 if (*wb_comp & DMAE_PCI_ERR_FLAG) { 540 if (*comp & DMAE_PCI_ERR_FLAG) {
541 BNX2X_ERR("DMAE PCI error!\n"); 541 BNX2X_ERR("DMAE PCI error!\n");
542 rc = DMAE_PCI_ERROR; 542 rc = DMAE_PCI_ERROR;
543 } 543 }
@@ -574,7 +574,7 @@ void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
574 dmae.len = len32; 574 dmae.len = len32;
575 575
576 /* issue the command and wait for completion */ 576 /* issue the command and wait for completion */
577 rc = bnx2x_issue_dmae_with_comp(bp, &dmae); 577 rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp));
578 if (rc) { 578 if (rc) {
579 BNX2X_ERR("DMAE returned failure %d\n", rc); 579 BNX2X_ERR("DMAE returned failure %d\n", rc);
580 bnx2x_panic(); 580 bnx2x_panic();
@@ -611,7 +611,7 @@ void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32)
611 dmae.len = len32; 611 dmae.len = len32;
612 612
613 /* issue the command and wait for completion */ 613 /* issue the command and wait for completion */
614 rc = bnx2x_issue_dmae_with_comp(bp, &dmae); 614 rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp));
615 if (rc) { 615 if (rc) {
616 BNX2X_ERR("DMAE returned failure %d\n", rc); 616 BNX2X_ERR("DMAE returned failure %d\n", rc);
617 bnx2x_panic(); 617 bnx2x_panic();
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index 86436c77af03..3b75070411aa 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -196,7 +196,7 @@ static void bnx2x_hw_stats_post(struct bnx2x *bp)
196 196
197 } else if (bp->func_stx) { 197 } else if (bp->func_stx) {
198 *stats_comp = 0; 198 *stats_comp = 0;
199 bnx2x_post_dmae(bp, dmae, INIT_DMAE_C(bp)); 199 bnx2x_issue_dmae_with_comp(bp, dmae, stats_comp);
200 } 200 }
201} 201}
202 202
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index da16953eb2ec..28757dfacf0d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -980,7 +980,7 @@ static int bnx2x_copy32_vf_dmae(struct bnx2x *bp, u8 from_vf,
980 dmae.len = len32; 980 dmae.len = len32;
981 981
982 /* issue the command and wait for completion */ 982 /* issue the command and wait for completion */
983 return bnx2x_issue_dmae_with_comp(bp, &dmae); 983 return bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp));
984} 984}
985 985
986static void bnx2x_vf_mbx_resp(struct bnx2x *bp, struct bnx2x_virtf *vf) 986static void bnx2x_vf_mbx_resp(struct bnx2x *bp, struct bnx2x_virtf *vf)