From 9c1410bed3d801a63c8c5b47d457a7f69e95e989 Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Wed, 27 Apr 2022 20:28:17 +0530 Subject: [PATCH] net/bnxt: force PHY update on certain configurations Device is not obliged link down in certain scenarios, even when forced. When FW does not allow any user other than the BMC to shutdown the port, bnxt_get_hwrm_link_config() call always returns link up. Force phy update always in that case, else user configuration for speed/autoneg would not get applied correctly. Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 3 +-- drivers/net/bnxt/bnxt_ethdev.c | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index e4e8e8ecf8..e86e51e1fa 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -72,8 +72,7 @@ #define BROADCOM_DEV_ID_58818_VF 0xd82e #define BROADCOM_DEV_957508_N2100 0x5208 -#define IS_BNXT_DEV_957508_N2100(bp) \ - ((bp)->pdev->id.subsystem_device_id == BROADCOM_DEV_957508_N2100) +#define BROADCOM_DEV_957414_N225 0x4145 #define BNXT_MAX_MTU 9574 #define BNXT_NUM_VLANS 2 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 181de42d15..1904db93c4 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -659,6 +659,19 @@ static int bnxt_init_ctx_mem(struct bnxt *bp) return rc; } +static inline bool bnxt_force_link_config(struct bnxt *bp) +{ + uint16_t subsystem_device_id = bp->pdev->id.subsystem_device_id; + + switch (subsystem_device_id) { + case BROADCOM_DEV_957508_N2100: + case BROADCOM_DEV_957414_N225: + return true; + default: + return false; + } +} + static int bnxt_update_phy_setting(struct bnxt *bp) { struct rte_eth_link new; @@ -671,11 +684,12 @@ static int bnxt_update_phy_setting(struct bnxt *bp) } /* - * On BCM957508-N2100 adapters, FW will not allow any user other - * than BMC to shutdown the port. bnxt_get_hwrm_link_config() call - * always returns link up. Force phy update always in that case. + * Device is not obliged link down in certain scenarios, even + * when forced. When FW does not allow any user other than BMC + * to shutdown the port, bnxt_get_hwrm_link_config() call always + * returns link up. Force phy update always in that case. */ - if (!new.link_status || IS_BNXT_DEV_957508_N2100(bp)) { + if (!new.link_status || bnxt_force_link_config(bp)) { rc = bnxt_set_hwrm_link_config(bp, true); if (rc) { PMD_DRV_LOG(ERR, "Failed to update PHY settings\n"); -- 2.20.1