net: dsa: move MDB handlers
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Fri, 19 May 2017 21:00:49 +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 MDB 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 d003a2554c7a88cbe1ddd4ffe59f6296a088171d..c2a595036746d66c8bf54ac895d889e0803df61a 100644 (file)
@@ -77,6 +77,13 @@ 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);
+int dsa_port_mdb_add(struct dsa_port *dp,
+                    const struct switchdev_obj_port_mdb *mdb,
+                    struct switchdev_trans *trans);
+int dsa_port_mdb_del(struct dsa_port *dp,
+                    const struct switchdev_obj_port_mdb *mdb);
+int dsa_port_mdb_dump(struct dsa_port *dp, struct switchdev_obj_port_mdb *mdb,
+                     switchdev_obj_dump_cb_t *cb);
 
 /* slave.c */
 extern const struct dsa_device_ops notag_netdev_ops;
index 18ec6d432152890ec783bc424486326dd744100b..4ed0124a8d4bbee9486649f3dec8b2984817994a 100644 (file)
@@ -207,3 +207,43 @@ int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb,
 
        return -EOPNOTSUPP;
 }
+
+int dsa_port_mdb_add(struct dsa_port *dp,
+                    const struct switchdev_obj_port_mdb *mdb,
+                    struct switchdev_trans *trans)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       if (switchdev_trans_ph_prepare(trans)) {
+               if (!ds->ops->port_mdb_prepare || !ds->ops->port_mdb_add)
+                       return -EOPNOTSUPP;
+
+               return ds->ops->port_mdb_prepare(ds, dp->index, mdb, trans);
+       }
+
+       ds->ops->port_mdb_add(ds, dp->index, mdb, trans);
+
+       return 0;
+}
+
+int dsa_port_mdb_del(struct dsa_port *dp,
+                    const struct switchdev_obj_port_mdb *mdb)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       if (ds->ops->port_mdb_del)
+               return ds->ops->port_mdb_del(ds, dp->index, mdb);
+
+       return -EOPNOTSUPP;
+}
+
+int dsa_port_mdb_dump(struct dsa_port *dp, struct switchdev_obj_port_mdb *mdb,
+                     switchdev_obj_dump_cb_t *cb)
+{
+       struct dsa_switch *ds = dp->ds;
+
+       if (ds->ops->port_mdb_dump)
+               return ds->ops->port_mdb_dump(ds, dp->index, mdb, cb);
+
+       return -EOPNOTSUPP;
+}
index d9b7bf759f44b7e08275ac571ed373d2239dc700..9adcb8267d9ac494bb8d71c8f9d4d3b5fd808825 100644 (file)
@@ -245,47 +245,6 @@ static int dsa_port_vlan_dump(struct dsa_port *dp,
        return -EOPNOTSUPP;
 }
 
-static int dsa_port_mdb_add(struct dsa_port *dp,
-                           const struct switchdev_obj_port_mdb *mdb,
-                           struct switchdev_trans *trans)
-{
-       struct dsa_switch *ds = dp->ds;
-
-       if (switchdev_trans_ph_prepare(trans)) {
-               if (!ds->ops->port_mdb_prepare || !ds->ops->port_mdb_add)
-                       return -EOPNOTSUPP;
-
-               return ds->ops->port_mdb_prepare(ds, dp->index, mdb, trans);
-       }
-
-       ds->ops->port_mdb_add(ds, dp->index, mdb, trans);
-
-       return 0;
-}
-
-static int dsa_port_mdb_del(struct dsa_port *dp,
-                           const struct switchdev_obj_port_mdb *mdb)
-{
-       struct dsa_switch *ds = dp->ds;
-
-       if (ds->ops->port_mdb_del)
-               return ds->ops->port_mdb_del(ds, dp->index, mdb);
-
-       return -EOPNOTSUPP;
-}
-
-static int dsa_port_mdb_dump(struct dsa_port *dp,
-                            struct switchdev_obj_port_mdb *mdb,
-                            switchdev_obj_dump_cb_t *cb)
-{
-       struct dsa_switch *ds = dp->ds;
-
-       if (ds->ops->port_mdb_dump)
-               return ds->ops->port_mdb_dump(ds, dp->index, mdb, cb);
-
-       return -EOPNOTSUPP;
-}
-
 static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
        struct dsa_slave_priv *p = netdev_priv(dev);