1
2
3
4
5
6
7
8
9
10 #ifndef __ETHSW_H
11 #define __ETHSW_H
12
13 #include <linux/netdevice.h>
14 #include <linux/etherdevice.h>
15 #include <linux/rtnetlink.h>
16 #include <linux/if_vlan.h>
17 #include <uapi/linux/if_bridge.h>
18 #include <net/switchdev.h>
19 #include <linux/if_bridge.h>
20
21 #include "dpsw.h"
22
23
24 #define DPSW_IRQ_NUM 2
25
26
27 #define ETHSW_VLAN_MEMBER 1
28
29 #define ETHSW_VLAN_UNTAGGED 2
30
31 #define ETHSW_VLAN_PVID 4
32
33 #define ETHSW_VLAN_GLOBAL 8
34
35
36 #define DPAA2_MFL (10 * 1024)
37 #define ETHSW_MAX_FRAME_LENGTH (DPAA2_MFL - VLAN_ETH_HLEN - ETH_FCS_LEN)
38 #define ETHSW_L2_MAX_FRM(mtu) ((mtu) + VLAN_ETH_HLEN + ETH_FCS_LEN)
39
40 extern const struct ethtool_ops ethsw_port_ethtool_ops;
41
42 struct ethsw_core;
43
44
45 struct ethsw_port_priv {
46 struct net_device *netdev;
47 u16 idx;
48 struct ethsw_core *ethsw_data;
49 u8 link_state;
50 u8 stp_state;
51 bool flood;
52
53 u8 vlans[VLAN_VID_MASK + 1];
54 u16 pvid;
55 struct net_device *bridge_dev;
56 };
57
58
59 struct ethsw_core {
60 struct device *dev;
61 struct fsl_mc_io *mc_io;
62 u16 dpsw_handle;
63 struct dpsw_attr sw_attr;
64 int dev_id;
65 struct ethsw_port_priv **ports;
66
67 u8 vlans[VLAN_VID_MASK + 1];
68 bool learning;
69 };
70
71 #endif