mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
Merge branch 'net-txgbe-fix-module-identification'
Jiawen Wu says: ==================== net: txgbe: fix module identification For AML devices, there are some issues where the wrong module indentified then configure PHY failed. The module info buffers should be initialized to 0 before the firmware returns information. And DECLARE_PHY_INTERFACE_MASK() does not guarantee zeroed contents, so explicitly clear the temporary interface masks before setting supported interfaces. Rework txgbe_identify_module() to validate module identifiers through explicit type checks instead of relying on transceiver_type heuristics. When using the SFP module, transceiver_type could be a random value, because it was read from an invalid register. ==================== Link: https://patch.msgid.link/20260608070842.36504-1-jiawenwu@trustnetic.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
commit
0068940907
|
|
@ -204,7 +204,7 @@ int txgbe_set_phy_link(struct wx *wx)
|
|||
static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
|
||||
{
|
||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
|
||||
DECLARE_PHY_INTERFACE_MASK(interfaces);
|
||||
DECLARE_PHY_INTERFACE_MASK_ZERO(interfaces);
|
||||
struct txgbe *txgbe = wx->priv;
|
||||
|
||||
if (id->cable_tech & TXGBE_SFF_DA_PASSIVE_CABLE) {
|
||||
|
|
@ -271,7 +271,7 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
|
|||
static int txgbe_qsfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
|
||||
{
|
||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
|
||||
DECLARE_PHY_INTERFACE_MASK(interfaces);
|
||||
DECLARE_PHY_INTERFACE_MASK_ZERO(interfaces);
|
||||
struct txgbe *txgbe = wx->priv;
|
||||
|
||||
if (id->transceiver_type & TXGBE_SFF_ETHERNET_40G_CR4) {
|
||||
|
|
@ -335,7 +335,7 @@ static int txgbe_qsfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
|
|||
|
||||
int txgbe_identify_module(struct wx *wx)
|
||||
{
|
||||
struct txgbe_hic_get_module_info buffer;
|
||||
struct txgbe_hic_get_module_info buffer = { 0 };
|
||||
struct txgbe_sff_id *id;
|
||||
int err = 0;
|
||||
u32 mod_abs;
|
||||
|
|
@ -357,18 +357,16 @@ int txgbe_identify_module(struct wx *wx)
|
|||
}
|
||||
|
||||
id = &buffer.id;
|
||||
if (id->identifier != TXGBE_SFF_IDENTIFIER_SFP &&
|
||||
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP &&
|
||||
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP_PLUS &&
|
||||
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP28) {
|
||||
wx_err(wx, "Invalid module\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (id->transceiver_type == 0xFF)
|
||||
if (id->identifier == TXGBE_SFF_IDENTIFIER_SFP)
|
||||
return txgbe_sfp_to_linkmodes(wx, id);
|
||||
|
||||
return txgbe_qsfp_to_linkmodes(wx, id);
|
||||
if (id->identifier == TXGBE_SFF_IDENTIFIER_QSFP ||
|
||||
id->identifier == TXGBE_SFF_IDENTIFIER_QSFP_PLUS ||
|
||||
id->identifier == TXGBE_SFF_IDENTIFIER_QSFP28)
|
||||
return txgbe_qsfp_to_linkmodes(wx, id);
|
||||
|
||||
wx_err(wx, "Invalid module\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void txgbe_setup_link(struct wx *wx)
|
||||
|
|
|
|||
|
|
@ -315,6 +315,9 @@ void txgbe_up(struct wx *wx);
|
|||
int txgbe_setup_tc(struct net_device *dev, u8 tc);
|
||||
void txgbe_do_reset(struct net_device *netdev);
|
||||
|
||||
#define DECLARE_PHY_INTERFACE_MASK_ZERO(name) \
|
||||
unsigned long name[PHY_INTERFACE_MODE_MAX] = { 0, }
|
||||
|
||||
#define TXGBE_LINK_SPEED_UNKNOWN 0
|
||||
#define TXGBE_LINK_SPEED_10GB_FULL 4
|
||||
#define TXGBE_LINK_SPEED_25GB_FULL 0x10
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user