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