Skip to content

Commit 3128e81

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Handle ethernet link being disabled by firmware.
On some 200G dual port NICs, if one port is configured to 200G, firmware will disable the ethernet link on the other port. Firmware will send notification to the driver for the disabled port when this happens. Define a new field in the link_info structure to keep track of this state. The new phy_state field replaces the unused loop_back field. Log a message when the phy_state changes state. In the disabled state, disallow any PHY configurations on the disabled port as the firmware will fail all calls to configure the PHY in this state. Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com> Reviewed-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 532262b commit 3128e81

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8777,6 +8777,16 @@ static void bnxt_report_link(struct bnxt *bp)
87778777
}
87788778
}
87798779

8780+
static bool bnxt_phy_qcaps_no_speed(struct hwrm_port_phy_qcaps_output *resp)
8781+
{
8782+
if (!resp->supported_speeds_auto_mode &&
8783+
!resp->supported_speeds_force_mode &&
8784+
!resp->supported_pam4_speeds_auto_mode &&
8785+
!resp->supported_pam4_speeds_force_mode)
8786+
return true;
8787+
return false;
8788+
}
8789+
87808790
static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
87818791
{
87828792
int rc = 0;
@@ -8824,6 +8834,18 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
88248834
if (resp->flags & PORT_PHY_QCAPS_RESP_FLAGS_CUMULATIVE_COUNTERS_ON_RESET)
88258835
bp->fw_cap |= BNXT_FW_CAP_PORT_STATS_NO_RESET;
88268836

8837+
if (bp->hwrm_spec_code >= 0x10a01) {
8838+
if (bnxt_phy_qcaps_no_speed(resp)) {
8839+
link_info->phy_state = BNXT_PHY_STATE_DISABLED;
8840+
netdev_warn(bp->dev, "Ethernet link disabled\n");
8841+
} else if (link_info->phy_state == BNXT_PHY_STATE_DISABLED) {
8842+
link_info->phy_state = BNXT_PHY_STATE_ENABLED;
8843+
netdev_info(bp->dev, "Ethernet link enabled\n");
8844+
/* Phy re-enabled, reprobe the speeds */
8845+
link_info->support_auto_speeds = 0;
8846+
link_info->support_pam4_auto_speeds = 0;
8847+
}
8848+
}
88278849
if (resp->supported_speeds_auto_mode)
88288850
link_info->support_auto_speeds =
88298851
le16_to_cpu(resp->supported_speeds_auto_mode);

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,10 @@ struct bnxt_link_info {
11521152
#define BNXT_LINK_SIGNAL PORT_PHY_QCFG_RESP_LINK_SIGNAL
11531153
#define BNXT_LINK_LINK PORT_PHY_QCFG_RESP_LINK_LINK
11541154
u8 wire_speed;
1155-
u8 loop_back;
1155+
u8 phy_state;
1156+
#define BNXT_PHY_STATE_ENABLED 0
1157+
#define BNXT_PHY_STATE_DISABLED 1
1158+
11561159
u8 link_up;
11571160
u8 duplex;
11581161
#define BNXT_LINK_DUPLEX_HALF PORT_PHY_QCFG_RESP_DUPLEX_STATE_HALF
@@ -1601,8 +1604,9 @@ struct bnxt {
16011604
#define BNXT_NPAR(bp) ((bp)->port_partition_type)
16021605
#define BNXT_MH(bp) ((bp)->flags & BNXT_FLAG_MULTI_HOST)
16031606
#define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp))
1604-
#define BNXT_PHY_CFG_ABLE(bp) (BNXT_SINGLE_PF(bp) || \
1605-
((bp)->fw_cap & BNXT_FW_CAP_SHARED_PORT_CFG))
1607+
#define BNXT_PHY_CFG_ABLE(bp) ((BNXT_SINGLE_PF(bp) || \
1608+
((bp)->fw_cap & BNXT_FW_CAP_SHARED_PORT_CFG)) && \
1609+
(bp)->link_info.phy_state == BNXT_PHY_STATE_ENABLED)
16061610
#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0)
16071611
#define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
16081612
#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \

0 commit comments

Comments
 (0)