diff options
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 63 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 31 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 18 |
7 files changed, 81 insertions, 55 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 8d726f6e1c52..2361bf236ce3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -53,6 +53,7 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to) | |||
53 | struct bnx2x_fp_stats *to_fp_stats = &bp->fp_stats[to]; | 53 | struct bnx2x_fp_stats *to_fp_stats = &bp->fp_stats[to]; |
54 | int old_max_eth_txqs, new_max_eth_txqs; | 54 | int old_max_eth_txqs, new_max_eth_txqs; |
55 | int old_txdata_index = 0, new_txdata_index = 0; | 55 | int old_txdata_index = 0, new_txdata_index = 0; |
56 | struct bnx2x_agg_info *old_tpa_info = to_fp->tpa_info; | ||
56 | 57 | ||
57 | /* Copy the NAPI object as it has been already initialized */ | 58 | /* Copy the NAPI object as it has been already initialized */ |
58 | from_fp->napi = to_fp->napi; | 59 | from_fp->napi = to_fp->napi; |
@@ -61,6 +62,11 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to) | |||
61 | memcpy(to_fp, from_fp, sizeof(*to_fp)); | 62 | memcpy(to_fp, from_fp, sizeof(*to_fp)); |
62 | to_fp->index = to; | 63 | to_fp->index = to; |
63 | 64 | ||
65 | /* Retain the tpa_info of the original `to' version as we don't want | ||
66 | * 2 FPs to contain the same tpa_info pointer. | ||
67 | */ | ||
68 | to_fp->tpa_info = old_tpa_info; | ||
69 | |||
64 | /* move sp_objs contents as well, as their indices match fp ones */ | 70 | /* move sp_objs contents as well, as their indices match fp ones */ |
65 | memcpy(to_sp_objs, from_sp_objs, sizeof(*to_sp_objs)); | 71 | memcpy(to_sp_objs, from_sp_objs, sizeof(*to_sp_objs)); |
66 | 72 | ||
@@ -2959,8 +2965,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) | |||
2959 | if (IS_PF(bp)) { | 2965 | if (IS_PF(bp)) { |
2960 | if (CNIC_LOADED(bp)) | 2966 | if (CNIC_LOADED(bp)) |
2961 | bnx2x_free_mem_cnic(bp); | 2967 | bnx2x_free_mem_cnic(bp); |
2962 | bnx2x_free_mem(bp); | ||
2963 | } | 2968 | } |
2969 | bnx2x_free_mem(bp); | ||
2970 | |||
2964 | bp->state = BNX2X_STATE_CLOSED; | 2971 | bp->state = BNX2X_STATE_CLOSED; |
2965 | bp->cnic_loaded = false; | 2972 | bp->cnic_loaded = false; |
2966 | 2973 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 9d64b988ab34..664568420c9b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -6501,12 +6501,13 @@ static int bnx2x_link_initialize(struct link_params *params, | |||
6501 | struct bnx2x_phy *phy = ¶ms->phy[INT_PHY]; | 6501 | struct bnx2x_phy *phy = ¶ms->phy[INT_PHY]; |
6502 | if (vars->line_speed == SPEED_AUTO_NEG && | 6502 | if (vars->line_speed == SPEED_AUTO_NEG && |
6503 | (CHIP_IS_E1x(bp) || | 6503 | (CHIP_IS_E1x(bp) || |
6504 | CHIP_IS_E2(bp))) | 6504 | CHIP_IS_E2(bp))) { |
6505 | bnx2x_set_parallel_detection(phy, params); | 6505 | bnx2x_set_parallel_detection(phy, params); |
6506 | if (params->phy[INT_PHY].config_init) | 6506 | if (params->phy[INT_PHY].config_init) |
6507 | params->phy[INT_PHY].config_init(phy, | 6507 | params->phy[INT_PHY].config_init(phy, |
6508 | params, | 6508 | params, |
6509 | vars); | 6509 | vars); |
6510 | } | ||
6510 | } | 6511 | } |
6511 | 6512 | ||
6512 | /* Init external phy*/ | 6513 | /* Init external phy*/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index c69990d2170e..285f2a59a3a5 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -7855,12 +7855,15 @@ void bnx2x_free_mem(struct bnx2x *bp) | |||
7855 | { | 7855 | { |
7856 | int i; | 7856 | int i; |
7857 | 7857 | ||
7858 | BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping, | ||
7859 | sizeof(struct host_sp_status_block)); | ||
7860 | |||
7861 | BNX2X_PCI_FREE(bp->fw_stats, bp->fw_stats_mapping, | 7858 | BNX2X_PCI_FREE(bp->fw_stats, bp->fw_stats_mapping, |
7862 | bp->fw_stats_data_sz + bp->fw_stats_req_sz); | 7859 | bp->fw_stats_data_sz + bp->fw_stats_req_sz); |
7863 | 7860 | ||
7861 | if (IS_VF(bp)) | ||
7862 | return; | ||
7863 | |||
7864 | BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping, | ||
7865 | sizeof(struct host_sp_status_block)); | ||
7866 | |||
7864 | BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping, | 7867 | BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping, |
7865 | sizeof(struct bnx2x_slowpath)); | 7868 | sizeof(struct bnx2x_slowpath)); |
7866 | 7869 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 73731eb68f2a..b26eb83069b6 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -545,23 +545,6 @@ static int bnx2x_vfop_set_user_req(struct bnx2x *bp, | |||
545 | return 0; | 545 | return 0; |
546 | } | 546 | } |
547 | 547 | ||
548 | static int | ||
549 | bnx2x_vfop_config_vlan0(struct bnx2x *bp, | ||
550 | struct bnx2x_vlan_mac_ramrod_params *vlan_mac, | ||
551 | bool add) | ||
552 | { | ||
553 | int rc; | ||
554 | |||
555 | vlan_mac->user_req.cmd = add ? BNX2X_VLAN_MAC_ADD : | ||
556 | BNX2X_VLAN_MAC_DEL; | ||
557 | vlan_mac->user_req.u.vlan.vlan = 0; | ||
558 | |||
559 | rc = bnx2x_config_vlan_mac(bp, vlan_mac); | ||
560 | if (rc == -EEXIST) | ||
561 | rc = 0; | ||
562 | return rc; | ||
563 | } | ||
564 | |||
565 | static int bnx2x_vfop_config_list(struct bnx2x *bp, | 548 | static int bnx2x_vfop_config_list(struct bnx2x *bp, |
566 | struct bnx2x_vfop_filters *filters, | 549 | struct bnx2x_vfop_filters *filters, |
567 | struct bnx2x_vlan_mac_ramrod_params *vlan_mac) | 550 | struct bnx2x_vlan_mac_ramrod_params *vlan_mac) |
@@ -666,30 +649,14 @@ static void bnx2x_vfop_vlan_mac(struct bnx2x *bp, struct bnx2x_virtf *vf) | |||
666 | 649 | ||
667 | case BNX2X_VFOP_VLAN_CONFIG_LIST: | 650 | case BNX2X_VFOP_VLAN_CONFIG_LIST: |
668 | /* next state */ | 651 | /* next state */ |
669 | vfop->state = BNX2X_VFOP_VLAN_CONFIG_LIST_0; | 652 | vfop->state = BNX2X_VFOP_VLAN_MAC_CHK_DONE; |
670 | |||
671 | /* remove vlan0 - could be no-op */ | ||
672 | vfop->rc = bnx2x_vfop_config_vlan0(bp, vlan_mac, false); | ||
673 | if (vfop->rc) | ||
674 | goto op_err; | ||
675 | 653 | ||
676 | /* Do vlan list config. if this operation fails we try to | 654 | /* do list config */ |
677 | * restore vlan0 to keep the queue is working order | ||
678 | */ | ||
679 | vfop->rc = bnx2x_vfop_config_list(bp, filters, vlan_mac); | 655 | vfop->rc = bnx2x_vfop_config_list(bp, filters, vlan_mac); |
680 | if (!vfop->rc) { | 656 | if (!vfop->rc) { |
681 | set_bit(RAMROD_CONT, &vlan_mac->ramrod_flags); | 657 | set_bit(RAMROD_CONT, &vlan_mac->ramrod_flags); |
682 | vfop->rc = bnx2x_config_vlan_mac(bp, vlan_mac); | 658 | vfop->rc = bnx2x_config_vlan_mac(bp, vlan_mac); |
683 | } | 659 | } |
684 | bnx2x_vfop_finalize(vf, vfop->rc, VFOP_CONT); /* fall-through */ | ||
685 | |||
686 | case BNX2X_VFOP_VLAN_CONFIG_LIST_0: | ||
687 | /* next state */ | ||
688 | vfop->state = BNX2X_VFOP_VLAN_MAC_CHK_DONE; | ||
689 | |||
690 | if (list_empty(&obj->head)) | ||
691 | /* add vlan0 */ | ||
692 | vfop->rc = bnx2x_vfop_config_vlan0(bp, vlan_mac, true); | ||
693 | bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE); | 660 | bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE); |
694 | 661 | ||
695 | default: | 662 | default: |
@@ -2833,6 +2800,18 @@ int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map) | |||
2833 | return 0; | 2800 | return 0; |
2834 | } | 2801 | } |
2835 | 2802 | ||
2803 | struct set_vf_state_cookie { | ||
2804 | struct bnx2x_virtf *vf; | ||
2805 | u8 state; | ||
2806 | }; | ||
2807 | |||
2808 | void bnx2x_set_vf_state(void *cookie) | ||
2809 | { | ||
2810 | struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie; | ||
2811 | |||
2812 | p->vf->state = p->state; | ||
2813 | } | ||
2814 | |||
2836 | /* VFOP close (teardown the queues, delete mcasts and close HW) */ | 2815 | /* VFOP close (teardown the queues, delete mcasts and close HW) */ |
2837 | static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf) | 2816 | static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf) |
2838 | { | 2817 | { |
@@ -2883,7 +2862,19 @@ static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf) | |||
2883 | op_err: | 2862 | op_err: |
2884 | BNX2X_ERR("VF[%d] CLOSE error: rc %d\n", vf->abs_vfid, vfop->rc); | 2863 | BNX2X_ERR("VF[%d] CLOSE error: rc %d\n", vf->abs_vfid, vfop->rc); |
2885 | op_done: | 2864 | op_done: |
2886 | vf->state = VF_ACQUIRED; | 2865 | |
2866 | /* need to make sure there are no outstanding stats ramrods which may | ||
2867 | * cause the device to access the VF's stats buffer which it will free | ||
2868 | * as soon as we return from the close flow. | ||
2869 | */ | ||
2870 | { | ||
2871 | struct set_vf_state_cookie cookie; | ||
2872 | |||
2873 | cookie.vf = vf; | ||
2874 | cookie.state = VF_ACQUIRED; | ||
2875 | bnx2x_stats_safe_exec(bp, bnx2x_set_vf_state, &cookie); | ||
2876 | } | ||
2877 | |||
2887 | DP(BNX2X_MSG_IOV, "set state to acquired\n"); | 2878 | DP(BNX2X_MSG_IOV, "set state to acquired\n"); |
2888 | bnx2x_vfop_end(bp, vf, vfop); | 2879 | bnx2x_vfop_end(bp, vf, vfop); |
2889 | } | 2880 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c index d63d1327b051..86436c77af03 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | |||
@@ -522,20 +522,16 @@ static void bnx2x_func_stats_init(struct bnx2x *bp) | |||
522 | /* should be called under stats_sema */ | 522 | /* should be called under stats_sema */ |
523 | static void __bnx2x_stats_start(struct bnx2x *bp) | 523 | static void __bnx2x_stats_start(struct bnx2x *bp) |
524 | { | 524 | { |
525 | /* vfs travel through here as part of the statistics FSM, but no action | 525 | if (IS_PF(bp)) { |
526 | * is required | 526 | if (bp->port.pmf) |
527 | */ | 527 | bnx2x_port_stats_init(bp); |
528 | if (IS_VF(bp)) | ||
529 | return; | ||
530 | |||
531 | if (bp->port.pmf) | ||
532 | bnx2x_port_stats_init(bp); | ||
533 | 528 | ||
534 | else if (bp->func_stx) | 529 | else if (bp->func_stx) |
535 | bnx2x_func_stats_init(bp); | 530 | bnx2x_func_stats_init(bp); |
536 | 531 | ||
537 | bnx2x_hw_stats_post(bp); | 532 | bnx2x_hw_stats_post(bp); |
538 | bnx2x_storm_stats_post(bp); | 533 | bnx2x_storm_stats_post(bp); |
534 | } | ||
539 | 535 | ||
540 | bp->stats_started = true; | 536 | bp->stats_started = true; |
541 | } | 537 | } |
@@ -1997,3 +1993,14 @@ void bnx2x_afex_collect_stats(struct bnx2x *bp, void *void_afex_stats, | |||
1997 | estats->mac_discard); | 1993 | estats->mac_discard); |
1998 | } | 1994 | } |
1999 | } | 1995 | } |
1996 | |||
1997 | void bnx2x_stats_safe_exec(struct bnx2x *bp, | ||
1998 | void (func_to_exec)(void *cookie), | ||
1999 | void *cookie){ | ||
2000 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
2001 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
2002 | bnx2x_stats_comp(bp); | ||
2003 | func_to_exec(cookie); | ||
2004 | __bnx2x_stats_start(bp); | ||
2005 | up(&bp->stats_sema); | ||
2006 | } | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h index 853824d258e8..f35845006cdd 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | |||
@@ -539,6 +539,9 @@ struct bnx2x; | |||
539 | void bnx2x_memset_stats(struct bnx2x *bp); | 539 | void bnx2x_memset_stats(struct bnx2x *bp); |
540 | void bnx2x_stats_init(struct bnx2x *bp); | 540 | void bnx2x_stats_init(struct bnx2x *bp); |
541 | void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event); | 541 | void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event); |
542 | void bnx2x_stats_safe_exec(struct bnx2x *bp, | ||
543 | void (func_to_exec)(void *cookie), | ||
544 | void *cookie); | ||
542 | 545 | ||
543 | /** | 546 | /** |
544 | * bnx2x_save_statistics - save statistics when unloading. | 547 | * bnx2x_save_statistics - save statistics when unloading. |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 2e55ee29cf13..5701f3d1a169 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -3030,6 +3030,19 @@ static bool tg3_phy_power_bug(struct tg3 *tp) | |||
3030 | return false; | 3030 | return false; |
3031 | } | 3031 | } |
3032 | 3032 | ||
3033 | static bool tg3_phy_led_bug(struct tg3 *tp) | ||
3034 | { | ||
3035 | switch (tg3_asic_rev(tp)) { | ||
3036 | case ASIC_REV_5719: | ||
3037 | if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) && | ||
3038 | !tp->pci_fn) | ||
3039 | return true; | ||
3040 | return false; | ||
3041 | } | ||
3042 | |||
3043 | return false; | ||
3044 | } | ||
3045 | |||
3033 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | 3046 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) |
3034 | { | 3047 | { |
3035 | u32 val; | 3048 | u32 val; |
@@ -3077,8 +3090,9 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
3077 | } | 3090 | } |
3078 | return; | 3091 | return; |
3079 | } else if (do_low_power) { | 3092 | } else if (do_low_power) { |
3080 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 3093 | if (!tg3_phy_led_bug(tp)) |
3081 | MII_TG3_EXT_CTRL_FORCE_LED_OFF); | 3094 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
3095 | MII_TG3_EXT_CTRL_FORCE_LED_OFF); | ||
3082 | 3096 | ||
3083 | val = MII_TG3_AUXCTL_PCTL_100TX_LPWR | | 3097 | val = MII_TG3_AUXCTL_PCTL_100TX_LPWR | |
3084 | MII_TG3_AUXCTL_PCTL_SPR_ISOLATE | | 3098 | MII_TG3_AUXCTL_PCTL_SPR_ISOLATE | |