History

net: Introduce ndo_get_port_parent_id()

In preparation for getting rid of switchdev_ops, create a dedicated NDO operation for getting the port's parent identifier. There are essentially two classes of drivers that need to implement getting the port's parent ID which are VF/PF drivers with a built-in switch, and pure switchdev drivers such as mlxsw, ocelot, dsa etc. We introduce a helper function: dev_get_port_parent_id() which supports recursion into the lower devices to obtain the first port's parent ID. Convert the bridge, core and ipv4 multicast routing code to check for such ndo_get_port_parent_id() and call the helper function when valid before falling back to switchdev_port_attr_get(). This will allow us to convert all relevant drivers in one go instead of having to implement both switchdev_port_attr_get() and ndo_get_port_parent_id() operations, then get rid of switchdev_port_attr_get().

Florian Fainelli committed 7 years ago

Commit d6abc591 parent 47b98036 files · +91 −5Browse files

Showing the changes to include/linux (1 of 6 files). Show all

Unified · Split

include/linux/netdevice.h+9−0
@@ -1188,6 +1188,10 @@ struct dev_ifalias { · 1187 unmodified lines
11881188 * not implement this, it is assumed that the hw is not able to have
11891189 * multiple net devices on single physical port.
11901190 *
1191+ * int (*ndo_get_port_parent_id)(struct net_device *dev,
1192+ * struct netdev_phys_item_id *ppid)
1193+ * Called to get the parent ID of the physical port of this device.
1194+ *
11911195 * void (*ndo_udp_tunnel_add)(struct net_device *dev,
11921196 * struct udp_tunnel_info *ti);
11931197 * Called by UDP tunnel to notify a driver about the UDP port and socket
@@ -1412,6 +1416,8 @@ struct net_device_ops { · 218 unmodified lines
14121416 bool new_carrier);
14131417 int (*ndo_get_phys_port_id)(struct net_device *dev,
14141418 struct netdev_phys_item_id *ppid);
1419+ int (*ndo_get_port_parent_id)(struct net_device *dev,
1420+ struct netdev_phys_item_id *ppid);
14151421 int (*ndo_get_phys_port_name)(struct net_device *dev,
14161422 char *name, size_t len);
14171423 void (*ndo_udp_tunnel_add)(struct net_device *dev,
@@ -3651,6 +3657,9 @@ int dev_get_phys_port_id(struct net_device *dev, · 2233 unmodified lines
36513657 struct netdev_phys_item_id *ppid);
36523658 int dev_get_phys_port_name(struct net_device *dev,
36533659 char *name, size_t len);
3660+int dev_get_port_parent_id(struct net_device *dev,
3661+ struct netdev_phys_item_id *ppid, bool recurse);
3662+bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b);
36543663 int dev_change_proto_down(struct net_device *dev, bool proto_down);
36553664 struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again);
36563665 struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,

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