summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorScott Feldman <sfeldma@gmail.com>2015-05-10 09:47:52 -0700
committerDavid S. Miller <davem@davemloft.net>2015-05-12 18:43:53 -0400
commit491d0f1533ac750260406dbf84cdad44fd3d8a29 (patch)
tree6443f2004cf3198a43418f6c7f0faa33f2e23052 /include
parent3563606258cf3b8f02eabddb1cb45a94c44d9611 (diff)
downloadlinux-491d0f1533ac750260406dbf84cdad44fd3d8a29.tar.bz2
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>
Diffstat (limited to 'include')
-rw-r--r--include/net/switchdev.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index aec5e49661a2..4f43300df72c 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -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;