Currently when adding devlink port it is prohibited to let a driver name an interface on its own. In some scenarios it would not be preferable to provide such limitation. Remove triggering the warning when ndo_get_phys_port_name() is implemented for driver which interface is about to get a devlink port on. Suggested-by: Przemek Kitszel Signed-off-by: Jedrzej Jagielski --- net/devlink/port.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/net/devlink/port.c b/net/devlink/port.c index 939081a0e615..f885c8e73307 100644 --- a/net/devlink/port.c +++ b/net/devlink/port.c @@ -1161,23 +1161,6 @@ static void devlink_port_type_netdev_checks(struct devlink_port *devlink_port, { const struct net_device_ops *ops = netdev->netdev_ops; - /* If driver registers devlink port, it should set devlink port - * attributes accordingly so the compat functions are called - * and the original ops are not used. - */ - if (ops->ndo_get_phys_port_name) { - /* Some drivers use the same set of ndos for netdevs - * that have devlink_port registered and also for - * those who don't. Make sure that ndo_get_phys_port_name - * returns -EOPNOTSUPP here in case it is defined. - * Warn if not. - */ - char name[IFNAMSIZ]; - int err; - - err = ops->ndo_get_phys_port_name(netdev, name, sizeof(name)); - WARN_ON(err != -EOPNOTSUPP); - } if (ops->ndo_get_port_parent_id) { /* Some drivers use the same set of ndos for netdevs * that have devlink_port registered and also for -- 2.31.1 Users of the ixgbe drivers report that after adding devlink support by the commit a0285236ab93 ("ixgbe: add initial devlink support") their configs got broken due to unwanted changes of interfaces names. It's caused by changing names by devlink port initialization flow. To prevent from that add an empty implementation of ndo_get_phys_port_name callback. Reported-by: David Howells Closes: https://lkml.org/lkml/2025/4/24/2052 Reported-by: David Kaplan Closes:https://www.spinics.net/lists/netdev/msg1099410.html Suggested-by: Jakub Kicinski Acked-by: Przemek Kitszel Fixes: a0285236ab93 ("ixgbe: add initial devlink support") Signed-off-by: Jedrzej Jagielski --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 48063586063c..e63a1831e661 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -11043,6 +11043,12 @@ static int ixgbe_xdp_xmit(struct net_device *dev, int n, return nxmit; } +static int ixgbe_get_phys_port_name(struct net_device *netdev, char *name, size_t len) +{ + /* Avoid devlink adding unwanted suffix to interface name. */ + return 0; +} + static const struct net_device_ops ixgbe_netdev_ops = { .ndo_open = ixgbe_open, .ndo_stop = ixgbe_close, @@ -11088,6 +11094,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { .ndo_bpf = ixgbe_xdp, .ndo_xdp_xmit = ixgbe_xdp_xmit, .ndo_xsk_wakeup = ixgbe_xsk_wakeup, + .ndo_get_phys_port_name = ixgbe_get_phys_port_name, }; static void ixgbe_disable_txr_hw(struct ixgbe_adapter *adapter, -- 2.31.1