net: switchdev: change fdb addr for a byte array
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Thu, 6 Aug 2015 05:44:02 +0000 (01:44 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Aug 2015 05:48:08 +0000 (22:48 -0700)
The address in the switchdev_obj_fdb structure is currently represented
as a pointer. Replacing it for a 6-byte array allows switchdev to carry
addresses directly read from hardware registers, not stored by the
switch chip driver (as in Rocker).

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.c
include/net/switchdev.h
net/bridge/br_fdb.c
net/switchdev/switchdev.c

index b77e0e7307d45e22ea28d1bf88c14116ef3ab09b..80bb25c5a644b714dbc8c49b46af67eac88b953b 100644 (file)
@@ -4543,7 +4543,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port,
        hash_for_each_safe(rocker->fdb_tbl, bkt, tmp, found, entry) {
                if (found->key.pport != rocker_port->pport)
                        continue;
-               fdb->addr = found->key.addr;
+               ether_addr_copy(fdb->addr, found->key.addr);
                fdb->vid = rocker_port_vlan_to_vid(rocker_port,
                                                   found->key.vlan_id);
                err = obj->cb(rocker_port->dev, obj);
index 89da8934519bb720c4d5f1f479040a889e6079fd..e90e1a0fa5792c233d4d8f3d2d6267358344430a 100644 (file)
@@ -70,7 +70,7 @@ struct switchdev_obj {
                        u32 tb_id;
                } ipv4_fib;
                struct switchdev_obj_fdb {              /* PORT_FDB */
-                       const unsigned char *addr;
+                       u8 addr[ETH_ALEN];
                        u16 vid;
                } fdb;
        } u;
index 9e9875da0a4f979c5389f616b432d218b19fd776..5656b44bf3dee21f72dd59a09e876e562b96b50f 100644 (file)
@@ -136,11 +136,11 @@ static void fdb_del_external_learn(struct net_bridge_fdb_entry *f)
        struct switchdev_obj obj = {
                .id = SWITCHDEV_OBJ_PORT_FDB,
                .u.fdb = {
-                       .addr = f->addr.addr,
                        .vid = f->vlan_id,
                },
        };
 
+       ether_addr_copy(obj.u.fdb.addr, f->addr.addr);
        switchdev_port_obj_del(f->dst->dev, &obj);
 }
 
index 33bafa2e703e299f3b423d1f95b2a21cf177c634..9db87a34f8661601dcb64e530f2ca91363a63bc6 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/mutex.h>
 #include <linux/notifier.h>
 #include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 #include <linux/if_bridge.h>
 #include <net/ip_fib.h>
 #include <net/switchdev.h>
@@ -742,11 +743,11 @@ int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
        struct switchdev_obj obj = {
                .id = SWITCHDEV_OBJ_PORT_FDB,
                .u.fdb = {
-                       .addr = addr,
                        .vid = vid,
                },
        };
 
+       ether_addr_copy(obj.u.fdb.addr, addr);
        return switchdev_port_obj_add(dev, &obj);
 }
 EXPORT_SYMBOL_GPL(switchdev_port_fdb_add);
@@ -769,11 +770,11 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
        struct switchdev_obj obj = {
                .id = SWITCHDEV_OBJ_PORT_FDB,
                .u.fdb = {
-                       .addr = addr,
                        .vid = vid,
                },
        };
 
+       ether_addr_copy(obj.u.fdb.addr, addr);
        return switchdev_port_obj_del(dev, &obj);
 }
 EXPORT_SYMBOL_GPL(switchdev_port_fdb_del);