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