Commit 343249b9 authored by Vasundhara Volam's avatar Vasundhara Volam Committed by Greg Kroah-Hartman

bnxt_en: query force speeds before disabling autoneg mode.

[ Upstream commit 56d37462 ]

With autoneg enabled, PHY loopback test fails. To disable autoneg,
driver needs to send a valid forced speed to FW. FW is not sending
async event for invalid speeds. To fix this, query forced speeds
and send the correct speed when disabling autoneg mode.
Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 591d4537
...@@ -2390,17 +2390,37 @@ static int bnxt_hwrm_mac_loopback(struct bnxt *bp, bool enable) ...@@ -2390,17 +2390,37 @@ static int bnxt_hwrm_mac_loopback(struct bnxt *bp, bool enable)
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
} }
static int bnxt_query_force_speeds(struct bnxt *bp, u16 *force_speeds)
{
struct hwrm_port_phy_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
struct hwrm_port_phy_qcaps_input req = {0};
int rc;
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_PORT_PHY_QCAPS, -1, -1);
mutex_lock(&bp->hwrm_cmd_lock);
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (!rc)
*force_speeds = le16_to_cpu(resp->supported_speeds_force_mode);
mutex_unlock(&bp->hwrm_cmd_lock);
return rc;
}
static int bnxt_disable_an_for_lpbk(struct bnxt *bp, static int bnxt_disable_an_for_lpbk(struct bnxt *bp,
struct hwrm_port_phy_cfg_input *req) struct hwrm_port_phy_cfg_input *req)
{ {
struct bnxt_link_info *link_info = &bp->link_info; struct bnxt_link_info *link_info = &bp->link_info;
u16 fw_advertising = link_info->advertising; u16 fw_advertising;
u16 fw_speed; u16 fw_speed;
int rc; int rc;
if (!link_info->autoneg) if (!link_info->autoneg)
return 0; return 0;
rc = bnxt_query_force_speeds(bp, &fw_advertising);
if (rc)
return rc;
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_1GB; fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_1GB;
if (netif_carrier_ok(bp->dev)) if (netif_carrier_ok(bp->dev))
fw_speed = bp->link_info.link_speed; fw_speed = bp->link_info.link_speed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment