1 /* SPDX-License-Identifier: GPL-2.0
2 * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
5 #ifndef _NET_DSA_8021Q_H
6 #define _NET_DSA_8021Q_H
8 #include <linux/refcount.h>
9 #include <linux/types.h>
16 struct dsa_8021q_crosschip_link {
17 struct list_head list;
19 struct dsa_switch *other_ds;
24 #define DSA_8021Q_N_SUBVLAN 8
26 #if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q)
28 int dsa_8021q_setup(struct dsa_switch *ds, bool enabled);
30 int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port,
31 struct dsa_switch *other_ds,
33 struct list_head *crosschip_links);
35 int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port,
36 struct dsa_switch *other_ds,
38 struct list_head *crosschip_links);
40 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
43 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port);
45 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port);
47 u16 dsa_8021q_rx_vid_subvlan(struct dsa_switch *ds, int port, u16 subvlan);
49 int dsa_8021q_rx_switch_id(u16 vid);
51 int dsa_8021q_rx_source_port(u16 vid);
53 u16 dsa_8021q_rx_subvlan(u16 vid);
55 bool vid_is_dsa_8021q(u16 vid);
59 int dsa_8021q_setup(struct dsa_switch *ds, bool enabled)
64 int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port,
65 struct dsa_switch *other_ds,
67 struct list_head *crosschip_links)
72 int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port,
73 struct dsa_switch *other_ds,
75 struct list_head *crosschip_links)
80 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
86 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
91 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port)
96 u16 dsa_8021q_rx_vid_subvlan(struct dsa_switch *ds, int port, u16 subvlan)
101 int dsa_8021q_rx_switch_id(u16 vid)
106 int dsa_8021q_rx_source_port(u16 vid)
111 u16 dsa_8021q_rx_subvlan(u16 vid)
116 bool vid_is_dsa_8021q(u16 vid)
121 #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
123 #endif /* _NET_DSA_8021Q_H */