Commit 1f36faf2 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: push prepare phase in port_fdb_add

Now that the prepare phase is pushed down to the DSA drivers, propagate
it to the port_fdb_add function.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 146a3206
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <net/switchdev.h>
#include "mv88e6xxx.h" #include "mv88e6xxx.h"
/* MDIO bus access can be nested in the case of PHYs connected to the /* MDIO bus access can be nested in the case of PHYs connected to the
...@@ -1852,16 +1853,17 @@ int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port, ...@@ -1852,16 +1853,17 @@ int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port,
} }
int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid) const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans)
{ {
int state = is_multicast_ether_addr(addr) ? int state = is_multicast_ether_addr(fdb->addr) ?
GLOBAL_ATU_DATA_STATE_MC_STATIC : GLOBAL_ATU_DATA_STATE_MC_STATIC :
GLOBAL_ATU_DATA_STATE_UC_STATIC; GLOBAL_ATU_DATA_STATE_UC_STATIC;
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
int ret; int ret;
mutex_lock(&ps->smi_mutex); mutex_lock(&ps->smi_mutex);
ret = _mv88e6xxx_port_fdb_load(ds, port, addr, vid, state); ret = _mv88e6xxx_port_fdb_load(ds, port, fdb->addr, fdb->vid, state);
mutex_unlock(&ps->smi_mutex); mutex_unlock(&ps->smi_mutex);
return ret; return ret;
......
...@@ -478,7 +478,8 @@ int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port, ...@@ -478,7 +478,8 @@ int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_fdb *fdb, const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans); struct switchdev_trans *trans);
int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid); const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans);
int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid); const unsigned char *addr, u16 vid);
int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port, int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port,
......
...@@ -323,7 +323,8 @@ struct dsa_switch_driver { ...@@ -323,7 +323,8 @@ struct dsa_switch_driver {
const struct switchdev_obj_port_fdb *fdb, const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans); struct switchdev_trans *trans);
int (*port_fdb_add)(struct dsa_switch *ds, int port, int (*port_fdb_add)(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid); const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans);
int (*port_fdb_del)(struct dsa_switch *ds, int port, int (*port_fdb_del)(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid); const unsigned char *addr, u16 vid);
int (*port_fdb_getnext)(struct dsa_switch *ds, int port, int (*port_fdb_getnext)(struct dsa_switch *ds, int port,
......
...@@ -354,7 +354,7 @@ static int dsa_slave_port_fdb_add(struct net_device *dev, ...@@ -354,7 +354,7 @@ static int dsa_slave_port_fdb_add(struct net_device *dev,
if (switchdev_trans_ph_prepare(trans)) if (switchdev_trans_ph_prepare(trans))
ret = ds->drv->port_fdb_prepare(ds, p->port, fdb, trans); ret = ds->drv->port_fdb_prepare(ds, p->port, fdb, trans);
else else
ret = ds->drv->port_fdb_add(ds, p->port, fdb->addr, fdb->vid); ret = ds->drv->port_fdb_add(ds, p->port, fdb, trans);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment