Commit 1525c386 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: switchdev: change fdb addr for a byte array

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: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4933d85c
...@@ -4543,7 +4543,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port, ...@@ -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) { hash_for_each_safe(rocker->fdb_tbl, bkt, tmp, found, entry) {
if (found->key.pport != rocker_port->pport) if (found->key.pport != rocker_port->pport)
continue; continue;
fdb->addr = found->key.addr; ether_addr_copy(fdb->addr, found->key.addr);
fdb->vid = rocker_port_vlan_to_vid(rocker_port, fdb->vid = rocker_port_vlan_to_vid(rocker_port,
found->key.vlan_id); found->key.vlan_id);
err = obj->cb(rocker_port->dev, obj); err = obj->cb(rocker_port->dev, obj);
......
...@@ -70,7 +70,7 @@ struct switchdev_obj { ...@@ -70,7 +70,7 @@ struct switchdev_obj {
u32 tb_id; u32 tb_id;
} ipv4_fib; } ipv4_fib;
struct switchdev_obj_fdb { /* PORT_FDB */ struct switchdev_obj_fdb { /* PORT_FDB */
const unsigned char *addr; u8 addr[ETH_ALEN];
u16 vid; u16 vid;
} fdb; } fdb;
} u; } u;
......
...@@ -136,11 +136,11 @@ static void fdb_del_external_learn(struct net_bridge_fdb_entry *f) ...@@ -136,11 +136,11 @@ static void fdb_del_external_learn(struct net_bridge_fdb_entry *f)
struct switchdev_obj obj = { struct switchdev_obj obj = {
.id = SWITCHDEV_OBJ_PORT_FDB, .id = SWITCHDEV_OBJ_PORT_FDB,
.u.fdb = { .u.fdb = {
.addr = f->addr.addr,
.vid = f->vlan_id, .vid = f->vlan_id,
}, },
}; };
ether_addr_copy(obj.u.fdb.addr, f->addr.addr);
switchdev_port_obj_del(f->dst->dev, &obj); switchdev_port_obj_del(f->dst->dev, &obj);
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_bridge.h> #include <linux/if_bridge.h>
#include <net/ip_fib.h> #include <net/ip_fib.h>
#include <net/switchdev.h> #include <net/switchdev.h>
...@@ -742,11 +743,11 @@ int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -742,11 +743,11 @@ int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
struct switchdev_obj obj = { struct switchdev_obj obj = {
.id = SWITCHDEV_OBJ_PORT_FDB, .id = SWITCHDEV_OBJ_PORT_FDB,
.u.fdb = { .u.fdb = {
.addr = addr,
.vid = vid, .vid = vid,
}, },
}; };
ether_addr_copy(obj.u.fdb.addr, addr);
return switchdev_port_obj_add(dev, &obj); return switchdev_port_obj_add(dev, &obj);
} }
EXPORT_SYMBOL_GPL(switchdev_port_fdb_add); EXPORT_SYMBOL_GPL(switchdev_port_fdb_add);
...@@ -769,11 +770,11 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -769,11 +770,11 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
struct switchdev_obj obj = { struct switchdev_obj obj = {
.id = SWITCHDEV_OBJ_PORT_FDB, .id = SWITCHDEV_OBJ_PORT_FDB,
.u.fdb = { .u.fdb = {
.addr = addr,
.vid = vid, .vid = vid,
}, },
}; };
ether_addr_copy(obj.u.fdb.addr, addr);
return switchdev_port_obj_del(dev, &obj); return switchdev_port_obj_del(dev, &obj);
} }
EXPORT_SYMBOL_GPL(switchdev_port_fdb_del); EXPORT_SYMBOL_GPL(switchdev_port_fdb_del);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment