ixgbe: fix probing of multi-port devices with one MDIO
Ian reports that after upgrade from v5.8.14 to v5.9 only one
of his 4 ixgbe netdevs appear in the system.
Quoting the comment on ixgbe_x550em_a_has_mii():
* Returns true if hw points to lowest numbered PCI B:D.F x550_em_a device in
* the SoC. There are up to 4 MACs sharing a single MDIO bus on the x550em_a,
* but we only want to register one MDIO bus.
This matches the symptoms, since the return value from
ixgbe_mii_bus_init() is no longer ignored we need to handle
the higher ports of x550em without an error.
Fixes: 09ef193fef ("net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()")
Reported-by: Ian Kumlien <ian.kumlien@gmail.com>
Tested-by: Ian Kumlien <ian.kumlien@gmail.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Link: https://lore.kernel.org/r/20201016232006.3352947-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -901,15 +901,13 @@ static bool ixgbe_x550em_a_has_mii(struct ixgbe_hw *hw)
|
|||||||
**/
|
**/
|
||||||
s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)
|
s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)
|
||||||
{
|
{
|
||||||
|
s32 (*write)(struct mii_bus *bus, int addr, int regnum, u16 val);
|
||||||
|
s32 (*read)(struct mii_bus *bus, int addr, int regnum);
|
||||||
struct ixgbe_adapter *adapter = hw->back;
|
struct ixgbe_adapter *adapter = hw->back;
|
||||||
struct pci_dev *pdev = adapter->pdev;
|
struct pci_dev *pdev = adapter->pdev;
|
||||||
struct device *dev = &adapter->netdev->dev;
|
struct device *dev = &adapter->netdev->dev;
|
||||||
struct mii_bus *bus;
|
struct mii_bus *bus;
|
||||||
|
|
||||||
bus = devm_mdiobus_alloc(dev);
|
|
||||||
if (!bus)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
switch (hw->device_id) {
|
switch (hw->device_id) {
|
||||||
/* C3000 SoCs */
|
/* C3000 SoCs */
|
||||||
case IXGBE_DEV_ID_X550EM_A_KR:
|
case IXGBE_DEV_ID_X550EM_A_KR:
|
||||||
@@ -922,16 +920,23 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)
|
|||||||
case IXGBE_DEV_ID_X550EM_A_1G_T:
|
case IXGBE_DEV_ID_X550EM_A_1G_T:
|
||||||
case IXGBE_DEV_ID_X550EM_A_1G_T_L:
|
case IXGBE_DEV_ID_X550EM_A_1G_T_L:
|
||||||
if (!ixgbe_x550em_a_has_mii(hw))
|
if (!ixgbe_x550em_a_has_mii(hw))
|
||||||
return -ENODEV;
|
return 0;
|
||||||
bus->read = &ixgbe_x550em_a_mii_bus_read;
|
read = &ixgbe_x550em_a_mii_bus_read;
|
||||||
bus->write = &ixgbe_x550em_a_mii_bus_write;
|
write = &ixgbe_x550em_a_mii_bus_write;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bus->read = &ixgbe_mii_bus_read;
|
read = &ixgbe_mii_bus_read;
|
||||||
bus->write = &ixgbe_mii_bus_write;
|
write = &ixgbe_mii_bus_write;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bus = devm_mdiobus_alloc(dev);
|
||||||
|
if (!bus)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
bus->read = read;
|
||||||
|
bus->write = write;
|
||||||
|
|
||||||
/* Use the position of the device in the PCI hierarchy as the id */
|
/* Use the position of the device in the PCI hierarchy as the id */
|
||||||
snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mdio-%s", ixgbe_driver_name,
|
snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mdio-%s", ixgbe_driver_name,
|
||||||
pci_name(pdev));
|
pci_name(pdev));
|
||||||
|
|||||||
Reference in New Issue
Block a user