diff options
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index ff9fd2bb4ce4..4eace9f1dcf9 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -495,6 +495,7 @@ static ssize_t phys_switch_id_show(struct device *dev, | |||
495 | struct device_attribute *attr, char *buf) | 495 | struct device_attribute *attr, char *buf) |
496 | { | 496 | { |
497 | struct net_device *netdev = to_net_dev(dev); | 497 | struct net_device *netdev = to_net_dev(dev); |
498 | const struct net_device_ops *ops = netdev->netdev_ops; | ||
498 | ssize_t ret = -EINVAL; | 499 | ssize_t ret = -EINVAL; |
499 | 500 | ||
500 | if (!rtnl_trylock()) | 501 | if (!rtnl_trylock()) |
@@ -507,7 +508,11 @@ static ssize_t phys_switch_id_show(struct device *dev, | |||
507 | .flags = SWITCHDEV_F_NO_RECURSE, | 508 | .flags = SWITCHDEV_F_NO_RECURSE, |
508 | }; | 509 | }; |
509 | 510 | ||
510 | ret = switchdev_port_attr_get(netdev, &attr); | 511 | if (ops->ndo_get_port_parent_id) |
512 | ret = dev_get_port_parent_id(netdev, &attr.u.ppid, | ||
513 | false); | ||
514 | else | ||
515 | ret = switchdev_port_attr_get(netdev, &attr); | ||
511 | if (!ret) | 516 | if (!ret) |
512 | ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len, | 517 | ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len, |
513 | attr.u.ppid.id); | 518 | attr.u.ppid.id); |