diff options
author | Arkadi Sharshevsky <arkadis@mellanox.com> | 2017-08-06 15:15:40 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-07 23:48:47 +0200 |
commit | 1b6dd556c3045ca5fa31cc1e98a4a43afa680e1e (patch) | |
tree | 157769b86c0cba693eddb32f7a98c64f7e5c806d /net/dsa | |
parent | net: dsa: Change DSA slave FDB API to be switchdev independent (diff) | |
download | linux-1b6dd556c3045ca5fa31cc1e98a4a43afa680e1e.tar.xz linux-1b6dd556c3045ca5fa31cc1e98a4a43afa680e1e.zip |
net: dsa: Remove prepare phase for FDB
The prepare phase for FDB add is unneeded because most of DSA devices
can have failures during bus transactions (SPI, I2C, etc.), thus, the
prepare phase cannot guarantee success of the commit stage.
The support for learning FDB through notification chain, which will be
introduced in the following patches, will provide the ability to notify
back the bridge about successful offload.
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa_priv.h | 4 | ||||
-rw-r--r-- | net/dsa/port.c | 4 | ||||
-rw-r--r-- | net/dsa/slave.c | 4 | ||||
-rw-r--r-- | net/dsa/switch.c | 14 |
4 files changed, 8 insertions, 18 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 945ded148c9c..04cd711ed2fd 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -44,7 +44,6 @@ struct dsa_notifier_bridge_info { /* DSA_NOTIFIER_FDB_* */ struct dsa_notifier_fdb_info { const struct switchdev_obj_port_fdb *fdb; - struct switchdev_trans *trans; int sw_index; int port; }; @@ -122,8 +121,7 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering, int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, struct switchdev_trans *trans); int dsa_port_fdb_add(struct dsa_port *dp, - const struct switchdev_obj_port_fdb *fdb, - struct switchdev_trans *trans); + const struct switchdev_obj_port_fdb *fdb); int dsa_port_fdb_del(struct dsa_port *dp, const struct switchdev_obj_port_fdb *fdb); int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb, diff --git a/net/dsa/port.c b/net/dsa/port.c index efc3bce3a89d..bd271b9cc1f2 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -147,13 +147,11 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, } int dsa_port_fdb_add(struct dsa_port *dp, - const struct switchdev_obj_port_fdb *fdb, - struct switchdev_trans *trans) + const struct switchdev_obj_port_fdb *fdb) { struct dsa_notifier_fdb_info info = { .sw_index = dp->ds->index, .port = dp->index, - .trans = trans, .fdb = fdb, }; diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 3b36c47472c6..bb7ab26ef768 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -251,7 +251,9 @@ static int dsa_slave_port_obj_add(struct net_device *dev, switch (obj->id) { case SWITCHDEV_OBJ_ID_PORT_FDB: - err = dsa_port_fdb_add(dp, SWITCHDEV_OBJ_PORT_FDB(obj), trans); + if (switchdev_trans_ph_prepare(trans)) + return 0; + err = dsa_port_fdb_add(dp, SWITCHDEV_OBJ_PORT_FDB(obj)); break; case SWITCHDEV_OBJ_ID_PORT_MDB: err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans); diff --git a/net/dsa/switch.c b/net/dsa/switch.c index a9edfbad3889..eb20e0fee0e1 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -84,23 +84,15 @@ static int dsa_switch_fdb_add(struct dsa_switch *ds, struct dsa_notifier_fdb_info *info) { const struct switchdev_obj_port_fdb *fdb = info->fdb; - struct switchdev_trans *trans = info->trans; /* Do not care yet about other switch chips of the fabric */ if (ds->index != info->sw_index) return 0; - if (switchdev_trans_ph_prepare(trans)) { - if (!ds->ops->port_fdb_prepare || !ds->ops->port_fdb_add) - return -EOPNOTSUPP; - - return ds->ops->port_fdb_prepare(ds, info->port, fdb->addr, - fdb->vid); - } - - ds->ops->port_fdb_add(ds, info->port, fdb->addr, fdb->vid); + if (!ds->ops->port_fdb_add) + return -EOPNOTSUPP; - return 0; + return ds->ops->port_fdb_add(ds, info->port, fdb->addr, fdb->vid); } static int dsa_switch_fdb_del(struct dsa_switch *ds, |