Skip to content

Commit 44bbcf5

Browse files
viviendavem330
authored andcommitted
net: switchdev: extract struct switchdev_obj_*
Now that switchdev and its drivers directly use specific switchdev_obj_* structures, move them out of the switchdev_obj union and get rif of this outer structure. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ab06900 commit 44bbcf5

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

include/net/switchdev.h

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,29 @@ enum switchdev_obj_id {
6464
SWITCHDEV_OBJ_PORT_FDB,
6565
};
6666

67-
struct switchdev_obj {
68-
enum switchdev_obj_id id;
69-
int (*cb)(struct switchdev_obj *obj);
70-
union {
71-
struct switchdev_obj_vlan { /* PORT_VLAN */
72-
u16 flags;
73-
u16 vid_begin;
74-
u16 vid_end;
75-
} vlan;
76-
struct switchdev_obj_ipv4_fib { /* IPV4_FIB */
77-
u32 dst;
78-
int dst_len;
79-
struct fib_info *fi;
80-
u8 tos;
81-
u8 type;
82-
u32 nlflags;
83-
u32 tb_id;
84-
} ipv4_fib;
85-
struct switchdev_obj_fdb { /* PORT_FDB */
86-
const unsigned char *addr;
87-
u16 vid;
88-
u16 ndm_state;
89-
} fdb;
90-
} u;
67+
/* SWITCHDEV_OBJ_PORT_VLAN */
68+
struct switchdev_obj_vlan {
69+
u16 flags;
70+
u16 vid_begin;
71+
u16 vid_end;
72+
};
73+
74+
/* SWITCHDEV_OBJ_IPV4_FIB */
75+
struct switchdev_obj_ipv4_fib {
76+
u32 dst;
77+
int dst_len;
78+
struct fib_info *fi;
79+
u8 tos;
80+
u8 type;
81+
u32 nlflags;
82+
u32 tb_id;
83+
};
84+
85+
/* SWITCHDEV_OBJ_PORT_FDB */
86+
struct switchdev_obj_fdb {
87+
const unsigned char *addr;
88+
u16 vid;
89+
u16 ndm_state;
9190
};
9291

9392
void switchdev_trans_item_enqueue(struct switchdev_trans *trans,
@@ -102,11 +101,11 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans);
102101
*
103102
* @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
104103
*
105-
* @switchdev_port_obj_add: Add an object to port (see switchdev_obj).
104+
* @switchdev_port_obj_add: Add an object to port (see switchdev_obj_*).
106105
*
107-
* @switchdev_port_obj_del: Delete an object from port (see switchdev_obj).
106+
* @switchdev_port_obj_del: Delete an object from port (see switchdev_obj_*).
108107
*
109-
* @switchdev_port_obj_dump: Dump port objects (see switchdev_obj).
108+
* @switchdev_port_obj_dump: Dump port objects (see switchdev_obj_*).
110109
*/
111110
struct switchdev_ops {
112111
int (*switchdev_port_attr_get)(struct net_device *dev,

0 commit comments

Comments
 (0)