History

net: dsa: Implement ndo_get_port_parent_id()

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.

Florian Fainelli committed 7 years ago

Commit 929d6c11 parent 7870a7b1 file · +12 −6Browse files

Unified · Split

net/dsa/slave.c+12−6
@@ -362,18 +362,23 @@ static int dsa_slave_port_obj_del(struct net_device *dev, · 361 unmodified lines
362362 return err;
363363 }
364364
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)
367367 {
368368 struct dsa_port *dp = dsa_slave_to_port(dev);
369369 struct dsa_switch *ds = dp->ds;
370370 struct dsa_switch_tree *dst = ds->dst;
371371
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+{
372381 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;
377382 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
378383 attr->u.brport_flags_support = 0;
379384 break;
@@ -1046,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = { · 666 unmodified lines
10461051 .ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
10471052 .ndo_setup_tc = dsa_slave_setup_tc,
10481053 .ndo_get_stats64 = dsa_slave_get_stats64,
1054+ .ndo_get_port_parent_id = dsa_slave_get_port_parent_id,
10491055 };
10501056
10511057 static const struct switchdev_ops dsa_slave_switchdev_ops = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t