mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
25f07adc47
commit
ab06900230
6 changed files with 99 additions and 117 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue