The 'current' mask of PHY capabilities in libefx indicates autonegotiation
regardless of whether the last invocation of 'efx_phy_adv_cap_set' enabled
or disabled it. The port start code is aware of this and pays attention to
preserve the existing setting when making 'efx_phy_adv_cap_set' invocation.
FEC set method uses the 'current' mask as a base for the new value and may
thus reset fixed speed to autonegotiated. Fix it to keep the speed setting.
Fixes: 5efa8fc1cfc0 ("net/sfc: support FEC feature")
Cc: [email protected]
Signed-off-by: Ivan Malov <[email protected]>
Reviewed-by: Andy Moreton <[email protected]>
---
drivers/net/sfc/sfc_ethdev.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 99141bdda5..6d2349a999 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -2857,8 +2857,13 @@ sfc_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
if (sa->state == SFC_ETHDEV_STARTED) {
efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_CURRENT,
&updated_caps);
- updated_caps = updated_caps & ~EFX_PHY_CAP_FEC_MASK;
- updated_caps |= efx_fec_caps;
+
+ /* Keep pause capabilities set by efx_mac_fcntl_set(). */
+ updated_caps = (updated_caps & EFX_PHY_CAP_PAUSE_MASK) |
+ (port->phy_adv_cap & ~EFX_PHY_CAP_PAUSE_MASK);
+
+ updated_caps = (updated_caps & ~EFX_PHY_CAP_FEC_MASK) |
+ (efx_fec_caps & EFX_PHY_CAP_FEC_MASK);
rc = efx_phy_adv_cap_set(sa->nic, updated_caps);
if (rc != 0)
--
2.47.3