diff options
| author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2015-09-29 12:07:17 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-09-30 00:31:59 -0400 |
| commit | ab06900230181b5a717b1e1a39c44e96f6292e71 (patch) | |
| tree | 7fe59fb7ebaa3674c4d741d8239809d01fa3acfe /include/net/switchdev.h | |
| parent | 25f07adc473f05f850efc9414b9da3374563015f (diff) | |
net: switchdev: abstract object in add/del ops
Similar to the notifier_call callback of a notifier_block, change the
function signature of switchdev add and del operations to:
int switchdev_port_obj_add/del(struct net_device *dev,
enum switchdev_obj_id id, void *obj);
This allows the caller to pass a specific switchdev_obj_* structure
instead of the generic switchdev_obj one.
Drivers implementation of these operations and switchdev have been
changed accordingly.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/switchdev.h')
| -rw-r--r-- | include/net/switchdev.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index a2f57fb5f622..bcadac33c29c 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h | |||
| @@ -115,10 +115,12 @@ struct switchdev_ops { | |||
| 115 | struct switchdev_attr *attr, | 115 | struct switchdev_attr *attr, |
| 116 | struct switchdev_trans *trans); | 116 | struct switchdev_trans *trans); |
| 117 | int (*switchdev_port_obj_add)(struct net_device *dev, | 117 | int (*switchdev_port_obj_add)(struct net_device *dev, |
| 118 | struct switchdev_obj *obj, | 118 | enum switchdev_obj_id id, |
| 119 | const void *obj, | ||
| 119 | struct switchdev_trans *trans); | 120 | struct switchdev_trans *trans); |
| 120 | int (*switchdev_port_obj_del)(struct net_device *dev, | 121 | int (*switchdev_port_obj_del)(struct net_device *dev, |
| 121 | struct switchdev_obj *obj); | 122 | enum switchdev_obj_id id, |
| 123 | const void *obj); | ||
| 122 | int (*switchdev_port_obj_dump)(struct net_device *dev, | 124 | int (*switchdev_port_obj_dump)(struct net_device *dev, |
| 123 | enum switchdev_obj_id id, void *obj, | 125 | enum switchdev_obj_id id, void *obj, |
| 124 | int (*cb)(void *obj)); | 126 | int (*cb)(void *obj)); |
| @@ -151,8 +153,10 @@ int switchdev_port_attr_get(struct net_device *dev, | |||
| 151 | struct switchdev_attr *attr); | 153 | struct switchdev_attr *attr); |
| 152 | int switchdev_port_attr_set(struct net_device *dev, | 154 | int switchdev_port_attr_set(struct net_device *dev, |
| 153 | struct switchdev_attr *attr); | 155 | struct switchdev_attr *attr); |
| 154 | int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj); | 156 | int switchdev_port_obj_add(struct net_device *dev, enum switchdev_obj_id id, |
| 155 | int switchdev_port_obj_del(struct net_device *dev, struct switchdev_obj *obj); | 157 | const void *obj); |
| 158 | int switchdev_port_obj_del(struct net_device *dev, enum switchdev_obj_id id, | ||
| 159 | const void *obj); | ||
| 156 | int switchdev_port_obj_dump(struct net_device *dev, enum switchdev_obj_id id, | 160 | int switchdev_port_obj_dump(struct net_device *dev, enum switchdev_obj_id id, |
| 157 | void *obj, int (*cb)(void *obj)); | 161 | void *obj, int (*cb)(void *obj)); |
| 158 | int register_switchdev_notifier(struct notifier_block *nb); | 162 | int register_switchdev_notifier(struct notifier_block *nb); |
| @@ -199,13 +203,15 @@ static inline int switchdev_port_attr_set(struct net_device *dev, | |||
| 199 | } | 203 | } |
| 200 | 204 | ||
| 201 | static inline int switchdev_port_obj_add(struct net_device *dev, | 205 | static inline int switchdev_port_obj_add(struct net_device *dev, |
| 202 | struct switchdev_obj *obj) | 206 | enum switchdev_obj_id id, |
| 207 | const void *obj) | ||
| 203 | { | 208 | { |
| 204 | return -EOPNOTSUPP; | 209 | return -EOPNOTSUPP; |
| 205 | } | 210 | } |
| 206 | 211 | ||
| 207 | static inline int switchdev_port_obj_del(struct net_device *dev, | 212 | static inline int switchdev_port_obj_del(struct net_device *dev, |
| 208 | struct switchdev_obj *obj) | 213 | enum switchdev_obj_id id, |
| 214 | const void *obj) | ||
| 209 | { | 215 | { |
| 210 | return -EOPNOTSUPP; | 216 | return -EOPNOTSUPP; |
| 211 | } | 217 | } |
