mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
switchdev: introduce switchdev add/del obj ops
Like switchdev attr get/set, add new switchdev obj add/del. switchdev objs will be things like VLANs or FIB entries, so add/del fits better for objects than get/set used for attributes. Use same two-phase prepare-commit transaction model as in attr set. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com> Acked-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3563606258
commit
491d0f1533
2 changed files with 138 additions and 0 deletions
|
@ -41,6 +41,15 @@ struct switchdev_attr {
|
|||
|
||||
struct fib_info;
|
||||
|
||||
enum switchdev_obj_id {
|
||||
SWITCHDEV_OBJ_UNDEFINED,
|
||||
};
|
||||
|
||||
struct switchdev_obj {
|
||||
enum switchdev_obj_id id;
|
||||
enum switchdev_trans trans;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct switchdev_ops - switchdev operations
|
||||
*
|
||||
|
@ -48,6 +57,10 @@ struct fib_info;
|
|||
*
|
||||
* @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
|
||||
*
|
||||
* @switchdev_port_obj_add: Add an object to port (see switchdev_obj).
|
||||
*
|
||||
* @switchdev_port_obj_del: Delete an object from port (see switchdev_obj).
|
||||
*
|
||||
* @switchdev_fib_ipv4_add: Called to add/modify IPv4 route to switch device.
|
||||
*
|
||||
* @switchdev_fib_ipv4_del: Called to delete IPv4 route from switch device.
|
||||
|
@ -57,6 +70,10 @@ struct switchdev_ops {
|
|||
struct switchdev_attr *attr);
|
||||
int (*switchdev_port_attr_set)(struct net_device *dev,
|
||||
struct switchdev_attr *attr);
|
||||
int (*switchdev_port_obj_add)(struct net_device *dev,
|
||||
struct switchdev_obj *obj);
|
||||
int (*switchdev_port_obj_del)(struct net_device *dev,
|
||||
struct switchdev_obj *obj);
|
||||
int (*switchdev_fib_ipv4_add)(struct net_device *dev, __be32 dst,
|
||||
int dst_len, struct fib_info *fi,
|
||||
u8 tos, u8 type, u32 nlflags,
|
||||
|
@ -93,6 +110,8 @@ int switchdev_port_attr_get(struct net_device *dev,
|
|||
struct switchdev_attr *attr);
|
||||
int switchdev_port_attr_set(struct net_device *dev,
|
||||
struct switchdev_attr *attr);
|
||||
int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj);
|
||||
int switchdev_port_obj_del(struct net_device *dev, struct switchdev_obj *obj);
|
||||
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,
|
||||
|
@ -125,6 +144,18 @@ static inline int switchdev_port_attr_set(struct net_device *dev,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int switchdev_port_obj_add(struct net_device *dev,
|
||||
struct switchdev_obj *obj)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int switchdev_port_obj_del(struct net_device *dev,
|
||||
struct switchdev_obj *obj)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int register_switchdev_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue