Skip to content

Commit 03d5fb1

Browse files
viviendavem330
authored andcommitted
net: switchdev: remove dev from switchdev_obj cb
The net_device associated to a dump operation does not have to be passed to the callback. switchdev stores it in a superset struct, if needed. Also some drivers (such as DSA drivers) may not have easy access to it. This will simplify pushing the callback function down to the drivers. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e02a06b commit 03d5fb1

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

drivers/net/ethernet/rocker/rocker.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4556,7 +4556,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port,
45564556
fdb->ndm_state = NUD_REACHABLE;
45574557
fdb->vid = rocker_port_vlan_to_vid(rocker_port,
45584558
found->key.vlan_id);
4559-
err = obj->cb(rocker_port->dev, obj);
4559+
err = obj->cb(obj);
45604560
if (err)
45614561
break;
45624562
}
@@ -4579,7 +4579,7 @@ static int rocker_port_vlan_dump(const struct rocker_port *rocker_port,
45794579
if (rocker_vlan_id_is_internal(htons(vid)))
45804580
vlan->flags |= BRIDGE_VLAN_INFO_PVID;
45814581
vlan->vid_begin = vlan->vid_end = vid;
4582-
err = obj->cb(rocker_port->dev, obj);
4582+
err = obj->cb(obj);
45834583
if (err)
45844584
break;
45854585
}

include/net/switchdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ enum switchdev_obj_id {
6666

6767
struct switchdev_obj {
6868
enum switchdev_obj_id id;
69-
int (*cb)(struct net_device *dev, struct switchdev_obj *obj);
69+
int (*cb)(struct switchdev_obj *obj);
7070
union {
7171
struct switchdev_obj_vlan { /* PORT_VLAN */
7272
u16 flags;

net/dsa/slave.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static int dsa_slave_port_vlan_dump(struct net_device *dev,
334334
if (test_bit(p->port, untagged))
335335
vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
336336

337-
err = obj->cb(dev, obj);
337+
err = obj->cb(obj);
338338
if (err)
339339
break;
340340
}
@@ -397,7 +397,7 @@ static int dsa_slave_port_fdb_dump(struct net_device *dev,
397397
obj->u.fdb.vid = vid;
398398
obj->u.fdb.ndm_state = is_static ? NUD_NOARP : NUD_REACHABLE;
399399

400-
ret = obj->cb(dev, obj);
400+
ret = obj->cb(obj);
401401
if (ret < 0)
402402
break;
403403
}

net/switchdev/switchdev.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ static int switchdev_port_vlan_dump_put(struct switchdev_vlan_dump *dump)
514514
return 0;
515515
}
516516

517-
static int switchdev_port_vlan_dump_cb(struct net_device *dev,
518-
struct switchdev_obj *obj)
517+
static int switchdev_port_vlan_dump_cb(struct switchdev_obj *obj)
519518
{
520519
struct switchdev_vlan_dump *dump =
521520
container_of(obj, struct switchdev_vlan_dump, obj);
@@ -864,8 +863,7 @@ struct switchdev_fdb_dump {
864863
int idx;
865864
};
866865

867-
static int switchdev_port_fdb_dump_cb(struct net_device *dev,
868-
struct switchdev_obj *obj)
866+
static int switchdev_port_fdb_dump_cb(struct switchdev_obj *obj)
869867
{
870868
struct switchdev_fdb_dump *dump =
871869
container_of(obj, struct switchdev_fdb_dump, obj);

0 commit comments

Comments
 (0)