|
22 | 22 | #include <net/netlink.h>
|
23 | 23 | #include <net/pkt_cls.h>
|
24 | 24 | #include <net/rtnetlink.h>
|
25 |
| -#include <net/switchdev.h> |
26 | 25 |
|
27 | 26 | #include "netdevsim.h"
|
28 | 27 |
|
@@ -148,26 +147,16 @@ static struct device_type nsim_dev_type = {
|
148 | 147 | .release = nsim_dev_release,
|
149 | 148 | };
|
150 | 149 |
|
151 |
| -static int |
152 |
| -nsim_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) |
| 150 | +static int nsim_get_port_parent_id(struct net_device *dev, |
| 151 | + struct netdev_phys_item_id *ppid) |
153 | 152 | {
|
154 | 153 | struct netdevsim *ns = netdev_priv(dev);
|
155 | 154 |
|
156 |
| - switch (attr->id) { |
157 |
| - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: |
158 |
| - attr->u.ppid.id_len = sizeof(ns->sdev->switch_id); |
159 |
| - memcpy(&attr->u.ppid.id, &ns->sdev->switch_id, |
160 |
| - attr->u.ppid.id_len); |
161 |
| - return 0; |
162 |
| - default: |
163 |
| - return -EOPNOTSUPP; |
164 |
| - } |
| 155 | + ppid->id_len = sizeof(ns->sdev->switch_id); |
| 156 | + memcpy(&ppid->id, &ns->sdev->switch_id, ppid->id_len); |
| 157 | + return 0; |
165 | 158 | }
|
166 | 159 |
|
167 |
| -static const struct switchdev_ops nsim_switchdev_ops = { |
168 |
| - .switchdev_port_attr_get = nsim_port_attr_get, |
169 |
| -}; |
170 |
| - |
171 | 160 | static int nsim_init(struct net_device *dev)
|
172 | 161 | {
|
173 | 162 | char sdev_ddir_name[10], sdev_link_name[32];
|
@@ -214,7 +203,6 @@ static int nsim_init(struct net_device *dev)
|
214 | 203 | goto err_bpf_uninit;
|
215 | 204 |
|
216 | 205 | SET_NETDEV_DEV(dev, &ns->dev);
|
217 |
| - SWITCHDEV_SET_OPS(dev, &nsim_switchdev_ops); |
218 | 206 |
|
219 | 207 | err = nsim_devlink_setup(ns);
|
220 | 208 | if (err)
|
@@ -493,6 +481,7 @@ static const struct net_device_ops nsim_netdev_ops = {
|
493 | 481 | .ndo_setup_tc = nsim_setup_tc,
|
494 | 482 | .ndo_set_features = nsim_set_features,
|
495 | 483 | .ndo_bpf = nsim_bpf,
|
| 484 | + .ndo_get_port_parent_id = nsim_get_port_parent_id, |
496 | 485 | };
|
497 | 486 |
|
498 | 487 | static void nsim_setup(struct net_device *dev)
|
|
0 commit comments