xref: /linux-6.15/include/linux/dsa/8021q.h (revision e8d4f892)
1 /* SPDX-License-Identifier: GPL-2.0
2  * Copyright (c) 2019, Vladimir Oltean <[email protected]>
3  */
4 
5 #ifndef _NET_DSA_8021Q_H
6 #define _NET_DSA_8021Q_H
7 
8 #include <linux/types.h>
9 
10 struct dsa_switch;
11 struct sk_buff;
12 struct net_device;
13 struct packet_type;
14 
15 #if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q)
16 
17 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
18 				 bool enabled);
19 
20 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
21 			       u16 tpid, u16 tci);
22 
23 struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev,
24 			      struct packet_type *pt, u16 *tpid, u16 *tci);
25 
26 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port);
27 
28 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port);
29 
30 int dsa_8021q_rx_switch_id(u16 vid);
31 
32 int dsa_8021q_rx_source_port(u16 vid);
33 
34 #else
35 
36 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
37 				 bool enabled)
38 {
39 	return 0;
40 }
41 
42 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
43 			       u16 tpid, u16 tci)
44 {
45 	return NULL;
46 }
47 
48 struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev,
49 			      struct packet_type *pt, u16 *tpid, u16 *tci)
50 {
51 	return NULL;
52 }
53 
54 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
55 {
56 	return 0;
57 }
58 
59 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port)
60 {
61 	return 0;
62 }
63 
64 int dsa_8021q_rx_switch_id(u16 vid)
65 {
66 	return 0;
67 }
68 
69 int dsa_8021q_rx_source_port(u16 vid)
70 {
71 	return 0;
72 }
73 
74 #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
75 
76 #endif /* _NET_DSA_8021Q_H */
77