net: dsa: move FDB handlers
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Fri, 19 May 2017 21:00:48 +0000 (17:00 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 May 2017 23:37:32 +0000 (19:37 -0400)
Move the DSA port code which handles FDB objects in port.c, where it
belongs.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/slave.c

index b0f9837bf5edc27f0490fcc02eaa3ea7df940db2..d003a2554c7a88cbe1ddd4ffe59f6296a088171d 100644 (file)
@@ -70,6 +70,13 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
                            struct switchdev_trans *trans);
 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);
+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,
+                     switchdev_obj_dump_cb_t *cb);
 
 /* slave.c */
 extern const struct dsa_device_ops notag_netdev_ops;
index 3382fdc07a11994490c3604d4f0171d069584be1..18ec6d432152890ec783bc424486326dd744100b 100644 (file)
@@ -167,3 +167,43 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
 
        return 0;
 }
+
+int dsa_port_fdb_add(struct dsa_port *dp,
+                    const struct switchdev_obj_port_fdb *fdb,
+                    struct switchdev_trans *trans)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       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, dp->index, fdb, trans);
+       }
+
+       ds->ops->port_fdb_add(ds, dp->index, fdb, trans);
+
+       return 0;
+}
+
+int dsa_port_fdb_del(struct dsa_port *dp,
+                    const struct switchdev_obj_port_fdb *fdb)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       if (ds->ops->port_fdb_del)
+               return -EOPNOTSUPP;
+
+       return ds->ops->port_fdb_del(ds, dp->index, fdb);
+}
+
+int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb,
+                     switchdev_obj_dump_cb_t *cb)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       if (ds->ops->port_fdb_dump)
+               return ds->ops->port_fdb_dump(ds, dp->index, fdb, cb);
+
+       return -EOPNOTSUPP;
+}
index 1b0f396c4314dec74e753d55db8c992bfe7e6ee7..d9b7bf759f44b7e08275ac571ed373d2239dc700 100644 (file)
@@ -245,48 +245,6 @@ static int dsa_port_vlan_dump(struct dsa_port *dp,
        return -EOPNOTSUPP;
 }
 
-static int dsa_port_fdb_add(struct dsa_port *dp,
-                           const struct switchdev_obj_port_fdb *fdb,
-                           struct switchdev_trans *trans)
-{
-       struct dsa_switch *ds = dp->ds;
-
-       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, dp->index, fdb, trans);
-       }
-
-       ds->ops->port_fdb_add(ds, dp->index, fdb, trans);
-
-       return 0;
-}
-
-static int dsa_port_fdb_del(struct dsa_port *dp,
-                           const struct switchdev_obj_port_fdb *fdb)
-{
-       struct dsa_switch *ds = dp->ds;
-       int ret = -EOPNOTSUPP;
-
-       if (ds->ops->port_fdb_del)
-               ret = ds->ops->port_fdb_del(ds, dp->index, fdb);
-
-       return ret;
-}
-
-static int dsa_port_fdb_dump(struct dsa_port *dp,
-                            struct switchdev_obj_port_fdb *fdb,
-                            switchdev_obj_dump_cb_t *cb)
-{
-       struct dsa_switch *ds = dp->ds;
-
-       if (ds->ops->port_fdb_dump)
-               return ds->ops->port_fdb_dump(ds, dp->index, fdb, cb);
-
-       return -EOPNOTSUPP;
-}
-
 static int dsa_port_mdb_add(struct dsa_port *dp,
                            const struct switchdev_obj_port_mdb *mdb,
                            struct switchdev_trans *trans)