| 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 <net/dsa.h> |
| 9 | #include <linux/types.h> |
| 10 | |
| 11 | /* VBID is limited to three bits only and zero is reserved. |
| 12 | * Only 7 bridges can be enumerated. |
| 13 | */ |
| 14 | #define DSA_TAG_8021Q_MAX_NUM_BRIDGES 7 |
| 15 | |
| 16 | int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto); |
| 17 | |
| 18 | void dsa_tag_8021q_unregister(struct dsa_switch *ds); |
| 19 | |
| 20 | int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port, |
| 21 | struct dsa_bridge bridge, bool *tx_fwd_offload, |
| 22 | struct netlink_ext_ack *extack); |
| 23 | |
| 24 | void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port, |
| 25 | struct dsa_bridge bridge); |
| 26 | |
| 27 | u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num); |
| 28 | |
| 29 | u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp); |
| 30 | |
| 31 | int dsa_8021q_rx_switch_id(u16 vid); |
| 32 | |
| 33 | int dsa_8021q_rx_source_port(u16 vid); |
| 34 | |
| 35 | bool vid_is_dsa_8021q(u16 vid); |
| 36 | |
| 37 | #endif /* _NET_DSA_8021Q_H */ |
| 38 | |