[v3,09/25] net/axgbe: fix logic around active and passive cables
Checks
Commit Message
From: Venkat Kumar Ande <VenkatKumar.Ande@amd.com>
SFP+ active and passive cables are copper cables with fixed SFP+ end
connectors. Due to a misinterpretation of this, SFP+ active cables could
end up not being recognized, causing the driver to fail to establish a
connection.
Introduce a new enum in SFP+ cable types, XGBE_SFP_CABLE_FIBER, that is
the default cable type, and handle active and passive cables when they are
specifically detected.
Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs")
Cc: stable@dpdk.org
Signed-off-by: Venkat Kumar Ande <VenkatKumar.Ande@amd.com>
Acked-by: Selwin Sebastian <selwin.sebastian@amd.com>
---
drivers/net/axgbe/axgbe_phy_impl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
@@ -69,6 +69,7 @@ enum axgbe_sfp_cable {
AXGBE_SFP_CABLE_UNKNOWN = 0,
AXGBE_SFP_CABLE_ACTIVE,
AXGBE_SFP_CABLE_PASSIVE,
+ AXGBE_SFP_CABLE_FIBER,
};
enum axgbe_sfp_base {
@@ -616,16 +617,18 @@ static void axgbe_phy_sfp_parse_eeprom(struct axgbe_port *pdata)
axgbe_phy_sfp_parse_quirks(pdata);
- /* Assume ACTIVE cable unless told it is PASSIVE */
+ /* Assume FIBER cable unless told otherwise */
if (sfp_base[AXGBE_SFP_BASE_CABLE] & AXGBE_SFP_BASE_CABLE_PASSIVE) {
phy_data->sfp_cable = AXGBE_SFP_CABLE_PASSIVE;
phy_data->sfp_cable_len = sfp_base[AXGBE_SFP_BASE_CU_CABLE_LEN];
- } else {
+ } else if (sfp_base[AXGBE_SFP_BASE_CABLE] & AXGBE_SFP_BASE_CABLE_ACTIVE) {
phy_data->sfp_cable = AXGBE_SFP_CABLE_ACTIVE;
+ } else {
+ phy_data->sfp_cable = AXGBE_SFP_CABLE_FIBER;
}
/* Determine the type of SFP */
- if (phy_data->sfp_cable == AXGBE_SFP_CABLE_PASSIVE &&
+ if (phy_data->sfp_cable != AXGBE_SFP_CABLE_FIBER &&
axgbe_phy_sfp_bit_rate(sfp_eeprom, AXGBE_SFP_SPEED_10000))
phy_data->sfp_base = AXGBE_SFP_BASE_10000_CR;
else if (sfp_base[AXGBE_SFP_BASE_10GBE_CC] & AXGBE_SFP_BASE_10GBE_CC_SR)