Commit f1fecb1d authored by Elad Raz's avatar Elad Raz Committed by David S. Miller
Browse files

bridge: Reflect MDB entries to hardware

Offload MDB changes per port to hardware
Signed-off-by: default avatarElad Raz <>
Signed-off-by: default avatarIdo Schimmel <>
Signed-off-by: default avatarJiri Pirko <>
Reviewed-by: default avatarNikolay Aleksandrov <>
Signed-off-by: default avatarDavid S. Miller <>
parent 4d41e125
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <net/ip.h> #include <net/ip.h>
#include <net/netlink.h> #include <net/netlink.h>
#include <net/switchdev.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/addrconf.h> #include <net/addrconf.h>
...@@ -210,10 +211,32 @@ static inline size_t rtnl_mdb_nlmsg_size(void) ...@@ -210,10 +211,32 @@ static inline size_t rtnl_mdb_nlmsg_size(void)
static void __br_mdb_notify(struct net_device *dev, struct br_mdb_entry *entry, static void __br_mdb_notify(struct net_device *dev, struct br_mdb_entry *entry,
int type) int type)
{ {
struct switchdev_obj_port_mdb mdb = {
.obj = {
.vid = entry->vid,
struct net_device *port_dev;
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
struct sk_buff *skb; struct sk_buff *skb;
int err = -ENOBUFS; int err = -ENOBUFS;
port_dev = __dev_get_by_index(net, entry->ifindex);
if (entry->addr.proto == htons(ETH_P_IP))
ip_eth_mc_map(entry->addr.u.ip4, mdb.addr);
ipv6_eth_mc_map(&entry->addr.u.ip6, mdb.addr);
mdb.obj.orig_dev = port_dev;
if (port_dev && type == RTM_NEWMDB)
switchdev_port_obj_add(port_dev, &mdb.obj);
else if (port_dev && type == RTM_DELMDB)
switchdev_port_obj_del(port_dev, &mdb.obj);
skb = nlmsg_new(rtnl_mdb_nlmsg_size(), GFP_ATOMIC); skb = nlmsg_new(rtnl_mdb_nlmsg_size(), GFP_ATOMIC);
if (!skb) if (!skb)
goto errout; goto errout;
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