carl9170: Update to latest upstream
[linux-libre-firmware.git] / ath9k_htc / target_firmware / wlan / if_llc.h
1 /*-
2  * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
3  * Copyright (c) 2013 Qualcomm Atheros, Inc.
4  *
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted (subject to the limitations in the
9  * disclaimer below) provided that the following conditions are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *
14  *  * Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the
17  *    distribution.
18  *
19  *  * Neither the name of Qualcomm Atheros nor the names of its
20  *    contributors may be used to endorse or promote products derived
21  *    from this software without specific prior written permission.
22  *
23  * Alternatively, this software may be distributed under the terms of the
24  * GNU General Public License ("GPL") version 2 as published by the Free
25  * Software Foundation.
26  *
27  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
28  * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
29  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
30  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
33  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
36  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
37  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
38  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
39  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 /*
42  * Copyright (c) 1988, 1993
43  *      The Regents of the University of California.  All rights reserved.
44  *
45  * Redistribution and use in source and binary forms, with or without
46  * modification, are permitted provided that the following conditions
47  * are met:
48  * 1. Redistributions of source code must retain the above copyright
49  *    notice, this list of conditions and the following disclaimer.
50  * 2. Redistributions in binary form must reproduce the above copyright
51  *    notice, this list of conditions and the following disclaimer in the
52  *    documentation and/or other materials provided with the distribution.
53  * 4. Neither the name of the University nor the names of its contributors
54  *    may be used to endorse or promote products derived from this software
55  *    without specific prior written permission.
56  *
57  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
58  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
61  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
65  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67  * SUCH DAMAGE.
68  *
69  *      @(#)if_llc.h    8.1 (Berkeley) 6/10/93
70  * $FreeBSD: src/sys/net/if_llc.h,v 1.9 2002/09/23 06:25:08 alfred Exp $
71  */
72
73 #ifndef _NET_IF_LLC_H_
74 #define _NET_IF_LLC_H_
75
76 /*
77  * IEEE 802.2 Link Level Control headers, for use in conjunction with
78  * 802.{3,4,5} media access control methods.
79  *
80  * Headers here do not use bit fields due to shortcommings in many
81  * compilers.
82  */
83
84 struct llc {
85         a_uint8_t llc_dsap;
86         a_uint8_t llc_ssap;
87         union {
88             struct {
89                 a_uint8_t control;
90                 a_uint8_t format_id;
91                 a_uint8_t class;
92                 a_uint8_t window_x2;
93             } adf_os_packed type_u;
94             struct {
95                 a_uint8_t num_snd_x2;
96                 a_uint8_t num_rcv_x2;
97             } adf_os_packed type_i;
98             struct {
99                 a_uint8_t control;
100                 a_uint8_t num_rcv_x2;
101             } adf_os_packed type_s;
102             struct {
103                 a_uint8_t control;
104                 /*
105                  * We cannot put the following fields in a structure because
106                  * the structure rounding might cause padding.
107                  */
108                 a_uint8_t frmr_rej_pdu0;
109                 a_uint8_t frmr_rej_pdu1;
110                 a_uint8_t frmr_control;
111                 a_uint8_t frmr_control_ext;
112                 a_uint8_t frmr_cause;
113             } adf_os_packed type_frmr;
114             struct {
115                 a_uint8_t  control;
116                 a_uint8_t  org_code[3];
117                 a_uint16_t ether_type;
118             } adf_os_packed type_snap;
119             struct {
120                 a_uint8_t control;
121                 a_uint8_t control_ext;
122             } adf_os_packed type_raw;
123         } llc_un /* XXX adf_os_packed ??? */;
124 } adf_os_packed;
125
126 struct frmrinfo {
127         a_uint8_t frmr_rej_pdu0;
128         a_uint8_t frmr_rej_pdu1;
129         a_uint8_t frmr_control;
130         a_uint8_t frmr_control_ext;
131         a_uint8_t frmr_cause;
132 } adf_os_packed;
133
134 #define llc_control             llc_un.type_u.control
135 #define llc_control_ext         llc_un.type_raw.control_ext
136 #define llc_fid                 llc_un.type_u.format_id
137 #define llc_class               llc_un.type_u.class
138 #define llc_window              llc_un.type_u.window_x2
139 #define llc_frmrinfo            llc_un.type_frmr.frmr_rej_pdu0
140 #define llc_frmr_pdu0           llc_un.type_frmr.frmr_rej_pdu0
141 #define llc_frmr_pdu1           llc_un.type_frmr.frmr_rej_pdu1
142 #define llc_frmr_control        llc_un.type_frmr.frmr_control
143 #define llc_frmr_control_ext    llc_un.type_frmr.frmr_control_ext
144 #define llc_frmr_cause          llc_un.type_frmr.frmr_cause
145 #define llc_snap                llc_un.type_snap
146
147 /*
148  * Don't use sizeof(struct llc_un) for LLC header sizes
149  */
150 #define LLC_ISFRAMELEN 4
151 #define LLC_UFRAMELEN  3
152 #define LLC_FRMRLEN    7
153 #define LLC_SNAPFRAMELEN 8
154
155 /*
156  * Unnumbered LLC format commands
157  */
158 #define LLC_UI          0x3
159 #define LLC_UI_P        0x13
160 #define LLC_DISC        0x43
161 #define LLC_DISC_P      0x53
162 #define LLC_UA          0x63
163 #define LLC_UA_P        0x73
164 #define LLC_TEST        0xe3
165 #define LLC_TEST_P      0xf3
166 #define LLC_FRMR        0x87
167 #define LLC_FRMR_P      0x97
168 #define LLC_DM          0x0f
169 #define LLC_DM_P        0x1f
170 #define LLC_XID         0xaf
171 #define LLC_XID_P       0xbf
172 #define LLC_SABME       0x6f
173 #define LLC_SABME_P     0x7f
174
175 /*
176  * Supervisory LLC commands
177  */
178 #define LLC_RR          0x01
179 #define LLC_RNR         0x05
180 #define LLC_REJ         0x09
181
182 /*
183  * Info format - dummy only
184  */
185 #define LLC_INFO        0x00
186
187 /*
188  * ISO PDTR 10178 contains among others
189  */
190 #define LLC_X25_LSAP    0x7e
191 #define LLC_SNAP_LSAP   0xaa
192 #define LLC_ISO_LSAP    0xfe
193
194 #endif /* _NET_IF_LLC_H_ */