net: dsa: provide an option for drivers to always receive bridge VLANs
[linux-block.git] / include / linux / dsa / 8021q.h
CommitLineData
f9bbe447
VO
1/* SPDX-License-Identifier: GPL-2.0
2 * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3 */
4
5#ifndef _NET_DSA_8021Q_H
6#define _NET_DSA_8021Q_H
7
8#include <linux/types.h>
9
10struct dsa_switch;
11struct sk_buff;
12struct net_device;
13struct packet_type;
14
ac02a451
VO
15struct dsa_8021q_crosschip_link {
16 struct list_head list;
17 int port;
18 struct dsa_switch *other_ds;
19 int other_port;
20 refcount_t refcount;
21};
22
f9bbe447
VO
23#if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q)
24
25int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
26 bool enabled);
27
ac02a451
VO
28int dsa_8021q_crosschip_link_apply(struct dsa_switch *ds, int port,
29 struct dsa_switch *other_ds,
30 int other_port, bool enabled);
31
32int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port,
33 struct dsa_switch *other_ds,
34 int other_port, struct net_device *br,
35 struct list_head *crosschip_links);
36
37int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port,
38 struct dsa_switch *other_ds,
39 int other_port, struct net_device *br,
40 struct list_head *crosschip_links);
41
f9bbe447
VO
42struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
43 u16 tpid, u16 tci);
44
f9bbe447
VO
45u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port);
46
47u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port);
48
49int dsa_8021q_rx_switch_id(u16 vid);
50
51int dsa_8021q_rx_source_port(u16 vid);
52
53#else
54
55int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
56 bool enabled)
57{
58 return 0;
59}
60
ac02a451
VO
61int dsa_8021q_crosschip_link_apply(struct dsa_switch *ds, int port,
62 struct dsa_switch *other_ds,
63 int other_port, bool enabled)
64{
65 return 0;
66}
67
68int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port,
69 struct dsa_switch *other_ds,
70 int other_port, struct net_device *br,
71 struct list_head *crosschip_links)
72{
73 return 0;
74}
75
76int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port,
77 struct dsa_switch *other_ds,
78 int other_port, struct net_device *br,
79 struct list_head *crosschip_links)
80{
81 return 0;
82}
83
f9bbe447
VO
84struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
85 u16 tpid, u16 tci)
86{
87 return NULL;
88}
89
f9bbe447
VO
90u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
91{
92 return 0;
93}
94
95u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port)
96{
97 return 0;
98}
99
100int dsa_8021q_rx_switch_id(u16 vid)
101{
102 return 0;
103}
104
105int dsa_8021q_rx_source_port(u16 vid)
106{
107 return 0;
108}
109
110#endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
111
112#endif /* _NET_DSA_8021Q_H */