Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 2 | /* |
| 3 | * Bridge per vlan tunnels |
| 4 | * |
| 5 | * Authors: |
| 6 | * Roopa Prabhu <roopa@cumulusnetworks.com> |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef _BR_PRIVATE_TUNNEL_H |
| 10 | #define _BR_PRIVATE_TUNNEL_H |
| 11 | |
| 12 | struct vtunnel_info { |
| 13 | u32 tunid; |
| 14 | u16 vid; |
| 15 | u16 flags; |
| 16 | }; |
| 17 | |
| 18 | /* br_netlink_tunnel.c */ |
| 19 | int br_parse_vlan_tunnel_info(struct nlattr *attr, |
| 20 | struct vtunnel_info *tinfo); |
Nikolay Aleksandrov | 53e9663 | 2020-03-17 14:08:34 +0200 | [diff] [blame] | 21 | int br_process_vlan_tunnel_info(const struct net_bridge *br, |
| 22 | const struct net_bridge_port *p, |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 23 | int cmd, |
| 24 | struct vtunnel_info *tinfo_curr, |
Nikolay Aleksandrov | e19b42a | 2017-10-27 13:19:36 +0300 | [diff] [blame] | 25 | struct vtunnel_info *tinfo_last, |
| 26 | bool *changed); |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 27 | int br_get_vlan_tunnel_info_size(struct net_bridge_vlan_group *vg); |
| 28 | int br_fill_vlan_tunnel_info(struct sk_buff *skb, |
| 29 | struct net_bridge_vlan_group *vg); |
| 30 | |
| 31 | #ifdef CONFIG_BRIDGE_VLAN_FILTERING |
| 32 | /* br_vlan_tunnel.c */ |
| 33 | int vlan_tunnel_init(struct net_bridge_vlan_group *vg); |
| 34 | void vlan_tunnel_deinit(struct net_bridge_vlan_group *vg); |
Nikolay Aleksandrov | 53e9663 | 2020-03-17 14:08:34 +0200 | [diff] [blame] | 35 | int nbp_vlan_tunnel_info_delete(const struct net_bridge_port *port, u16 vid); |
| 36 | int nbp_vlan_tunnel_info_add(const struct net_bridge_port *port, u16 vid, |
| 37 | u32 tun_id); |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 38 | void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port); |
| 39 | void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg, |
| 40 | struct net_bridge_vlan *vlan); |
Kangmin Park | a37c5c2 | 2021-08-23 19:21:18 +0900 | [diff] [blame] | 41 | void br_handle_ingress_vlan_tunnel(struct sk_buff *skb, |
| 42 | struct net_bridge_port *p, |
| 43 | struct net_bridge_vlan_group *vg); |
Roopa Prabhu | 11538d0 | 2017-01-31 22:59:55 -0800 | [diff] [blame] | 44 | int br_handle_egress_vlan_tunnel(struct sk_buff *skb, |
| 45 | struct net_bridge_vlan *vlan); |
Nikolay Aleksandrov | 188c67d | 2020-03-17 14:08:35 +0200 | [diff] [blame] | 46 | bool vlan_tunid_inrange(const struct net_bridge_vlan *v_curr, |
| 47 | const struct net_bridge_vlan *v_last); |
Nikolay Aleksandrov | 569da08 | 2020-03-17 14:08:36 +0200 | [diff] [blame] | 48 | int br_vlan_tunnel_info(const struct net_bridge_port *p, int cmd, |
| 49 | u16 vid, u32 tun_id, bool *changed); |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 50 | #else |
| 51 | static inline int vlan_tunnel_init(struct net_bridge_vlan_group *vg) |
| 52 | { |
| 53 | return 0; |
| 54 | } |
| 55 | |
Nikolay Aleksandrov | 53e9663 | 2020-03-17 14:08:34 +0200 | [diff] [blame] | 56 | static inline int nbp_vlan_tunnel_info_delete(const struct net_bridge_port *port, |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 57 | u16 vid) |
| 58 | { |
| 59 | return 0; |
| 60 | } |
| 61 | |
Nikolay Aleksandrov | 53e9663 | 2020-03-17 14:08:34 +0200 | [diff] [blame] | 62 | static inline int nbp_vlan_tunnel_info_add(const struct net_bridge_port *port, |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 63 | u16 vid, u32 tun_id) |
| 64 | { |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | static inline void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port) |
| 69 | { |
| 70 | } |
| 71 | |
| 72 | static inline void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg, |
| 73 | struct net_bridge_vlan *vlan) |
| 74 | { |
| 75 | } |
| 76 | |
Roopa Prabhu | 11538d0 | 2017-01-31 22:59:55 -0800 | [diff] [blame] | 77 | static inline int br_handle_ingress_vlan_tunnel(struct sk_buff *skb, |
| 78 | struct net_bridge_port *p, |
| 79 | struct net_bridge_vlan_group *vg) |
| 80 | { |
| 81 | return 0; |
| 82 | } |
Roopa Prabhu | efa5356 | 2017-01-31 22:59:54 -0800 | [diff] [blame] | 83 | #endif |
| 84 | |
| 85 | #endif |