aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2013-08-19 02:11:57 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-20 03:21:47 -0400
commit07b4eb3b53f692a75fc0bc35c43345f331b7cca4 (patch)
tree24bfdbb54368860a976a16a161f1ce1077e7df71
parent9156b30b33acaef9ce602fb31230154f13af4881 (diff)
bnx2x: Change DCB context handling
After notification that DCBX configuration has ended arrived to the driver, the driver configured the FW/HW in sleepless context. As a result, it was possible to reach a race (mostly with CNIC registration) in which the configuration will return a timeout, failing to set the DCBX results correctly. This patch moves the configuration following the DCBX end into the slowpath RTNL task (i.e., sleepless context protected by the RTNL lock), allowing the configuration to cope with such races. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Ariel Elior <ariele@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.h2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c40
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c6
4 files changed, 43 insertions, 8 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index ce9b387b5a19..00b88cbfde25 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1333,6 +1333,8 @@ enum {
1333 BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN, 1333 BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
1334 BNX2X_SP_RTNL_VFPF_STORM_RX_MODE, 1334 BNX2X_SP_RTNL_VFPF_STORM_RX_MODE,
1335 BNX2X_SP_RTNL_HYPERVISOR_VLAN, 1335 BNX2X_SP_RTNL_HYPERVISOR_VLAN,
1336 BNX2X_SP_RTNL_TX_STOP,
1337 BNX2X_SP_RTNL_TX_RESUME,
1336}; 1338};
1337 1339
1338struct bnx2x_prev_path_list { 1340struct bnx2x_prev_path_list {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
index f9122f2d6b65..d537d51a2d2b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
@@ -30,10 +30,8 @@
30#include "bnx2x_dcb.h" 30#include "bnx2x_dcb.h"
31 31
32/* forward declarations of dcbx related functions */ 32/* forward declarations of dcbx related functions */
33static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp);
34static void bnx2x_pfc_set_pfc(struct bnx2x *bp); 33static void bnx2x_pfc_set_pfc(struct bnx2x *bp);
35static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp); 34static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp);
36static int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp);
37static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp, 35static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp,
38 u32 *set_configuration_ets_pg, 36 u32 *set_configuration_ets_pg,
39 u32 *pri_pg_tbl); 37 u32 *pri_pg_tbl);
@@ -425,30 +423,52 @@ static void bnx2x_pfc_set_pfc(struct bnx2x *bp)
425 bnx2x_pfc_clear(bp); 423 bnx2x_pfc_clear(bp);
426} 424}
427 425
428static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp) 426int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp)
429{ 427{
430 struct bnx2x_func_state_params func_params = {NULL}; 428 struct bnx2x_func_state_params func_params = {NULL};
429 int rc;
431 430
432 func_params.f_obj = &bp->func_obj; 431 func_params.f_obj = &bp->func_obj;
433 func_params.cmd = BNX2X_F_CMD_TX_STOP; 432 func_params.cmd = BNX2X_F_CMD_TX_STOP;
434 433
434 __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags);
435 __set_bit(RAMROD_RETRY, &func_params.ramrod_flags);
436
435 DP(BNX2X_MSG_DCB, "STOP TRAFFIC\n"); 437 DP(BNX2X_MSG_DCB, "STOP TRAFFIC\n");
436 return bnx2x_func_state_change(bp, &func_params); 438
439 rc = bnx2x_func_state_change(bp, &func_params);
440 if (rc) {
441 BNX2X_ERR("Unable to hold traffic for HW configuration\n");
442 bnx2x_panic();
443 }
444
445 return rc;
437} 446}
438 447
439static int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp) 448int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp)
440{ 449{
441 struct bnx2x_func_state_params func_params = {NULL}; 450 struct bnx2x_func_state_params func_params = {NULL};
442 struct bnx2x_func_tx_start_params *tx_params = 451 struct bnx2x_func_tx_start_params *tx_params =
443 &func_params.params.tx_start; 452 &func_params.params.tx_start;
453 int rc;
444 454
445 func_params.f_obj = &bp->func_obj; 455 func_params.f_obj = &bp->func_obj;
446 func_params.cmd = BNX2X_F_CMD_TX_START; 456 func_params.cmd = BNX2X_F_CMD_TX_START;
447 457
458 __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags);
459 __set_bit(RAMROD_RETRY, &func_params.ramrod_flags);
460
448 bnx2x_dcbx_fw_struct(bp, tx_params); 461 bnx2x_dcbx_fw_struct(bp, tx_params);
449 462
450 DP(BNX2X_MSG_DCB, "START TRAFFIC\n"); 463 DP(BNX2X_MSG_DCB, "START TRAFFIC\n");
451 return bnx2x_func_state_change(bp, &func_params); 464
465 rc = bnx2x_func_state_change(bp, &func_params);
466 if (rc) {
467 BNX2X_ERR("Unable to resume traffic after HW configuration\n");
468 bnx2x_panic();
469 }
470
471 return rc;
452} 472}
453 473
454static void bnx2x_dcbx_2cos_limit_update_ets_config(struct bnx2x *bp) 474static void bnx2x_dcbx_2cos_limit_update_ets_config(struct bnx2x *bp)
@@ -744,7 +764,9 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
744 if (IS_MF(bp)) 764 if (IS_MF(bp))
745 bnx2x_link_sync_notify(bp); 765 bnx2x_link_sync_notify(bp);
746 766
747 bnx2x_dcbx_stop_hw_tx(bp); 767 set_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state);
768
769 schedule_delayed_work(&bp->sp_rtnl_task, 0);
748 770
749 return; 771 return;
750 } 772 }
@@ -757,7 +779,9 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
757 /* ets may affect cmng configuration: reinit it in hw */ 779 /* ets may affect cmng configuration: reinit it in hw */
758 bnx2x_set_local_cmng(bp); 780 bnx2x_set_local_cmng(bp);
759 781
760 bnx2x_dcbx_resume_hw_tx(bp); 782 set_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state);
783
784 schedule_delayed_work(&bp->sp_rtnl_task, 0);
761 785
762 return; 786 return;
763 case BNX2X_DCBX_STATE_TX_RELEASED: 787 case BNX2X_DCBX_STATE_TX_RELEASED:
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h
index 125bd1b6586f..804b8f64463e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h
@@ -199,4 +199,7 @@ extern const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops;
199int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall); 199int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall);
200#endif /* BCM_DCBNL */ 200#endif /* BCM_DCBNL */
201 201
202int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp);
203int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp);
204
202#endif /* BNX2X_DCB_H */ 205#endif /* BNX2X_DCB_H */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index c009f1951ec1..b8d7c3ba685e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9655,6 +9655,12 @@ sp_rtnl_not_reset:
9655 &bp->sp_rtnl_state)) 9655 &bp->sp_rtnl_state))
9656 bnx2x_pf_set_vfs_vlan(bp); 9656 bnx2x_pf_set_vfs_vlan(bp);
9657 9657
9658 if (test_and_clear_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state))
9659 bnx2x_dcbx_stop_hw_tx(bp);
9660
9661 if (test_and_clear_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state))
9662 bnx2x_dcbx_resume_hw_tx(bp);
9663
9658 /* work which needs rtnl lock not-taken (as it takes the lock itself and 9664 /* work which needs rtnl lock not-taken (as it takes the lock itself and
9659 * can be called from other contexts as well) 9665 * can be called from other contexts as well)
9660 */ 9666 */