qed: Fix overriding of supported autoneg value.
authorsudarsana.kalluru@cavium.com <sudarsana.kalluru@cavium.com>
Thu, 4 May 2017 15:15:04 +0000 (08:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:47:48 +0000 (19:47 +0200)
[ Upstream commit 34f9199ce7b7e5c641b96e928bd60e086bf7f278 ]

Driver currently uses advertised-autoneg value to populate the
supported-autoneg field. When advertised field is updated, user gets
the same value for supported field. Supported-autoneg value need to be
populated from the link capabilities value returned by the MFW.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qed/qed_mcp.h

index afe5e57d9acbd67b7fd7adb3d858bede8a392cda..9a6adbd9ed34a17422507dc8713c9d20b391aee5 100644 (file)
@@ -1628,6 +1628,9 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
                DP_NOTICE(p_hwfn, "Unknown Speed in 0x%08x\n", link_temp);
        }
 
+       p_hwfn->mcp_info->link_capabilities.default_speed_autoneg =
+               link->speed.autoneg;
+
        link_temp &= NVM_CFG1_PORT_DRV_FLOW_CONTROL_MASK;
        link_temp >>= NVM_CFG1_PORT_DRV_FLOW_CONTROL_OFFSET;
        link->pause.autoneg = !!(link_temp &
index dba3fbe4800e0262c54ab87e9c80904816c8d5ac..0b949c6d83fc2a039da0ca5cb8ccde5153067745 100644 (file)
@@ -1240,7 +1240,7 @@ static void qed_fill_link(struct qed_hwfn *hwfn,
 
        /* TODO - at the moment assume supported and advertised speed equal */
        if_link->supported_caps = QED_LM_FIBRE_BIT;
-       if (params.speed.autoneg)
+       if (link_caps.default_speed_autoneg)
                if_link->supported_caps |= QED_LM_Autoneg_BIT;
        if (params.pause.autoneg ||
            (params.pause.forced_rx && params.pause.forced_tx))
@@ -1250,6 +1250,10 @@ static void qed_fill_link(struct qed_hwfn *hwfn,
                if_link->supported_caps |= QED_LM_Pause_BIT;
 
        if_link->advertised_caps = if_link->supported_caps;
+       if (params.speed.autoneg)
+               if_link->advertised_caps |= QED_LM_Autoneg_BIT;
+       else
+               if_link->advertised_caps &= ~QED_LM_Autoneg_BIT;
        if (params.speed.advertised_speeds &
            NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_1G)
                if_link->advertised_caps |= QED_LM_1000baseT_Half_BIT |
index dff520ed069bf61d951076bee5b82adf89f95c72..7b7a84d2c839a95171bcbe67251244ccd546520c 100644 (file)
@@ -35,6 +35,7 @@ struct qed_mcp_link_params {
 
 struct qed_mcp_link_capabilities {
        u32 speed_capabilities;
+       bool default_speed_autoneg;
 };
 
 struct qed_mcp_link_state {