diff options
Diffstat (limited to 'include/net/switchdev.h')
-rw-r--r-- | include/net/switchdev.h | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 8d71fdb..3e1bd14 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -64,15 +64,23 @@ enum switchdev_obj_id { SWITCHDEV_OBJ_ID_PORT_FDB, }; +struct switchdev_obj { +}; + /* SWITCHDEV_OBJ_ID_PORT_VLAN */ struct switchdev_obj_port_vlan { + struct switchdev_obj obj; u16 flags; u16 vid_begin; u16 vid_end; }; +#define SWITCHDEV_OBJ_PORT_VLAN(obj) \ + container_of(obj, struct switchdev_obj_port_vlan, obj) + /* SWITCHDEV_OBJ_ID_IPV4_FIB */ struct switchdev_obj_ipv4_fib { + struct switchdev_obj obj; u32 dst; int dst_len; struct fib_info *fi; @@ -82,18 +90,27 @@ struct switchdev_obj_ipv4_fib { u32 tb_id; }; +#define SWITCHDEV_OBJ_IPV4_FIB(obj) \ + container_of(obj, struct switchdev_obj_ipv4_fib, obj) + /* SWITCHDEV_OBJ_ID_PORT_FDB */ struct switchdev_obj_port_fdb { + struct switchdev_obj obj; const unsigned char *addr; u16 vid; u16 ndm_state; }; +#define SWITCHDEV_OBJ_PORT_FDB(obj) \ + container_of(obj, struct switchdev_obj_port_fdb, obj) + void switchdev_trans_item_enqueue(struct switchdev_trans *trans, void *data, void (*destructor)(void const *), struct switchdev_trans_item *tritem); void *switchdev_trans_item_dequeue(struct switchdev_trans *trans); +typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); + /** * struct switchdev_ops - switchdev operations * @@ -115,14 +132,15 @@ struct switchdev_ops { struct switchdev_trans *trans); int (*switchdev_port_obj_add)(struct net_device *dev, enum switchdev_obj_id id, - const void *obj, + const struct switchdev_obj *obj, struct switchdev_trans *trans); int (*switchdev_port_obj_del)(struct net_device *dev, enum switchdev_obj_id id, - const void *obj); + const struct switchdev_obj *obj); int (*switchdev_port_obj_dump)(struct net_device *dev, - enum switchdev_obj_id id, void *obj, - int (*cb)(void *obj)); + enum switchdev_obj_id id, + struct switchdev_obj *obj, + switchdev_obj_dump_cb_t *cb); }; enum switchdev_notifier_type { @@ -153,11 +171,12 @@ int switchdev_port_attr_get(struct net_device *dev, int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr); int switchdev_port_obj_add(struct net_device *dev, enum switchdev_obj_id id, - const void *obj); + const struct switchdev_obj *obj); int switchdev_port_obj_del(struct net_device *dev, enum switchdev_obj_id id, - const void *obj); + const struct switchdev_obj *obj); int switchdev_port_obj_dump(struct net_device *dev, enum switchdev_obj_id id, - void *obj, int (*cb)(void *obj)); + struct switchdev_obj *obj, + switchdev_obj_dump_cb_t *cb); int register_switchdev_notifier(struct notifier_block *nb); int unregister_switchdev_notifier(struct notifier_block *nb); int call_switchdev_notifiers(unsigned long val, struct net_device *dev, @@ -203,21 +222,22 @@ static inline int switchdev_port_attr_set(struct net_device *dev, static inline int switchdev_port_obj_add(struct net_device *dev, enum switchdev_obj_id id, - const void *obj) + const struct switchdev_obj *obj) { return -EOPNOTSUPP; } static inline int switchdev_port_obj_del(struct net_device *dev, enum switchdev_obj_id id, - const void *obj) + const struct switchdev_obj *obj) { return -EOPNOTSUPP; } static inline int switchdev_port_obj_dump(struct net_device *dev, - enum switchdev_obj_id id, void *obj, - int (*cb)(void *obj)) + enum switchdev_obj_id id, + const struct switchdev_obj *obj, + switchdev_obj_dump_cb_t *cb) { return -EOPNOTSUPP; } |