Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / wlan / if_ethersubr.h
1 /*-
2  * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer,
10  *    without modification.
11  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13  *    redistribution must be conditioned upon including a substantially
14  *    similar Disclaimer requirement for further binary redistribution.
15  * 3. Neither the names of the above-listed copyright holders nor the names
16  *    of any contributors may be used to endorse or promote products derived
17  *    from this software without specific prior written permission.
18  *
19  * Alternatively, this software may be distributed under the terms of the
20  * GNU General Public License ("GPL") version 2 as published by the Free
21  * Software Foundation.
22  *
23  * NO WARRANTY
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
27  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
28  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
29  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
32  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34  * THE POSSIBILITY OF SUCH DAMAGES.
35  *
36  * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/net80211/if_ethersubr.h#1 $
37  */
38
39 #ifndef _NET_IF_ETHERSUBR_H_
40 #define _NET_IF_ETHERSUBR_H_
41
42 #define ETHER_ADDR_LEN          6       /* length of an Ethernet address */
43 #define ETHER_TYPE_LEN          2       /* length of the Ethernet type field */
44 #define ETHER_CRC_LEN           4       /* length of the Ethernet CRC */
45 #define ETHER_HDR_LEN           (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
46 #define ETHER_MAX_LEN           1518
47
48 #define ETHERMTU        (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
49
50 /*
51  * Structure of a 10Mb/s Ethernet header.
52  */
53 /* struct       ether_header { */
54 /*      u_char  ether_dhost[ETHER_ADDR_LEN]; */
55 /*      u_char  ether_shost[ETHER_ADDR_LEN]; */
56 /*      u_short ether_type; */
57 /* } adf_os_packed; */
58
59 #ifndef ETHERTYPE_PAE
60 #define ETHERTYPE_PAE   0x888e          /* EAPOL PAE/802.1x */
61 #endif
62 #ifndef ETHERTYPE_IP
63 #define ETHERTYPE_IP    0x0800          /* IP protocol */
64 #endif
65
66 /*
67  * Structure of a 48-bit Ethernet address.
68  */
69 /* struct       ether_addr { */
70 /*      u_char octet[ETHER_ADDR_LEN]; */
71 /* } adf_os_packed; */
72
73 #define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
74
75 #define VLAN_PRI_SHIFT  13              /* Shift to find VLAN user priority */
76 #define VLAN_PRI_MASK   7               /* Mask for user priority bits in VLAN */
77
78
79 #endif /* _NET_IF_ETHERSUBR_H_ */