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-29 21:31:59 -0700 |
commit | ab06900230181b5a717b1e1a39c44e96f6292e71 (patch) | |
tree | 7fe59fb7ebaa3674c4d741d8239809d01fa3acfe /net/bridge/br_vlan.c | |
parent | 25f07adc473f05f850efc9414b9da3374563015f (diff) | |
download | lwn-ab06900230181b5a717b1e1a39c44e96f6292e71.tar.gz lwn-ab06900230181b5a717b1e1a39c44e96f6292e71.zip |
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 'net/bridge/br_vlan.c')
-rw-r--r-- | net/bridge/br_vlan.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 8b392070051c..e227164bc3e1 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -80,16 +80,13 @@ static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br, if (ops->ndo_vlan_rx_add_vid) { err = vlan_vid_add(dev, br->vlan_proto, vid); } else { - struct switchdev_obj vlan_obj = { - .id = SWITCHDEV_OBJ_PORT_VLAN, - .u.vlan = { - .flags = flags, - .vid_begin = vid, - .vid_end = vid, - }, + struct switchdev_obj_vlan v = { + .flags = flags, + .vid_begin = vid, + .vid_end = vid, }; - err = switchdev_port_obj_add(dev, &vlan_obj); + err = switchdev_port_obj_add(dev, SWITCHDEV_OBJ_PORT_VLAN, &v); if (err == -EOPNOTSUPP) err = 0; } @@ -132,15 +129,12 @@ static int __vlan_vid_del(struct net_device *dev, struct net_bridge *br, if (ops->ndo_vlan_rx_kill_vid) { vlan_vid_del(dev, br->vlan_proto, vid); } else { - struct switchdev_obj vlan_obj = { - .id = SWITCHDEV_OBJ_PORT_VLAN, - .u.vlan = { - .vid_begin = vid, - .vid_end = vid, - }, + struct switchdev_obj_vlan v = { + .vid_begin = vid, + .vid_end = vid, }; - err = switchdev_port_obj_del(dev, &vlan_obj); + err = switchdev_port_obj_del(dev, SWITCHDEV_OBJ_PORT_VLAN, &v); if (err == -EOPNOTSUPP) err = 0; } |