8021q.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0
  2. * Copyright (c) 2019, Vladimir Oltean <[email protected]>
  3. */
  4. #ifndef _NET_DSA_8021Q_H
  5. #define _NET_DSA_8021Q_H
  6. #include <linux/refcount.h>
  7. #include <linux/types.h>
  8. #include <net/dsa.h>
  9. struct dsa_switch;
  10. struct dsa_port;
  11. struct sk_buff;
  12. struct net_device;
  13. struct dsa_tag_8021q_vlan {
  14. struct list_head list;
  15. int port;
  16. u16 vid;
  17. refcount_t refcount;
  18. };
  19. struct dsa_8021q_context {
  20. struct dsa_switch *ds;
  21. struct list_head vlans;
  22. /* EtherType of RX VID, used for filtering on master interface */
  23. __be16 proto;
  24. };
  25. int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
  26. void dsa_tag_8021q_unregister(struct dsa_switch *ds);
  27. int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port,
  28. struct dsa_bridge bridge);
  29. void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port,
  30. struct dsa_bridge bridge);
  31. struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
  32. u16 tpid, u16 tci);
  33. void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
  34. int *vbid);
  35. struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
  36. int vbid);
  37. u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num);
  38. u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp);
  39. int dsa_8021q_rx_switch_id(u16 vid);
  40. int dsa_8021q_rx_source_port(u16 vid);
  41. bool vid_is_dsa_8021q(u16 vid);
  42. #endif /* _NET_DSA_8021Q_H */