summaryrefslogtreecommitdiff
path: root/net/dsa
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2015-10-01 11:03:45 +0200
committerDavid S. Miller <davem@davemloft.net>2015-10-03 04:49:39 -0700
commit648b4a995a057187ddd77cdb181e6a0b24ab2959 (patch)
tree28535b6300765d1411c7a7e4a30015de227cb947 /net/dsa
parent52ba57cfdc4c90da3bf996dfbe0c5feb731eb477 (diff)
downloadlinux-next-648b4a995a057187ddd77cdb181e6a0b24ab2959.tar.gz
switchdev: bring back switchdev_obj and use it as a generic object param
Replace "void *obj" with a generic structure. Introduce couple of helpers along that. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Scott Feldman <sfeldma@gmail.com> Reviewed-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.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 6e8dc6a0102c..3f6d79d03457 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -299,7 +299,7 @@ static int dsa_slave_port_vlan_del(struct net_device *dev,
static int dsa_slave_port_vlan_dump(struct net_device *dev,
struct switchdev_obj_port_vlan *vlan,
- int (*cb)(void *obj))
+ switchdev_obj_dump_cb_t *cb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->parent;
@@ -332,7 +332,7 @@ static int dsa_slave_port_vlan_dump(struct net_device *dev,
if (test_bit(p->port, untagged))
vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
- err = cb(vlan);
+ err = cb(&vlan->obj);
if (err)
break;
}
@@ -371,7 +371,7 @@ static int dsa_slave_port_fdb_del(struct net_device *dev,
static int dsa_slave_port_fdb_dump(struct net_device *dev,
struct switchdev_obj_port_fdb *fdb,
- int (*cb)(void *obj))
+ switchdev_obj_dump_cb_t *cb)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->parent;
@@ -394,7 +394,7 @@ static int dsa_slave_port_fdb_dump(struct net_device *dev,
fdb->vid = vid;
fdb->ndm_state = is_static ? NUD_NOARP : NUD_REACHABLE;
- ret = cb(fdb);
+ ret = cb(&fdb->obj);
if (ret < 0)
break;
}
@@ -474,7 +474,8 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
}
static int dsa_slave_port_obj_add(struct net_device *dev,
- enum switchdev_obj_id id, const void *obj,
+ enum switchdev_obj_id id,
+ const struct switchdev_obj *obj,
struct switchdev_trans *trans)
{
int err;
@@ -486,10 +487,14 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
switch (id) {
case SWITCHDEV_OBJ_ID_PORT_FDB:
- err = dsa_slave_port_fdb_add(dev, obj, trans);
+ err = dsa_slave_port_fdb_add(dev,
+ SWITCHDEV_OBJ_PORT_FDB(obj),
+ trans);
break;
case SWITCHDEV_OBJ_ID_PORT_VLAN:
- err = dsa_slave_port_vlan_add(dev, obj, trans);
+ err = dsa_slave_port_vlan_add(dev,
+ SWITCHDEV_OBJ_PORT_VLAN(obj),
+ trans);
break;
default:
err = -EOPNOTSUPP;
@@ -500,16 +505,19 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
}
static int dsa_slave_port_obj_del(struct net_device *dev,
- enum switchdev_obj_id id, const void *obj)
+ enum switchdev_obj_id id,
+ const struct switchdev_obj *obj)
{
int err;
switch (id) {
case SWITCHDEV_OBJ_ID_PORT_FDB:
- err = dsa_slave_port_fdb_del(dev, obj);
+ err = dsa_slave_port_fdb_del(dev,
+ SWITCHDEV_OBJ_PORT_FDB(obj));
break;
case SWITCHDEV_OBJ_ID_PORT_VLAN:
- err = dsa_slave_port_vlan_del(dev, obj);
+ err = dsa_slave_port_vlan_del(dev,
+ SWITCHDEV_OBJ_PORT_VLAN(obj));
break;
default:
err = -EOPNOTSUPP;
@@ -520,17 +528,22 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
}
static int dsa_slave_port_obj_dump(struct net_device *dev,
- enum switchdev_obj_id id, void *obj,
- int (*cb)(void *obj))
+ enum switchdev_obj_id id,
+ struct switchdev_obj *obj,
+ switchdev_obj_dump_cb_t *cb)
{
int err;
switch (id) {
case SWITCHDEV_OBJ_ID_PORT_FDB:
- err = dsa_slave_port_fdb_dump(dev, obj, cb);
+ err = dsa_slave_port_fdb_dump(dev,
+ SWITCHDEV_OBJ_PORT_FDB(obj),
+ cb);
break;
case SWITCHDEV_OBJ_ID_PORT_VLAN:
- err = dsa_slave_port_vlan_dump(dev, obj, cb);
+ err = dsa_slave_port_vlan_dump(dev,
+ SWITCHDEV_OBJ_PORT_VLAN(obj),
+ cb);
break;
default:
err = -EOPNOTSUPP;