]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 21 Feb 2019 00:58:22 +0000 (16:58 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Feb 2019 22:55:14 +0000 (14:55 -0800)
In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
add support for a function that processes the
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS and
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attributes and returns not
supported for any flag set, since DSA does not currently support
toggling those bridge port attributes (yet).

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/slave.c

index f4f99ec29f5da042af696c2a03377ef103b53982..47a1d1379d159800712e5efa675a20cea5356b8a 100644 (file)
@@ -160,6 +160,8 @@ int dsa_port_mdb_add(const struct dsa_port *dp,
                     struct switchdev_trans *trans);
 int dsa_port_mdb_del(const struct dsa_port *dp,
                     const struct switchdev_obj_port_mdb *mdb);
+int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags,
+                             struct switchdev_trans *trans);
 int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
                          struct switchdev_trans *trans);
 int dsa_port_vlan_add(struct dsa_port *dp,
index 7bc2a5ad95c6890da2ce240aa49508d6c28ff15e..e9b5b50f8cf1121ba5418f220f9a3691fc27e089 100644 (file)
@@ -187,6 +187,18 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
        return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
 }
 
+int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags,
+                             struct switchdev_trans *trans)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       if (!ds->ops->port_egress_floods ||
+           (flags & ~(BR_FLOOD | BR_MCAST_FLOOD)))
+               return -EINVAL;
+
+       return 0;
+}
+
 int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
                          struct switchdev_trans *trans)
 {
index 85dc68611002a0627730a8af4f959803d1749ee0..44cc4e50dd5aa47e9472220143c8b181a5a758c8 100644 (file)
@@ -295,6 +295,10 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
        case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
                ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans);
                break;
+       case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+               ret = dsa_port_pre_bridge_flags(dp, attr->u.brport_flags,
+                                               trans);
+               break;
        case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
                ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans);
                break;