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 struct 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 23 #define DSA_8021Q_N_SUBVLAN 8 24 25 #if IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) 26 27 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, 28 bool enabled); 29 30 int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port, 31 struct dsa_switch *other_ds, 32 int other_port, 33 struct list_head *crosschip_links); 34 35 int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port, 36 struct dsa_switch *other_ds, 37 int other_port, 38 struct list_head *crosschip_links); 39 40 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, 41 u16 tpid, u16 tci); 42 43 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); 44 45 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); 46 47 u16 dsa_8021q_rx_vid_subvlan(struct dsa_switch *ds, int port, u16 subvlan); 48 49 int dsa_8021q_rx_switch_id(u16 vid); 50 51 int dsa_8021q_rx_source_port(u16 vid); 52 53 u16 dsa_8021q_rx_subvlan(u16 vid); 54 55 bool vid_is_dsa_8021q(u16 vid); 56 57 #else 58 59 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, 60 bool enabled) 61 { 62 return 0; 63 } 64 65 int dsa_8021q_crosschip_bridge_join(struct dsa_switch *ds, int port, 66 struct dsa_switch *other_ds, 67 int other_port, 68 struct list_head *crosschip_links) 69 { 70 return 0; 71 } 72 73 int dsa_8021q_crosschip_bridge_leave(struct dsa_switch *ds, int port, 74 struct dsa_switch *other_ds, 75 int other_port, 76 struct list_head *crosschip_links) 77 { 78 return 0; 79 } 80 81 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, 82 u16 tpid, u16 tci) 83 { 84 return NULL; 85 } 86 87 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) 88 { 89 return 0; 90 } 91 92 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port) 93 { 94 return 0; 95 } 96 97 u16 dsa_8021q_rx_vid_subvlan(struct dsa_switch *ds, int port, u16 subvlan) 98 { 99 return 0; 100 } 101 102 int dsa_8021q_rx_switch_id(u16 vid) 103 { 104 return 0; 105 } 106 107 int dsa_8021q_rx_source_port(u16 vid) 108 { 109 return 0; 110 } 111 112 u16 dsa_8021q_rx_subvlan(u16 vid) 113 { 114 return 0; 115 } 116 117 bool vid_is_dsa_8021q(u16 vid) 118 { 119 return false; 120 } 121 122 #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ 123 124 #endif /* _NET_DSA_8021Q_H */ 125