Skip to content

Commit 2acf4e6

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
net: dsa: Remove switchdev dependency from DSA switch notifier chain
Currently, the switchdev objects are embedded inside the DSA notifier info. This patch removes this dependency. This is done as a preparation stage before adding support for learning FDB through the switchdev notification chain. Signed-off-by: Arkadi Sharshevsky <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1b6dd55 commit 2acf4e6

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

net/dsa/dsa_priv.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ struct dsa_notifier_bridge_info {
4343

4444
/* DSA_NOTIFIER_FDB_* */
4545
struct dsa_notifier_fdb_info {
46-
const struct switchdev_obj_port_fdb *fdb;
4746
int sw_index;
4847
int port;
48+
const unsigned char *addr;
49+
u16 vid;
4950
};
5051

5152
/* DSA_NOTIFIER_MDB_* */
@@ -120,10 +121,10 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
120121
struct switchdev_trans *trans);
121122
int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
122123
struct switchdev_trans *trans);
123-
int dsa_port_fdb_add(struct dsa_port *dp,
124-
const struct switchdev_obj_port_fdb *fdb);
125-
int dsa_port_fdb_del(struct dsa_port *dp,
126-
const struct switchdev_obj_port_fdb *fdb);
124+
int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
125+
u16 vid);
126+
int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
127+
u16 vid);
127128
int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb,
128129
switchdev_obj_dump_cb_t *cb);
129130
int dsa_port_mdb_add(struct dsa_port *dp,

net/dsa/port.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,28 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
146146
return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
147147
}
148148

149-
int dsa_port_fdb_add(struct dsa_port *dp,
150-
const struct switchdev_obj_port_fdb *fdb)
149+
int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
150+
u16 vid)
151151
{
152152
struct dsa_notifier_fdb_info info = {
153153
.sw_index = dp->ds->index,
154154
.port = dp->index,
155-
.fdb = fdb,
155+
.addr = addr,
156+
.vid = vid,
156157
};
157158

158159
return dsa_port_notify(dp, DSA_NOTIFIER_FDB_ADD, &info);
159160
}
160161

161-
int dsa_port_fdb_del(struct dsa_port *dp,
162-
const struct switchdev_obj_port_fdb *fdb)
162+
int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
163+
u16 vid)
163164
{
164165
struct dsa_notifier_fdb_info info = {
165166
.sw_index = dp->ds->index,
166167
.port = dp->index,
167-
.fdb = fdb,
168+
.addr = addr,
169+
.vid = vid,
170+
168171
};
169172

170173
return dsa_port_notify(dp, DSA_NOTIFIER_FDB_DEL, &info);

net/dsa/slave.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
253253
case SWITCHDEV_OBJ_ID_PORT_FDB:
254254
if (switchdev_trans_ph_prepare(trans))
255255
return 0;
256-
err = dsa_port_fdb_add(dp, SWITCHDEV_OBJ_PORT_FDB(obj));
256+
err = dsa_port_fdb_add(dp, SWITCHDEV_OBJ_PORT_FDB(obj)->addr,
257+
SWITCHDEV_OBJ_PORT_FDB(obj)->vid);
257258
break;
258259
case SWITCHDEV_OBJ_ID_PORT_MDB:
259260
err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
@@ -279,7 +280,8 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
279280

280281
switch (obj->id) {
281282
case SWITCHDEV_OBJ_ID_PORT_FDB:
282-
err = dsa_port_fdb_del(dp, SWITCHDEV_OBJ_PORT_FDB(obj));
283+
err = dsa_port_fdb_del(dp, SWITCHDEV_OBJ_PORT_FDB(obj)->addr,
284+
SWITCHDEV_OBJ_PORT_FDB(obj)->vid);
283285
break;
284286
case SWITCHDEV_OBJ_ID_PORT_MDB:
285287
err = dsa_port_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));

net/dsa/switch.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,32 +83,29 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
8383
static int dsa_switch_fdb_add(struct dsa_switch *ds,
8484
struct dsa_notifier_fdb_info *info)
8585
{
86-
const struct switchdev_obj_port_fdb *fdb = info->fdb;
87-
8886
/* Do not care yet about other switch chips of the fabric */
8987
if (ds->index != info->sw_index)
9088
return 0;
9189

9290
if (!ds->ops->port_fdb_add)
9391
return -EOPNOTSUPP;
9492

95-
return ds->ops->port_fdb_add(ds, info->port, fdb->addr, fdb->vid);
93+
return ds->ops->port_fdb_add(ds, info->port, info->addr,
94+
info->vid);
9695
}
9796

9897
static int dsa_switch_fdb_del(struct dsa_switch *ds,
9998
struct dsa_notifier_fdb_info *info)
10099
{
101-
const struct switchdev_obj_port_fdb *fdb = info->fdb;
102-
103100
/* Do not care yet about other switch chips of the fabric */
104101
if (ds->index != info->sw_index)
105102
return 0;
106103

107104
if (!ds->ops->port_fdb_del)
108105
return -EOPNOTSUPP;
109106

110-
return ds->ops->port_fdb_del(ds, info->port, fdb->addr,
111-
fdb->vid);
107+
return ds->ops->port_fdb_del(ds, info->port, info->addr,
108+
info->vid);
112109
}
113110

114111
static int dsa_switch_mdb_add(struct dsa_switch *ds,

0 commit comments

Comments
 (0)