ath9k_htc: Update to upstream's commit d19607454d656cb14d8c16dfbf161eebb542e8fe dated...
[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  * 3. All advertising materials mentioning features or use of this software
54  *    must display the following acknowledgement:
55  *      This product includes software developed by the University of
56  *      California, Berkeley and its contributors.
57  * 4. Neither the name of the University nor the names of its contributors
58  *    may be used to endorse or promote products derived from this software
59  *    without specific prior written permission.
60  *
61  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
62  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
65  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
66  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
67  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
70  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71  * SUCH DAMAGE.
72  *
73  *      @(#)if_llc.h    8.1 (Berkeley) 6/10/93
74  * $FreeBSD: src/sys/net/if_llc.h,v 1.9 2002/09/23 06:25:08 alfred Exp $
75  */
76
77 #ifndef _NET_IF_LLC_H_
78 #define _NET_IF_LLC_H_
79
80 /*
81  * IEEE 802.2 Link Level Control headers, for use in conjunction with
82  * 802.{3,4,5} media access control methods.
83  *
84  * Headers here do not use bit fields due to shortcommings in many
85  * compilers.
86  */
87
88 struct llc {
89         a_uint8_t llc_dsap;
90         a_uint8_t llc_ssap;
91         union {
92             struct {
93                 a_uint8_t control;
94                 a_uint8_t format_id;
95                 a_uint8_t class;
96                 a_uint8_t window_x2;
97             } adf_os_packed type_u;
98             struct {
99                 a_uint8_t num_snd_x2;
100                 a_uint8_t num_rcv_x2;
101             } adf_os_packed type_i;
102             struct {
103                 a_uint8_t control;
104                 a_uint8_t num_rcv_x2;
105             } adf_os_packed type_s;
106             struct {
107                 a_uint8_t control;
108                 /*
109                  * We cannot put the following fields in a structure because
110                  * the structure rounding might cause padding.
111                  */
112                 a_uint8_t frmr_rej_pdu0;
113                 a_uint8_t frmr_rej_pdu1;
114                 a_uint8_t frmr_control;
115                 a_uint8_t frmr_control_ext;
116                 a_uint8_t frmr_cause;
117             } adf_os_packed type_frmr;
118             struct {
119                 a_uint8_t  control;
120                 a_uint8_t  org_code[3];
121                 a_uint16_t ether_type;
122             } adf_os_packed type_snap;
123             struct {
124                 a_uint8_t control;
125                 a_uint8_t control_ext;
126             } adf_os_packed type_raw;
127         } llc_un /* XXX adf_os_packed ??? */;
128 } adf_os_packed;
129
130 struct frmrinfo {
131         a_uint8_t frmr_rej_pdu0;
132         a_uint8_t frmr_rej_pdu1;
133         a_uint8_t frmr_control;
134         a_uint8_t frmr_control_ext;
135         a_uint8_t frmr_cause;
136 } adf_os_packed;
137
138 #define llc_control             llc_un.type_u.control
139 #define llc_control_ext         llc_un.type_raw.control_ext
140 #define llc_fid                 llc_un.type_u.format_id
141 #define llc_class               llc_un.type_u.class
142 #define llc_window              llc_un.type_u.window_x2
143 #define llc_frmrinfo            llc_un.type_frmr.frmr_rej_pdu0
144 #define llc_frmr_pdu0           llc_un.type_frmr.frmr_rej_pdu0
145 #define llc_frmr_pdu1           llc_un.type_frmr.frmr_rej_pdu1
146 #define llc_frmr_control        llc_un.type_frmr.frmr_control
147 #define llc_frmr_control_ext    llc_un.type_frmr.frmr_control_ext
148 #define llc_frmr_cause          llc_un.type_frmr.frmr_cause
149 #define llc_snap                llc_un.type_snap
150
151 /*
152  * Don't use sizeof(struct llc_un) for LLC header sizes
153  */
154 #define LLC_ISFRAMELEN 4
155 #define LLC_UFRAMELEN  3
156 #define LLC_FRMRLEN    7
157 #define LLC_SNAPFRAMELEN 8
158
159 /*
160  * Unnumbered LLC format commands
161  */
162 #define LLC_UI          0x3
163 #define LLC_UI_P        0x13
164 #define LLC_DISC        0x43
165 #define LLC_DISC_P      0x53
166 #define LLC_UA          0x63
167 #define LLC_UA_P        0x73
168 #define LLC_TEST        0xe3
169 #define LLC_TEST_P      0xf3
170 #define LLC_FRMR        0x87
171 #define LLC_FRMR_P      0x97
172 #define LLC_DM          0x0f
173 #define LLC_DM_P        0x1f
174 #define LLC_XID         0xaf
175 #define LLC_XID_P       0xbf
176 #define LLC_SABME       0x6f
177 #define LLC_SABME_P     0x7f
178
179 /*
180  * Supervisory LLC commands
181  */
182 #define LLC_RR          0x01
183 #define LLC_RNR         0x05
184 #define LLC_REJ         0x09
185
186 /*
187  * Info format - dummy only
188  */
189 #define LLC_INFO        0x00
190
191 /*
192  * ISO PDTR 10178 contains among others
193  */
194 #define LLC_X25_LSAP    0x7e
195 #define LLC_SNAP_LSAP   0xaa
196 #define LLC_ISO_LSAP    0xfe
197
198 #endif /* _NET_IF_LLC_H_ */