diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2019-02-06 12:45:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-06 17:17:03 -0500 |
commit | bccb30254a4a02ee370dd23b2afbd25d7a78bc34 (patch) | |
tree | 01e04648ebb7677bbda79796c6140cb214ec9b47 /net/core/net-sysfs.c | |
parent | 929d6c145ec4cf11482519cfd0ebf17c2fce92db (diff) |
net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
Now that we have a dedicated NDO for getting a port's parent ID, get rid
of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
NDO exclusively. This is a preliminary change to getting rid of
switchdev_ops eventually.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 4eace9f1dcf9..7c5061123ead 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/capability.h> | 12 | #include <linux/capability.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <net/switchdev.h> | ||
16 | #include <linux/if_arp.h> | 15 | #include <linux/if_arp.h> |
17 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
18 | #include <linux/sched/signal.h> | 17 | #include <linux/sched/signal.h> |
@@ -495,27 +494,17 @@ static ssize_t phys_switch_id_show(struct device *dev, | |||
495 | struct device_attribute *attr, char *buf) | 494 | struct device_attribute *attr, char *buf) |
496 | { | 495 | { |
497 | struct net_device *netdev = to_net_dev(dev); | 496 | struct net_device *netdev = to_net_dev(dev); |
498 | const struct net_device_ops *ops = netdev->netdev_ops; | ||
499 | ssize_t ret = -EINVAL; | 497 | ssize_t ret = -EINVAL; |
500 | 498 | ||
501 | if (!rtnl_trylock()) | 499 | if (!rtnl_trylock()) |
502 | return restart_syscall(); | 500 | return restart_syscall(); |
503 | 501 | ||
504 | if (dev_isalive(netdev)) { | 502 | if (dev_isalive(netdev)) { |
505 | struct switchdev_attr attr = { | 503 | struct netdev_phys_item_id ppid = { }; |
506 | .orig_dev = netdev, | 504 | |
507 | .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, | 505 | ret = dev_get_port_parent_id(netdev, &ppid, false); |
508 | .flags = SWITCHDEV_F_NO_RECURSE, | ||
509 | }; | ||
510 | |||
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); | ||
516 | if (!ret) | 506 | if (!ret) |
517 | ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len, | 507 | ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id); |
518 | attr.u.ppid.id); | ||
519 | } | 508 | } |
520 | rtnl_unlock(); | 509 | rtnl_unlock(); |
521 | 510 | ||