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 
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 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port);
24 
25 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port);
26 
27 int dsa_8021q_rx_switch_id(u16 vid);
28 
29 int dsa_8021q_rx_source_port(u16 vid);
30 
31 struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb);
32 
33 #else
34 
dsa_port_setup_8021q_tagging(struct dsa_switch * ds,int index,bool enabled)35 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
36 				 bool enabled)
37 {
38 	return 0;
39 }
40 
dsa_8021q_xmit(struct sk_buff * skb,struct net_device * netdev,u16 tpid,u16 tci)41 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
42 			       u16 tpid, u16 tci)
43 {
44 	return NULL;
45 }
46 
dsa_8021q_tx_vid(struct dsa_switch * ds,int port)47 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
48 {
49 	return 0;
50 }
51 
dsa_8021q_rx_vid(struct dsa_switch * ds,int port)52 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port)
53 {
54 	return 0;
55 }
56 
dsa_8021q_rx_switch_id(u16 vid)57 int dsa_8021q_rx_switch_id(u16 vid)
58 {
59 	return 0;
60 }
61 
dsa_8021q_rx_source_port(u16 vid)62 int dsa_8021q_rx_source_port(u16 vid)
63 {
64 	return 0;
65 }
66 
dsa_8021q_remove_header(struct sk_buff * skb)67 struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
68 {
69 	return NULL;
70 }
71 
72 #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
73 
74 #endif /* _NET_DSA_8021Q_H */
75