Skip to content

Commit 9a3bc77

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Properly report no pause support on some cards
Some cards are configured to never support link pause or PFC. Discover these cards and properly report no pause support to ethtool. Disable PFC settings from DCBNL if PFC is unsupported. Reviewed-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0f5a484 commit 9a3bc77

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9416,7 +9416,7 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
94169416
if (rc)
94179417
goto hwrm_phy_qcaps_exit;
94189418

9419-
bp->phy_flags = resp->flags;
9419+
bp->phy_flags = resp->flags | (le16_to_cpu(resp->flags2) << 8);
94209420
if (resp->flags & PORT_PHY_QCAPS_RESP_FLAGS_EEE_SUPPORTED) {
94219421
struct ethtool_eee *eee = &bp->eee;
94229422
u16 fw_speeds = le16_to_cpu(resp->supported_speeds_eee_mode);

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,8 +2104,8 @@ struct bnxt {
21042104
u32 lpi_tmr_lo;
21052105
u32 lpi_tmr_hi;
21062106

2107-
/* copied from flags in hwrm_port_phy_qcaps_output */
2108-
u8 phy_flags;
2107+
/* copied from flags and flags2 in hwrm_port_phy_qcaps_output */
2108+
u32 phy_flags;
21092109
#define BNXT_PHY_FL_EEE_CAP PORT_PHY_QCAPS_RESP_FLAGS_EEE_SUPPORTED
21102110
#define BNXT_PHY_FL_EXT_LPBK PORT_PHY_QCAPS_RESP_FLAGS_EXTERNAL_LPBK_SUPPORTED
21112111
#define BNXT_PHY_FL_AN_PHY_LPBK PORT_PHY_QCAPS_RESP_FLAGS_AUTONEG_LPBK_SUPPORTED
@@ -2114,6 +2114,8 @@ struct bnxt {
21142114
#define BNXT_PHY_FL_NO_PHY_LPBK PORT_PHY_QCAPS_RESP_FLAGS_LOCAL_LPBK_NOT_SUPPORTED
21152115
#define BNXT_PHY_FL_FW_MANAGED_LKDN PORT_PHY_QCAPS_RESP_FLAGS_FW_MANAGED_LINK_DOWN
21162116
#define BNXT_PHY_FL_NO_FCS PORT_PHY_QCAPS_RESP_FLAGS_NO_FCS
2117+
#define BNXT_PHY_FL_NO_PAUSE (PORT_PHY_QCAPS_RESP_FLAGS2_PAUSE_UNSUPPORTED << 8)
2118+
#define BNXT_PHY_FL_NO_PFC (PORT_PHY_QCAPS_RESP_FLAGS2_PFC_UNSUPPORTED << 8)
21172119

21182120
u8 num_tests;
21192121
struct bnxt_test_info *test_info;

drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ static int bnxt_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc)
627627
int rc;
628628

629629
if (!(bp->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) ||
630-
!(bp->dcbx_cap & DCB_CAP_DCBX_HOST))
630+
!(bp->dcbx_cap & DCB_CAP_DCBX_HOST) ||
631+
(bp->phy_flags & BNXT_PHY_FL_NO_PAUSE))
631632
return -EINVAL;
632633

633634
if (!my_pfc) {

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,15 +1662,19 @@ static void bnxt_fw_to_ethtool_support_fec(struct bnxt_link_info *link_info,
16621662
static void bnxt_fw_to_ethtool_support_spds(struct bnxt_link_info *link_info,
16631663
struct ethtool_link_ksettings *lk_ksettings)
16641664
{
1665+
struct bnxt *bp = container_of(link_info, struct bnxt, link_info);
16651666
u16 fw_speeds = link_info->support_speeds;
16661667

16671668
BNXT_FW_TO_ETHTOOL_SPDS(fw_speeds, 0, lk_ksettings, supported);
16681669
fw_speeds = link_info->support_pam4_speeds;
16691670
BNXT_FW_TO_ETHTOOL_PAM4_SPDS(fw_speeds, lk_ksettings, supported);
16701671

1671-
ethtool_link_ksettings_add_link_mode(lk_ksettings, supported, Pause);
1672-
ethtool_link_ksettings_add_link_mode(lk_ksettings, supported,
1673-
Asym_Pause);
1672+
if (!(bp->phy_flags & BNXT_PHY_FL_NO_PAUSE)) {
1673+
ethtool_link_ksettings_add_link_mode(lk_ksettings, supported,
1674+
Pause);
1675+
ethtool_link_ksettings_add_link_mode(lk_ksettings, supported,
1676+
Asym_Pause);
1677+
}
16741678

16751679
if (link_info->support_auto_speeds ||
16761680
link_info->support_pam4_auto_speeds)
@@ -1901,7 +1905,8 @@ static int bnxt_set_link_ksettings(struct net_device *dev,
19011905
/* any change to autoneg will cause link change, therefore the
19021906
* driver should put back the original pause setting in autoneg
19031907
*/
1904-
set_pause = true;
1908+
if (!(bp->phy_flags & BNXT_PHY_FL_NO_PAUSE))
1909+
set_pause = true;
19051910
} else {
19061911
u8 phy_type = link_info->phy_type;
19071912

@@ -2093,7 +2098,7 @@ static int bnxt_set_pauseparam(struct net_device *dev,
20932098
struct bnxt *bp = netdev_priv(dev);
20942099
struct bnxt_link_info *link_info = &bp->link_info;
20952100

2096-
if (!BNXT_PHY_CFG_ABLE(bp))
2101+
if (!BNXT_PHY_CFG_ABLE(bp) || (bp->phy_flags & BNXT_PHY_FL_NO_PAUSE))
20972102
return -EOPNOTSUPP;
20982103

20992104
mutex_lock(&bp->link_lock);

0 commit comments

Comments
 (0)