]> git.baikalelectronics.ru Git - kernel.git/commit
net: Introduce ndo_get_port_parent_id()
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 6 Feb 2019 17:45:35 +0000 (09:45 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Feb 2019 22:16:11 +0000 (14:16 -0800)
commitc5efb6d6e3035a7f06039b5688c9059ca62df65c
treeb957d030e5c687e689f0da32c9585c81a7f6efbd
parent8dc1de529f59b85c1a3d8c12cdcdac66483d2047
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().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/bridge/br_switchdev.c
net/core/dev.c
net/core/net-sysfs.c
net/core/rtnetlink.c
net/ipv4/ipmr.c