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 | |
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 'net/bridge')
-rw-r--r-- | net/bridge/br_fdb.c | 11 | ||||
-rw-r--r-- | net/bridge/br_vlan.c | 24 |
2 files changed, 13 insertions, 22 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 41de11e2eb11..7826782d62ab 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -133,15 +133,12 @@ static void fdb_del_hw_addr(struct net_bridge *br, const unsigned char *addr) static void fdb_del_external_learn(struct net_bridge_fdb_entry *f) { - struct switchdev_obj obj = { - .id = SWITCHDEV_OBJ_PORT_FDB, - .u.fdb = { - .addr = f->addr.addr, - .vid = f->vlan_id, - }, + struct switchdev_obj_fdb fdb = { + .addr = f->addr.addr, + .vid = f->vlan_id, }; - switchdev_port_obj_del(f->dst->dev, &obj); + switchdev_port_obj_del(f->dst->dev, SWITCHDEV_OBJ_PORT_FDB, &fdb); } static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f) 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; } |