1 /*
2  *	Bridge per vlan tunnels
3  *
4  *	Authors:
5  *	Roopa Prabhu		<roopa@cumulusnetworks.com>
6  *
7  *	This program is free software; you can redistribute it and/or
8  *	modify it under the terms of the GNU General Public License
9  *	as published by the Free Software Foundation; either version
10  *	2 of the License, or (at your option) any later version.
11  */
12 
13 #ifndef _BR_PRIVATE_TUNNEL_H
14 #define _BR_PRIVATE_TUNNEL_H
15 
16 struct vtunnel_info {
17 	u32	tunid;
18 	u16	vid;
19 	u16	flags;
20 };
21 
22 /* br_netlink_tunnel.c */
23 int br_parse_vlan_tunnel_info(struct nlattr *attr,
24 			      struct vtunnel_info *tinfo);
25 int br_process_vlan_tunnel_info(struct net_bridge *br,
26 				struct net_bridge_port *p,
27 				int cmd,
28 				struct vtunnel_info *tinfo_curr,
29 				struct vtunnel_info *tinfo_last,
30 				bool *changed);
31 int br_get_vlan_tunnel_info_size(struct net_bridge_vlan_group *vg);
32 int br_fill_vlan_tunnel_info(struct sk_buff *skb,
33 			     struct net_bridge_vlan_group *vg);
34 
35 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
36 /* br_vlan_tunnel.c */
37 int vlan_tunnel_init(struct net_bridge_vlan_group *vg);
38 void vlan_tunnel_deinit(struct net_bridge_vlan_group *vg);
39 int nbp_vlan_tunnel_info_delete(struct net_bridge_port *port, u16 vid);
40 int nbp_vlan_tunnel_info_add(struct net_bridge_port *port, u16 vid, u32 tun_id);
41 void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port);
42 void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
43 			  struct net_bridge_vlan *vlan);
44 int br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
45 				  struct net_bridge_port *p,
46 				  struct net_bridge_vlan_group *vg);
47 int br_handle_egress_vlan_tunnel(struct sk_buff *skb,
48 				 struct net_bridge_vlan *vlan);
49 #else
50 static inline int vlan_tunnel_init(struct net_bridge_vlan_group *vg)
51 {
52 	return 0;
53 }
54 
55 static inline int nbp_vlan_tunnel_info_delete(struct net_bridge_port *port,
56 					      u16 vid)
57 {
58 	return 0;
59 }
60 
61 static inline int nbp_vlan_tunnel_info_add(struct net_bridge_port *port,
62 					   u16 vid, u32 tun_id)
63 {
64 	return 0;
65 }
66 
67 static inline void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port)
68 {
69 }
70 
71 static inline void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
72 					struct net_bridge_vlan *vlan)
73 {
74 }
75 
76 static inline int br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
77 						struct net_bridge_port *p,
78 						struct net_bridge_vlan_group *vg)
79 {
80 	return 0;
81 }
82 #endif
83 
84 #endif
85