net: dsa: change FDB routines prototypes
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 10 Aug 2015 13:09:49 +0000 (09:09 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Aug 2015 19:03:19 +0000 (12:03 -0700)
Change the prototype of port_getnext to include a vid parameter.

This is necessary to introduce the support for VLAN.

Also rename the fdb_{add,del,getnext} function pointers to
port_fdb_{add,del,getnext} since they are specific to a given port.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6171.c
drivers/net/dsa/mv88e6352.c
drivers/net/dsa/mv88e6xxx.c
drivers/net/dsa/mv88e6xxx.h
include/net/dsa.h
net/dsa/slave.c

index 1c7808495a9dd8198936e6db4ce23fd7f2d29ed3..735f04cd83eec7e1b629695133c5806bcb3fff08 100644 (file)
@@ -116,9 +116,9 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
        .port_join_bridge       = mv88e6xxx_join_bridge,
        .port_leave_bridge      = mv88e6xxx_leave_bridge,
        .port_stp_update        = mv88e6xxx_port_stp_update,
-       .fdb_add                = mv88e6xxx_port_fdb_add,
-       .fdb_del                = mv88e6xxx_port_fdb_del,
-       .fdb_getnext            = mv88e6xxx_port_fdb_getnext,
+       .port_fdb_add           = mv88e6xxx_port_fdb_add,
+       .port_fdb_del           = mv88e6xxx_port_fdb_del,
+       .port_fdb_getnext       = mv88e6xxx_port_fdb_getnext,
 };
 
 MODULE_ALIAS("platform:mv88e6171");
index 7e935852e192937a20a1bcdb9ecda2b9c46e4ea1..a18f7c83d4cb25ca45f1b5878804e54fe87c7dc6 100644 (file)
@@ -343,9 +343,9 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
        .port_join_bridge       = mv88e6xxx_join_bridge,
        .port_leave_bridge      = mv88e6xxx_leave_bridge,
        .port_stp_update        = mv88e6xxx_port_stp_update,
-       .fdb_add                = mv88e6xxx_port_fdb_add,
-       .fdb_del                = mv88e6xxx_port_fdb_del,
-       .fdb_getnext            = mv88e6xxx_port_fdb_getnext,
+       .port_fdb_add           = mv88e6xxx_port_fdb_add,
+       .port_fdb_del           = mv88e6xxx_port_fdb_del,
+       .port_fdb_getnext       = mv88e6xxx_port_fdb_getnext,
 };
 
 MODULE_ALIAS("platform:mv88e6172");
index 0cc83785d1949bce132fc5e72a664bd324d598dd..d68e3fdd6c9969b77062a5f6875db28b3ef8d823 100644 (file)
@@ -1310,7 +1310,7 @@ static int __mv88e6xxx_port_getnext(struct dsa_switch *ds, int port,
 
 /* get next entry for port */
 int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port,
-                              unsigned char *addr, bool *is_static)
+                              unsigned char *addr, u16 *vid, bool *is_static)
 {
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int ret;
index 200327b7ea7d15e4bcb5d22121aab20342026a40..55a6190ce15915983f0bfa2b31e80237d0011b2b 100644 (file)
@@ -421,7 +421,7 @@ int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
 int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
                           const unsigned char *addr, u16 vid);
 int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port,
-                              unsigned char *addr, bool *is_static);
+                              unsigned char *addr, u16 *vid, bool *is_static);
 int mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page, int reg);
 int mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page,
                             int reg, int val);
index fbca63ba8f733fd37fa300bbbe33a300ab05fd49..6356f437e91106302f5c317f113d8fd8a45d4070 100644 (file)
@@ -296,12 +296,17 @@ struct dsa_switch_driver {
                                     u32 br_port_mask);
        int     (*port_stp_update)(struct dsa_switch *ds, int port,
                                   u8 state);
-       int     (*fdb_add)(struct dsa_switch *ds, int port,
-                          const unsigned char *addr, u16 vid);
-       int     (*fdb_del)(struct dsa_switch *ds, int port,
-                          const unsigned char *addr, u16 vid);
-       int     (*fdb_getnext)(struct dsa_switch *ds, int port,
-                              unsigned char *addr, bool *is_static);
+
+       /*
+        * Forwarding database
+        */
+       int     (*port_fdb_add)(struct dsa_switch *ds, int port,
+                               const unsigned char *addr, u16 vid);
+       int     (*port_fdb_del)(struct dsa_switch *ds, int port,
+                               const unsigned char *addr, u16 vid);
+       int     (*port_fdb_getnext)(struct dsa_switch *ds, int port,
+                                   unsigned char *addr, u16 *vid,
+                                   bool *is_static);
 };
 
 void register_switch_driver(struct dsa_switch_driver *type);
index 0010c690cc6715838c76da2d42c93ea9dcc113fc..3d341b694ecf68c8b82976377f8b506c1cef9a07 100644 (file)
@@ -208,8 +208,8 @@ static int dsa_slave_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
        struct dsa_switch *ds = p->parent;
        int ret = -EOPNOTSUPP;
 
-       if (ds->drv->fdb_add)
-               ret = ds->drv->fdb_add(ds, p->port, addr, vid);
+       if (ds->drv->port_fdb_add)
+               ret = ds->drv->port_fdb_add(ds, p->port, addr, vid);
 
        return ret;
 }
@@ -222,8 +222,8 @@ static int dsa_slave_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
        struct dsa_switch *ds = p->parent;
        int ret = -EOPNOTSUPP;
 
-       if (ds->drv->fdb_del)
-               ret = ds->drv->fdb_del(ds, p->port, addr, vid);
+       if (ds->drv->port_fdb_del)
+               ret = ds->drv->port_fdb_del(ds, p->port, addr, vid);
 
        return ret;
 }
@@ -272,22 +272,24 @@ static int dsa_slave_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
        struct dsa_slave_priv *p = netdev_priv(dev);
        struct dsa_switch *ds = p->parent;
        unsigned char addr[ETH_ALEN] = { 0 };
+       u16 vid = 0;
        int ret;
 
-       if (!ds->drv->fdb_getnext)
+       if (!ds->drv->port_fdb_getnext)
                return -EOPNOTSUPP;
 
        for (; ; idx++) {
                bool is_static;
 
-               ret = ds->drv->fdb_getnext(ds, p->port, addr, &is_static);
+               ret = ds->drv->port_fdb_getnext(ds, p->port, addr, &vid,
+                                               &is_static);
                if (ret < 0)
                        break;
 
                if (idx < cb->args[0])
                        continue;
 
-               ret = dsa_slave_fill_info(dev, skb, addr, 0,
+               ret = dsa_slave_fill_info(dev, skb, addr, vid,
                                          is_static,
                                          NETLINK_CB(cb->skb).portid,
                                          cb->nlh->nlmsg_seq,