bridge: per vlan dst_metadata netlink support
This patch adds support to attach per vlan tunnel info dst metadata. This enables bridge driver to map vlan to tunnel_info at ingress and egress. It uses the kernel dst_metadata infrastructure. The initial use case is vlan to vni bridging, but the api is generic to extend to any tunnel_info in the future: - Uapi to configure/unconfigure/dump per vlan tunnel data - netlink functions to configure vlan and tunnel_info mapping - Introduces bridge port flag BR_LWT_VLAN to enable attach/detach dst_metadata to bridged packets on ports. off by default. - changes to existing code is mainly refactor some existing vlan handling netlink code + hooks for new vlan tunnel code - I have kept the vlan tunnel code isolated in separate files. - most of the netlink vlan tunnel code is handling of vlan-tunid ranges (follows the vlan range handling code). To conserve space vlan-tunid by default are always dumped in ranges if applicable. Use case: example use for this is a vxlan bridging gateway or vtep which maps vlans to vn-segments (or vnis). iproute2 example (patched and pruned iproute2 output to just show relevant fdb entries): example shows same host mac learnt on two vni's and vlan 100 maps to vni 1000, vlan 101 maps to vni 1001 before (netdev per vni): $bridge fdb show | grep "00:02:00:00:00:03" 00:02:00:00:00:03 dev vxlan1001 vlan 101 master bridge 00:02:00:00:00:03 dev vxlan1001 dst 12.0.0.8 self 00:02:00:00:00:03 dev vxlan1000 vlan 100 master bridge 00:02:00:00:00:03 dev vxlan1000 dst 12.0.0.8 self after this patch with collect metdata in bridged mode (single netdev): $bridge fdb show | grep "00:02:00:00:00:03" 00:02:00:00:00:03 dev vxlan0 vlan 101 master bridge 00:02:00:00:00:03 dev vxlan0 src_vni 1001 dst 12.0.0.8 self 00:02:00:00:00:03 dev vxlan0 vlan 100 master bridge 00:02:00:00:00:03 dev vxlan0 src_vni 1000 dst 12.0.0.8 self CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
b3c7ef0ada
commit
efa5356b0d
72
net/bridge/br_private_tunnel.h
Normal file
72
net/bridge/br_private_tunnel.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Bridge per vlan tunnels
|
||||
*
|
||||
* Authors:
|
||||
* Roopa Prabhu <roopa@cumulusnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _BR_PRIVATE_TUNNEL_H
|
||||
#define _BR_PRIVATE_TUNNEL_H
|
||||
|
||||
struct vtunnel_info {
|
||||
u32 tunid;
|
||||
u16 vid;
|
||||
u16 flags;
|
||||
};
|
||||
|
||||
/* br_netlink_tunnel.c */
|
||||
int br_parse_vlan_tunnel_info(struct nlattr *attr,
|
||||
struct vtunnel_info *tinfo);
|
||||
int br_process_vlan_tunnel_info(struct net_bridge *br,
|
||||
struct net_bridge_port *p,
|
||||
int cmd,
|
||||
struct vtunnel_info *tinfo_curr,
|
||||
struct vtunnel_info *tinfo_last);
|
||||
int br_get_vlan_tunnel_info_size(struct net_bridge_vlan_group *vg);
|
||||
int br_fill_vlan_tunnel_info(struct sk_buff *skb,
|
||||
struct net_bridge_vlan_group *vg);
|
||||
|
||||
#ifdef CONFIG_BRIDGE_VLAN_FILTERING
|
||||
/* br_vlan_tunnel.c */
|
||||
int vlan_tunnel_init(struct net_bridge_vlan_group *vg);
|
||||
void vlan_tunnel_deinit(struct net_bridge_vlan_group *vg);
|
||||
int nbp_vlan_tunnel_info_delete(struct net_bridge_port *port, u16 vid);
|
||||
int nbp_vlan_tunnel_info_add(struct net_bridge_port *port, u16 vid, u32 tun_id);
|
||||
void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port);
|
||||
void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
|
||||
struct net_bridge_vlan *vlan);
|
||||
#else
|
||||
static inline int vlan_tunnel_init(struct net_bridge_vlan_group *vg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int nbp_vlan_tunnel_info_delete(struct net_bridge_port *port,
|
||||
u16 vid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int nbp_vlan_tunnel_info_add(struct net_bridge_port *port,
|
||||
u16 vid, u32 tun_id)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
|
||||
struct net_bridge_vlan *vlan)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user