net: dsa: Remove switchdev dependency from DSA switch notifier chain
authorArkadi Sharshevsky <arkadis@mellanox.com>
Sun, 6 Aug 2017 13:15:41 +0000 (16:15 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Aug 2017 21:48:48 +0000 (14:48 -0700)
Currently, the switchdev objects are embedded inside the DSA notifier
info. This patch removes this dependency. This is done as a preparation
stage before adding support for learning FDB through the switchdev
notification chain.

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

index 04cd711ed2fdbc69d28693a30b3cb28fe64ec4c2..c0ee6a7694f8bce7387d1340c1476ffc7d22efb2 100644 (file)
@@ -43,9 +43,10 @@ struct dsa_notifier_bridge_info {
 
 /* DSA_NOTIFIER_FDB_* */
 struct dsa_notifier_fdb_info {
-       const struct switchdev_obj_port_fdb *fdb;
        int sw_index;
        int port;
+       const unsigned char *addr;
+       u16 vid;
 };
 
 /* DSA_NOTIFIER_MDB_* */
@@ -120,10 +121,10 @@ 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);
-int dsa_port_fdb_del(struct dsa_port *dp,
-                    const struct switchdev_obj_port_fdb *fdb);
+int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
+                    u16 vid);
+int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
+                    u16 vid);
 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,
index bd271b9cc1f267cedcce66d8e41a33b920b73678..86e0585215bf1efde74566fcd41f3317191d9ad7 100644 (file)
@@ -146,25 +146,28 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
        return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
 }
 
-int dsa_port_fdb_add(struct dsa_port *dp,
-                    const struct switchdev_obj_port_fdb *fdb)
+int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
+                    u16 vid)
 {
        struct dsa_notifier_fdb_info info = {
                .sw_index = dp->ds->index,
                .port = dp->index,
-               .fdb = fdb,
+               .addr = addr,
+               .vid = vid,
        };
 
        return dsa_port_notify(dp, DSA_NOTIFIER_FDB_ADD, &info);
 }
 
-int dsa_port_fdb_del(struct dsa_port *dp,
-                    const struct switchdev_obj_port_fdb *fdb)
+int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
+                    u16 vid)
 {
        struct dsa_notifier_fdb_info info = {
                .sw_index = dp->ds->index,
                .port = dp->index,
-               .fdb = fdb,
+               .addr = addr,
+               .vid = vid,
+
        };
 
        return dsa_port_notify(dp, DSA_NOTIFIER_FDB_DEL, &info);
index bb7ab26ef76877396834dcab42151021a5f291d6..6a1d4d6d212b5d7d1d04b2cc892f9d7eea7847bf 100644 (file)
@@ -253,7 +253,8 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
        case SWITCHDEV_OBJ_ID_PORT_FDB:
                if (switchdev_trans_ph_prepare(trans))
                        return 0;
-               err = dsa_port_fdb_add(dp, SWITCHDEV_OBJ_PORT_FDB(obj));
+               err = dsa_port_fdb_add(dp, SWITCHDEV_OBJ_PORT_FDB(obj)->addr,
+                                      SWITCHDEV_OBJ_PORT_FDB(obj)->vid);
                break;
        case SWITCHDEV_OBJ_ID_PORT_MDB:
                err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
@@ -279,7 +280,8 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
 
        switch (obj->id) {
        case SWITCHDEV_OBJ_ID_PORT_FDB:
-               err = dsa_port_fdb_del(dp, SWITCHDEV_OBJ_PORT_FDB(obj));
+               err = dsa_port_fdb_del(dp, SWITCHDEV_OBJ_PORT_FDB(obj)->addr,
+                                      SWITCHDEV_OBJ_PORT_FDB(obj)->vid);
                break;
        case SWITCHDEV_OBJ_ID_PORT_MDB:
                err = dsa_port_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
index eb20e0fee0e1948a091bc73f1b8cffe38832620a..e6c06aa349a6fd1930a6c343d4d643cccfa8cb92 100644 (file)
@@ -83,8 +83,6 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
 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;
-
        /* Do not care yet about other switch chips of the fabric */
        if (ds->index != info->sw_index)
                return 0;
@@ -92,14 +90,13 @@ static int dsa_switch_fdb_add(struct dsa_switch *ds,
        if (!ds->ops->port_fdb_add)
                return -EOPNOTSUPP;
 
-       return ds->ops->port_fdb_add(ds, info->port, fdb->addr, fdb->vid);
+       return ds->ops->port_fdb_add(ds, info->port, info->addr,
+                                    info->vid);
 }
 
 static int dsa_switch_fdb_del(struct dsa_switch *ds,
                              struct dsa_notifier_fdb_info *info)
 {
-       const struct switchdev_obj_port_fdb *fdb = info->fdb;
-
        /* Do not care yet about other switch chips of the fabric */
        if (ds->index != info->sw_index)
                return 0;
@@ -107,8 +104,8 @@ static int dsa_switch_fdb_del(struct dsa_switch *ds,
        if (!ds->ops->port_fdb_del)
                return -EOPNOTSUPP;
 
-       return ds->ops->port_fdb_del(ds, info->port, fdb->addr,
-                                    fdb->vid);
+       return ds->ops->port_fdb_del(ds, info->port, info->addr,
+                                    info->vid);
 }
 
 static int dsa_switch_mdb_add(struct dsa_switch *ds,