DSA implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid of switchdev_ops eventually, ease that migration by implementing a ndo_get_port_parent_id() function which returns what switchdev_port_attr_get() would do.
Unified · Split
| @@ -362,18 +362,23 @@ static int dsa_slave_port_obj_del(struct net_device *dev, · 361 unmodified lines | ||
| 362 | 362 | return err; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | −static int dsa_slave_port_attr_get(struct net_device *dev, | |
| 366 | − struct switchdev_attr *attr) | |
| 365 | +static int dsa_slave_get_port_parent_id(struct net_device *dev, | |
| 366 | + struct netdev_phys_item_id *ppid) | |
| 367 | 367 | { |
| 368 | 368 | struct dsa_port *dp = dsa_slave_to_port(dev); |
| 369 | 369 | struct dsa_switch *ds = dp->ds; |
| 370 | 370 | struct dsa_switch_tree *dst = ds->dst; |
| 371 | 371 | |
| 372 | + ppid->id_len = sizeof(dst->index); | |
| 373 | + memcpy(&ppid->id, &dst->index, ppid->id_len); | |
| 374 | + | |
| 375 | + return 0; | |
| 376 | +} | |
| 377 | + | |
| 378 | +static int dsa_slave_port_attr_get(struct net_device *dev, | |
| 379 | + struct switchdev_attr *attr) | |
| 380 | +{ | |
| 372 | 381 | switch (attr->id) { |
| 373 | − case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: | |
| 374 | − attr->u.ppid.id_len = sizeof(dst->index); | |
| 375 | − memcpy(&attr->u.ppid.id, &dst->index, attr->u.ppid.id_len); | |
| 376 | − break; | |
| 377 | 382 | case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: |
| 378 | 383 | attr->u.brport_flags_support = 0; |
| 379 | 384 | break; |
| @@ -1046,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = { · 666 unmodified lines | ||
| 1046 | 1051 | .ndo_get_phys_port_name = dsa_slave_get_phys_port_name, |
| 1047 | 1052 | .ndo_setup_tc = dsa_slave_setup_tc, |
| 1048 | 1053 | .ndo_get_stats64 = dsa_slave_get_stats64, |
| 1054 | + .ndo_get_port_parent_id = dsa_slave_get_port_parent_id, | |
| 1049 | 1055 | }; |
| 1050 | 1056 | |
| 1051 | 1057 | static const struct switchdev_ops dsa_slave_switchdev_ops = { |