#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <net/switchdev.h>
#include "br_private.h"
#include "br_private_tunnel.h"
static void nbp_vlan_set_vlan_dev_state(struct net_bridge_port *p, u16 vid);
static inline int br_vlan_cmp(struct rhashtable_compare_arg *arg,
const void *ptr)
{ … }
static const struct rhashtable_params br_vlan_rht_params = …;
static struct net_bridge_vlan *br_vlan_lookup(struct rhashtable *tbl, u16 vid)
{ … }
static void __vlan_add_pvid(struct net_bridge_vlan_group *vg,
const struct net_bridge_vlan *v)
{ … }
static void __vlan_delete_pvid(struct net_bridge_vlan_group *vg, u16 vid)
{ … }
static bool __vlan_flags_update(struct net_bridge_vlan *v, u16 flags,
bool commit)
{ … }
static bool __vlan_flags_would_change(struct net_bridge_vlan *v, u16 flags)
{ … }
static void __vlan_flags_commit(struct net_bridge_vlan *v, u16 flags)
{ … }
static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br,
struct net_bridge_vlan *v, u16 flags,
struct netlink_ext_ack *extack)
{ … }
static void __vlan_add_list(struct net_bridge_vlan *v)
{ … }
static void __vlan_del_list(struct net_bridge_vlan *v)
{ … }
static int __vlan_vid_del(struct net_device *dev, struct net_bridge *br,
const struct net_bridge_vlan *v)
{ … }
static struct net_bridge_vlan *
br_vlan_get_master(struct net_bridge *br, u16 vid,
struct netlink_ext_ack *extack)
{ … }
static void br_master_vlan_rcu_free(struct rcu_head *rcu)
{ … }
static void br_vlan_put_master(struct net_bridge_vlan *masterv)
{ … }
static void nbp_vlan_rcu_free(struct rcu_head *rcu)
{ … }
static void br_vlan_init_state(struct net_bridge_vlan *v)
{ … }
static int __vlan_add(struct net_bridge_vlan *v, u16 flags,
struct netlink_ext_ack *extack)
{ … }
static int __vlan_del(struct net_bridge_vlan *v)
{ … }
static void __vlan_group_free(struct net_bridge_vlan_group *vg)
{ … }
static void __vlan_flush(const struct net_bridge *br,
const struct net_bridge_port *p,
struct net_bridge_vlan_group *vg)
{ … }
struct sk_buff *br_handle_vlan(struct net_bridge *br,
const struct net_bridge_port *p,
struct net_bridge_vlan_group *vg,
struct sk_buff *skb)
{ … }
static bool __allowed_ingress(const struct net_bridge *br,
struct net_bridge_vlan_group *vg,
struct sk_buff *skb, u16 *vid,
u8 *state,
struct net_bridge_vlan **vlan)
{ … }
bool br_allowed_ingress(const struct net_bridge *br,
struct net_bridge_vlan_group *vg, struct sk_buff *skb,
u16 *vid, u8 *state,
struct net_bridge_vlan **vlan)
{ … }
bool br_allowed_egress(struct net_bridge_vlan_group *vg,
const struct sk_buff *skb)
{ … }
bool br_should_learn(struct net_bridge_port *p, struct sk_buff *skb, u16 *vid)
{ … }
static int br_vlan_add_existing(struct net_bridge *br,
struct net_bridge_vlan_group *vg,
struct net_bridge_vlan *vlan,
u16 flags, bool *changed,
struct netlink_ext_ack *extack)
{ … }
int br_vlan_add(struct net_bridge *br, u16 vid, u16 flags, bool *changed,
struct netlink_ext_ack *extack)
{ … }
int br_vlan_delete(struct net_bridge *br, u16 vid)
{ … }
void br_vlan_flush(struct net_bridge *br)
{ … }
struct net_bridge_vlan *br_vlan_find(struct net_bridge_vlan_group *vg, u16 vid)
{ … }
static void recalculate_group_addr(struct net_bridge *br)
{ … }
void br_recalculate_fwd_mask(struct net_bridge *br)
{ … }
int br_vlan_filter_toggle(struct net_bridge *br, unsigned long val,
struct netlink_ext_ack *extack)
{ … }
bool br_vlan_enabled(const struct net_device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto)
{ … }
EXPORT_SYMBOL_GPL(…);
int __br_vlan_set_proto(struct net_bridge *br, __be16 proto,
struct netlink_ext_ack *extack)
{ … }
int br_vlan_set_proto(struct net_bridge *br, unsigned long val,
struct netlink_ext_ack *extack)
{ … }
int br_vlan_set_stats(struct net_bridge *br, unsigned long val)
{ … }
int br_vlan_set_stats_per_port(struct net_bridge *br, unsigned long val)
{ … }
static bool vlan_default_pvid(struct net_bridge_vlan_group *vg, u16 vid)
{ … }
static void br_vlan_disable_default_pvid(struct net_bridge *br)
{ … }
int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid,
struct netlink_ext_ack *extack)
{ … }
int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val,
struct netlink_ext_ack *extack)
{ … }
int br_vlan_init(struct net_bridge *br)
{ … }
int nbp_vlan_init(struct net_bridge_port *p, struct netlink_ext_ack *extack)
{ … }
int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags,
bool *changed, struct netlink_ext_ack *extack)
{ … }
int nbp_vlan_delete(struct net_bridge_port *port, u16 vid)
{ … }
void nbp_vlan_flush(struct net_bridge_port *port)
{ … }
void br_vlan_get_stats(const struct net_bridge_vlan *v,
struct pcpu_sw_netstats *stats)
{ … }
int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
{ … }
EXPORT_SYMBOL_GPL(…);
int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
{ … }
EXPORT_SYMBOL_GPL(…);
void br_vlan_fill_forward_path_pvid(struct net_bridge *br,
struct net_device_path_ctx *ctx,
struct net_device_path *path)
{ … }
int br_vlan_fill_forward_path_mode(struct net_bridge *br,
struct net_bridge_port *dst,
struct net_device_path *path)
{ … }
int br_vlan_get_info(const struct net_device *dev, u16 vid,
struct bridge_vlan_info *p_vinfo)
{ … }
EXPORT_SYMBOL_GPL(…);
int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid,
struct bridge_vlan_info *p_vinfo)
{ … }
EXPORT_SYMBOL_GPL(…);
static int br_vlan_is_bind_vlan_dev(const struct net_device *dev)
{ … }
static int br_vlan_is_bind_vlan_dev_fn(struct net_device *dev,
__always_unused struct netdev_nested_priv *priv)
{ … }
static bool br_vlan_has_upper_bind_vlan_dev(struct net_device *dev)
{ … }
struct br_vlan_bind_walk_data { … };
static int br_vlan_match_bind_vlan_dev_fn(struct net_device *dev,
struct netdev_nested_priv *priv)
{ … }
static struct net_device *
br_vlan_get_upper_bind_vlan_dev(struct net_device *dev, u16 vid)
{ … }
static bool br_vlan_is_dev_up(const struct net_device *dev)
{ … }
static void br_vlan_set_vlan_dev_state(const struct net_bridge *br,
struct net_device *vlan_dev)
{ … }
static void br_vlan_set_all_vlan_dev_state(struct net_bridge_port *p)
{ … }
static void br_vlan_upper_change(struct net_device *dev,
struct net_device *upper_dev,
bool linking)
{ … }
struct br_vlan_link_state_walk_data { … };
static int br_vlan_link_state_change_fn(struct net_device *vlan_dev,
struct netdev_nested_priv *priv)
{ … }
static void br_vlan_link_state_change(struct net_device *dev,
struct net_bridge *br)
{ … }
static void nbp_vlan_set_vlan_dev_state(struct net_bridge_port *p, u16 vid)
{ … }
int br_vlan_bridge_event(struct net_device *dev, unsigned long event, void *ptr)
{ … }
void br_vlan_port_event(struct net_bridge_port *p, unsigned long event)
{ … }
static bool br_vlan_stats_fill(struct sk_buff *skb,
const struct net_bridge_vlan *v)
{ … }
static bool br_vlan_fill_vids(struct sk_buff *skb, u16 vid, u16 vid_range,
const struct net_bridge_vlan *v_opts,
const struct net_bridge_port *p,
u16 flags,
bool dump_stats)
{ … }
static size_t rtnl_vlan_nlmsg_size(void)
{ … }
void br_vlan_notify(const struct net_bridge *br,
const struct net_bridge_port *p,
u16 vid, u16 vid_range,
int cmd)
{ … }
bool br_vlan_can_enter_range(const struct net_bridge_vlan *v_curr,
const struct net_bridge_vlan *range_end)
{ … }
static int br_vlan_dump_dev(const struct net_device *dev,
struct sk_buff *skb,
struct netlink_callback *cb,
u32 dump_flags)
{ … }
static const struct nla_policy br_vlan_db_dump_pol[BRIDGE_VLANDB_DUMP_MAX + 1] = …;
static int br_vlan_rtm_dump(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
static const struct nla_policy br_vlan_db_policy[BRIDGE_VLANDB_ENTRY_MAX + 1] = …;
static int br_vlan_rtm_process_one(struct net_device *dev,
const struct nlattr *attr,
int cmd, struct netlink_ext_ack *extack)
{ … }
static int br_vlan_rtm_process(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack)
{ … }
void br_vlan_rtnl_init(void)
{ … }
void br_vlan_rtnl_uninit(void)
{ … }