diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2015-09-29 18:07:17 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-30 06:31:59 +0200 |
commit | ab06900230181b5a717b1e1a39c44e96f6292e71 (patch) | |
tree | 7fe59fb7ebaa3674c4d741d8239809d01fa3acfe /net/dsa | |
parent | net: switchdev: pass callback to dump operation (diff) | |
download | linux-ab06900230181b5a717b1e1a39c44e96f6292e71.tar.xz linux-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/dsa')
-rw-r--r-- | net/dsa/slave.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index c3b868c3373b..04f01535d2b6 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -242,10 +242,9 @@ static int dsa_bridge_check_vlan_range(struct dsa_switch *ds, } static int dsa_slave_port_vlan_add(struct net_device *dev, - struct switchdev_obj *obj, + const struct switchdev_obj_vlan *vlan, struct switchdev_trans *trans) { - struct switchdev_obj_vlan *vlan = &obj->u.vlan; struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; u16 vid; @@ -279,9 +278,8 @@ static int dsa_slave_port_vlan_add(struct net_device *dev, } static int dsa_slave_port_vlan_del(struct net_device *dev, - struct switchdev_obj *obj) + const struct switchdev_obj_vlan *vlan) { - struct switchdev_obj_vlan *vlan = &obj->u.vlan; struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; u16 vid; @@ -343,10 +341,9 @@ static int dsa_slave_port_vlan_dump(struct net_device *dev, } static int dsa_slave_port_fdb_add(struct net_device *dev, - struct switchdev_obj *obj, + const struct switchdev_obj_fdb *fdb, struct switchdev_trans *trans) { - struct switchdev_obj_fdb *fdb = &obj->u.fdb; struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; int ret = -EOPNOTSUPP; @@ -360,9 +357,8 @@ static int dsa_slave_port_fdb_add(struct net_device *dev, } static int dsa_slave_port_fdb_del(struct net_device *dev, - struct switchdev_obj *obj) + const struct switchdev_obj_fdb *fdb) { - struct switchdev_obj_fdb *fdb = &obj->u.fdb; struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; int ret = -EOPNOTSUPP; @@ -473,7 +469,7 @@ static int dsa_slave_port_attr_set(struct net_device *dev, } static int dsa_slave_port_obj_add(struct net_device *dev, - struct switchdev_obj *obj, + enum switchdev_obj_id id, const void *obj, struct switchdev_trans *trans) { int err; @@ -483,7 +479,7 @@ static int dsa_slave_port_obj_add(struct net_device *dev, * supported, return -EOPNOTSUPP. */ - switch (obj->id) { + switch (id) { case SWITCHDEV_OBJ_PORT_FDB: err = dsa_slave_port_fdb_add(dev, obj, trans); break; @@ -499,11 +495,11 @@ static int dsa_slave_port_obj_add(struct net_device *dev, } static int dsa_slave_port_obj_del(struct net_device *dev, - struct switchdev_obj *obj) + enum switchdev_obj_id id, const void *obj) { int err; - switch (obj->id) { + switch (id) { case SWITCHDEV_OBJ_PORT_FDB: err = dsa_slave_port_fdb_del(dev, obj); break; |