summaryrefslogtreecommitdiff
path: root/net/switchdev
diff options
context:
space:
mode:
authorScott Feldman <sfeldma@gmail.com>2015-05-10 19:48:04 +0300
committerDavid S. Miller <davem@davemloft.net>2015-05-13 01:43:55 +0300
commit8793d0a664a8a2c5e18e929c1f995c784c105705 (patch)
tree8342ff461ce9775a9c9bb7cd67124dae18703141 /net/switchdev
parent8508025c598bdee33d9afa153e9c00c7771e7d63 (diff)
downloadlinux-8793d0a664a8a2c5e18e929c1f995c784c105705.tar.xz
switchdev: add new switchdev_port_bridge_getlink
Like bridge_setlink, add switchdev wrapper to handle bridge_getlink and call into port driver to get port attrs. For now, only BR_LEARNING and BR_LEARNING_SYNC are returned. To add more, we'll probably want to break away from ndo_dflt_bridge_getlink() and build the netlink skb directly in the switchdev code. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Acked-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/switchdev')
-rw-r--r--net/switchdev/switchdev.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 0e15b6f6bb56..9210355ec965 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -358,6 +358,34 @@ int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
}
EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
+/**
+ * switchdev_port_bridge_getlink - Get bridge port attributes
+ *
+ * @dev: port device
+ *
+ * Called for SELF on rtnl_bridge_getlink to get bridge port
+ * attributes.
+ */
+int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
+ struct net_device *dev, u32 filter_mask,
+ int nlflags)
+{
+ struct switchdev_attr attr = {
+ .id = SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS,
+ };
+ u16 mode = BRIDGE_MODE_UNDEF;
+ u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
+ int err;
+
+ err = switchdev_port_attr_get(dev, &attr);
+ if (err)
+ return err;
+
+ return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
+ attr.brport_flags, mask, nlflags);
+}
+EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink);
+
static int switchdev_port_br_setflag(struct net_device *dev,
struct nlattr *nlattr,
unsigned long brport_flag)