1 --- a/include/net/dsa.h
2 +++ b/include/net/dsa.h
3 @@ -552,8 +552,14 @@ struct dsa_switch_ops {
4 void (*port_stp_state_set)(struct dsa_switch *ds, int port,
6 void (*port_fast_age)(struct dsa_switch *ds, int port);
7 - int (*port_egress_floods)(struct dsa_switch *ds, int port,
8 - bool unicast, bool multicast);
9 + int (*port_pre_bridge_flags)(struct dsa_switch *ds, int port,
10 + unsigned long flags,
11 + struct netlink_ext_ack *extack);
12 + int (*port_bridge_flags)(struct dsa_switch *ds, int port,
13 + unsigned long flags,
14 + struct netlink_ext_ack *extack);
15 + int (*port_set_mrouter)(struct dsa_switch *ds, int port, bool mrouter,
16 + struct netlink_ext_ack *extack);
20 --- a/net/dsa/dsa_priv.h
21 +++ b/net/dsa/dsa_priv.h
22 @@ -167,11 +167,11 @@ int dsa_port_mdb_add(const struct dsa_po
23 int dsa_port_mdb_del(const struct dsa_port *dp,
24 const struct switchdev_obj_port_mdb *mdb);
25 int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags,
26 - struct switchdev_trans *trans);
27 + struct switchdev_trans *trans, struct netlink_ext_ack *extack);
28 int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
29 - struct switchdev_trans *trans);
30 + struct switchdev_trans *trans, struct netlink_ext_ack *extack);
31 int dsa_port_mrouter(struct dsa_port *dp, bool mrouter,
32 - struct switchdev_trans *trans);
33 + struct switchdev_trans *trans, struct netlink_ext_ack *extack);
34 int dsa_port_vlan_add(struct dsa_port *dp,
35 const struct switchdev_obj_port_vlan *vlan,
36 struct switchdev_trans *trans);
39 @@ -145,7 +145,7 @@ int dsa_port_bridge_join(struct dsa_port
42 /* Set the flooding mode before joining the port in the switch */
43 - err = dsa_port_bridge_flags(dp, BR_FLOOD | BR_MCAST_FLOOD, NULL);
44 + err = dsa_port_bridge_flags(dp, BR_FLOOD | BR_MCAST_FLOOD, NULL, NULL);
48 @@ -158,7 +158,7 @@ int dsa_port_bridge_join(struct dsa_port
50 /* The bridging is rolled back on error */
52 - dsa_port_bridge_flags(dp, 0, NULL);
53 + dsa_port_bridge_flags(dp, 0, NULL, NULL);
54 dp->bridge_dev = NULL;
57 @@ -185,7 +185,7 @@ void dsa_port_bridge_leave(struct dsa_po
58 pr_err("DSA: failed to notify DSA_NOTIFIER_BRIDGE_LEAVE\n");
60 /* Port is leaving the bridge, disable flooding */
61 - dsa_port_bridge_flags(dp, 0, NULL);
62 + dsa_port_bridge_flags(dp, 0, NULL, NULL);
64 /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer,
65 * so allow it to be in BR_STATE_FORWARDING to be kept functional
66 @@ -333,44 +333,44 @@ int dsa_port_ageing_time(struct dsa_port
69 int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags,
70 - struct switchdev_trans *trans)
71 + struct switchdev_trans *trans, struct netlink_ext_ack *extack)
73 struct dsa_switch *ds = dp->ds;
75 - if (!ds->ops->port_egress_floods ||
76 - (flags & ~(BR_FLOOD | BR_MCAST_FLOOD)))
77 + if (!ds->ops->port_pre_bridge_flags)
81 + return ds->ops->port_pre_bridge_flags(ds, dp->index, flags, extack);
84 int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
85 - struct switchdev_trans *trans)
86 + struct switchdev_trans *trans, struct netlink_ext_ack *extack)
88 struct dsa_switch *ds = dp->ds;
89 - int port = dp->index;
92 if (switchdev_trans_ph_prepare(trans))
95 - if (ds->ops->port_egress_floods)
96 - err = ds->ops->port_egress_floods(ds, port, flags & BR_FLOOD,
97 - flags & BR_MCAST_FLOOD);
98 + if (!ds->ops->port_bridge_flags)
101 + return ds->ops->port_bridge_flags(ds, dp->index, flags, extack);
106 int dsa_port_mrouter(struct dsa_port *dp, bool mrouter,
107 - struct switchdev_trans *trans)
108 + struct switchdev_trans *trans,
109 + struct netlink_ext_ack *extack)
111 struct dsa_switch *ds = dp->ds;
112 - int port = dp->index;
114 if (switchdev_trans_ph_prepare(trans))
115 - return ds->ops->port_egress_floods ? 0 : -EOPNOTSUPP;
116 + return ds->ops->port_set_mrouter ? 0 : -EOPNOTSUPP;
118 + if (!ds->ops->port_set_mrouter)
119 + return -EOPNOTSUPP;
121 - return ds->ops->port_egress_floods(ds, port, true, mrouter);
122 + return ds->ops->port_set_mrouter(ds, dp->index, mrouter, extack);
125 int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu,
126 --- a/net/dsa/slave.c
127 +++ b/net/dsa/slave.c
128 @@ -290,13 +290,13 @@ static int dsa_slave_port_attr_set(struc
130 case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
131 ret = dsa_port_pre_bridge_flags(dp, attr->u.brport_flags,
135 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
136 - ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans);
137 + ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans, NULL);
139 case SWITCHDEV_ATTR_ID_BRIDGE_MROUTER:
140 - ret = dsa_port_mrouter(dp->cpu_dp, attr->u.mrouter, trans);
141 + ret = dsa_port_mrouter(dp->cpu_dp, attr->u.mrouter, trans, NULL);