|
67 | 67 | #include <net/fib_rules.h> |
68 | 68 | #include <linux/netconf.h> |
69 | 69 | #include <net/nexthop.h> |
70 | | -#include <net/switchdev.h> |
71 | 70 |
|
72 | 71 | #include <linux/nospec.h> |
73 | 72 |
|
@@ -837,11 +836,8 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache, |
837 | 836 | static int vif_add(struct net *net, struct mr_table *mrt, |
838 | 837 | struct vifctl *vifc, int mrtsock) |
839 | 838 | { |
840 | | - const struct net_device_ops *ops; |
| 839 | + struct netdev_phys_item_id ppid = { }; |
841 | 840 | int vifi = vifc->vifc_vifi; |
842 | | - struct switchdev_attr attr = { |
843 | | - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, |
844 | | - }; |
845 | 841 | struct vif_device *v = &mrt->vif_table[vifi]; |
846 | 842 | struct net_device *dev; |
847 | 843 | struct in_device *in_dev; |
@@ -920,15 +916,10 @@ static int vif_add(struct net *net, struct mr_table *mrt, |
920 | 916 | vifc->vifc_flags | (!mrtsock ? VIFF_STATIC : 0), |
921 | 917 | (VIFF_TUNNEL | VIFF_REGISTER)); |
922 | 918 |
|
923 | | - attr.orig_dev = dev; |
924 | | - ops = dev->netdev_ops; |
925 | | - if (ops->ndo_get_port_parent_id && |
926 | | - !dev_get_port_parent_id(dev, &attr.u.ppid, true)) { |
927 | | - memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len); |
928 | | - v->dev_parent_id.id_len = attr.u.ppid.id_len; |
929 | | - } else if (!switchdev_port_attr_get(dev, &attr)) { |
930 | | - memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len); |
931 | | - v->dev_parent_id.id_len = attr.u.ppid.id_len; |
| 919 | + err = dev_get_port_parent_id(dev, &ppid, true); |
| 920 | + if (err == 0) { |
| 921 | + memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len); |
| 922 | + v->dev_parent_id.id_len = ppid.id_len; |
932 | 923 | } else { |
933 | 924 | v->dev_parent_id.id_len = 0; |
934 | 925 | } |
|
0 commit comments