1 /*
2  * Copyright (c) 2014, 2017 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _WLAN_HDD_ETHER_H
20 #define _WLAN_HDD_ETHER_H
21 /**
22  * DOC: wlan_hdd_ether.h
23  *
24  * This module describes Ethernet packet formats for processing by HDD.
25  */
26 
27 /*
28  * Include Files
29  */
30 #include <linux/version.h>
31 #include <linux/byteorder/generic.h>
32 #include <linux/if_ether.h>
33 #include <linux/if_vlan.h>
34 
35 /*
36  * Preprocessor Definitions and Constants
37  */
38 #define WLAN_SNAP_OUI_LEN 3
39 #define WLAN_SNAP_DSAP 0xAAU
40 #define WLAN_SNAP_SSAP 0xAAU
41 #define WLAN_SNAP_CTRL 0x03
42 #define WLAN_MIN_PROTO 0x0600
43 
44 /*
45  * Type Declarations
46  */
47 struct wlan_snap_hdr {
48 	unsigned char dsap;
49 	unsigned char ssap;
50 	unsigned char ctrl;
51 	unsigned char oui[WLAN_SNAP_OUI_LEN];
52 } __packed;
53 
54 struct wlan_8023 {
55 	unsigned char h_dest[ETH_ALEN];
56 	unsigned char h_source[ETH_ALEN];
57 	__be16 h_len;
58 	struct wlan_snap_hdr h_snap;
59 	__be16 h_proto;
60 } __packed;
61 
62 struct wlan_8023_vlan {
63 	unsigned char h_dest[ETH_ALEN];
64 	unsigned char h_source[ETH_ALEN];
65 	__be16 h_vlan_proto;
66 	__be16 h_vlan_TCI;
67 	__be16 h_len;
68 	struct wlan_snap_hdr h_snap;
69 	__be16 h_proto;
70 } __packed;
71 
72 union generic_ethhdr {
73 	struct ethhdr eth_II;
74 	struct vlan_ethhdr eth_IIv;
75 	struct wlan_8023 eth_8023;
76 	struct wlan_8023_vlan eth_8023v;
77 };
78 
79 #endif /* #ifndef _WLAN_HDD_ETHER_H */
80