Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0
0002  * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
0003  */
0004 
0005 #ifndef _NET_DSA_8021Q_H
0006 #define _NET_DSA_8021Q_H
0007 
0008 #include <linux/refcount.h>
0009 #include <linux/types.h>
0010 #include <net/dsa.h>
0011 
0012 struct dsa_switch;
0013 struct dsa_port;
0014 struct sk_buff;
0015 struct net_device;
0016 
0017 struct dsa_tag_8021q_vlan {
0018     struct list_head list;
0019     int port;
0020     u16 vid;
0021     refcount_t refcount;
0022 };
0023 
0024 struct dsa_8021q_context {
0025     struct dsa_switch *ds;
0026     struct list_head vlans;
0027     /* EtherType of RX VID, used for filtering on master interface */
0028     __be16 proto;
0029 };
0030 
0031 int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
0032 
0033 void dsa_tag_8021q_unregister(struct dsa_switch *ds);
0034 
0035 int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port,
0036                   struct dsa_bridge bridge);
0037 
0038 void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port,
0039                 struct dsa_bridge bridge);
0040 
0041 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
0042                    u16 tpid, u16 tci);
0043 
0044 void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id,
0045            int *vbid);
0046 
0047 struct net_device *dsa_tag_8021q_find_port_by_vbid(struct net_device *master,
0048                            int vbid);
0049 
0050 u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num);
0051 
0052 u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp);
0053 
0054 int dsa_8021q_rx_switch_id(u16 vid);
0055 
0056 int dsa_8021q_rx_source_port(u16 vid);
0057 
0058 bool vid_is_dsa_8021q(u16 vid);
0059 
0060 #endif /* _NET_DSA_8021Q_H */