realtek: replace RTL93xx GPIO patches
[openwrt/openwrt.git] / target / linux / realtek / patches-5.10 / 708-brflood-api.patch
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,
5 u8 state);
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);
17
18 /*
19 * VLAN support
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);
37 --- a/net/dsa/port.c
38 +++ b/net/dsa/port.c
39 @@ -145,7 +145,7 @@ int dsa_port_bridge_join(struct dsa_port
40 int err;
41
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);
45 if (err)
46 return err;
47
48 @@ -158,7 +158,7 @@ int dsa_port_bridge_join(struct dsa_port
49
50 /* The bridging is rolled back on error */
51 if (err) {
52 - dsa_port_bridge_flags(dp, 0, NULL);
53 + dsa_port_bridge_flags(dp, 0, NULL, NULL);
54 dp->bridge_dev = NULL;
55 }
56
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");
59
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);
63
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
67 }
68
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)
72 {
73 struct dsa_switch *ds = dp->ds;
74
75 - if (!ds->ops->port_egress_floods ||
76 - (flags & ~(BR_FLOOD | BR_MCAST_FLOOD)))
77 + if (!ds->ops->port_pre_bridge_flags)
78 return -EINVAL;
79
80 - return 0;
81 + return ds->ops->port_pre_bridge_flags(ds, dp->index, flags, extack);
82 }
83
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)
87 {
88 struct dsa_switch *ds = dp->ds;
89 - int port = dp->index;
90 - int err = 0;
91
92 if (switchdev_trans_ph_prepare(trans))
93 return 0;
94
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)
99 + return -EINVAL;
100 +
101 + return ds->ops->port_bridge_flags(ds, dp->index, flags, extack);
102
103 - return err;
104 }
105
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)
110 {
111 struct dsa_switch *ds = dp->ds;
112 - int port = dp->index;
113
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;
117 +
118 + if (!ds->ops->port_set_mrouter)
119 + return -EOPNOTSUPP;
120
121 - return ds->ops->port_egress_floods(ds, port, true, mrouter);
122 + return ds->ops->port_set_mrouter(ds, dp->index, mrouter, extack);
123 }
124
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
129 break;
130 case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
131 ret = dsa_port_pre_bridge_flags(dp, attr->u.brport_flags,
132 - trans);
133 + trans, NULL);
134 break;
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);
138 break;
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);
142 break;
143 default:
144 ret = -EOPNOTSUPP;