aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-helpers.h
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-06-11 17:21:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:18:12 -0400
commitfd7c8a40b2a63863f749e4d17f0d94d2e5ab1331 (patch)
tree098e07d68b4d1e7a6c02750db480204c0dd469d5 /drivers/net/wireless/iwlwifi/iwl-helpers.h
parente36cfdc9b17fa64245ee6206287e5120e59bbfca (diff)
mac80211: add helpers for frame control testing
A few general categories: 1) ieee80211_has_* tests if particular fctl bits are set, the helpers are de in the same order as the fctl defines: A combined _has_a4 was also added to test when both FROMDS and TODS are set. 2) ieee80211_is_* is meant to test whether the frame control is of a certain ftype - data, mgmt, ctl, and two special helpers _is_data_qos, _is_data_pres which also test a subset of the stype space. When testing for a particular stype applicable only to one ftype, functions like ieee80211_is_ack have been added. Note that the ftype is also being checked in these helpers. They have been added for all mgmt and ctl stypes in the same order as the STYPE defines. 3) ieee80211_get_* is meant to take a struct ieee80211_hdr * and returns a pointer to somewhere in the struct, see get_SA, get_DA, get_qos_ctl. The intel wireless drivers had helpers that used this namespace, convert the all to use the new helpers and remove the byteshifting as they were defined in cpu-order rather than little-endian. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-helpers.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h109
1 files changed, 0 insertions, 109 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index eec423a98fe6..41eed6793328 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -145,115 +145,6 @@ static inline struct ieee80211_conf *ieee80211_get_hw_conf(
145 return &hw->conf; 145 return &hw->conf;
146} 146}
147 147
148#define QOS_CONTROL_LEN 2
149
150
151static inline int ieee80211_is_management(u16 fc)
152{
153 return (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT;
154}
155
156static inline int ieee80211_is_control(u16 fc)
157{
158 return (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL;
159}
160
161static inline int ieee80211_is_data(u16 fc)
162{
163 return (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA;
164}
165
166static inline int ieee80211_is_back_request(u16 fc)
167{
168 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
169 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BACK_REQ);
170}
171
172static inline int ieee80211_is_probe_response(u16 fc)
173{
174 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
175 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP);
176}
177
178static inline int ieee80211_is_probe_request(u16 fc)
179{
180 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
181 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_REQ);
182}
183
184static inline int ieee80211_is_beacon(u16 fc)
185{
186 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
187 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON);
188}
189
190static inline int ieee80211_is_atim(u16 fc)
191{
192 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
193 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ATIM);
194}
195
196static inline int ieee80211_is_assoc_request(u16 fc)
197{
198 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
199 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ);
200}
201
202static inline int ieee80211_is_assoc_response(u16 fc)
203{
204 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
205 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_RESP);
206}
207
208static inline int ieee80211_is_auth(u16 fc)
209{
210 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
211 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ);
212}
213
214static inline int ieee80211_is_deauth(u16 fc)
215{
216 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
217 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ);
218}
219
220static inline int ieee80211_is_disassoc(u16 fc)
221{
222 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
223 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ);
224}
225
226static inline int ieee80211_is_reassoc_request(u16 fc)
227{
228 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
229 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_REQ);
230}
231
232static inline int ieee80211_is_reassoc_response(u16 fc)
233{
234 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
235 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_RESP);
236}
237
238static inline int ieee80211_is_qos_data(u16 fc)
239{
240 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
241 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA);
242}
243/**
244 * ieee80211_get_qos_ctrl - get pointer to the QoS control field
245 *
246 * This function returns the pointer to 802.11 header QoS field (2 bytes)
247 * This function doesn't check whether hdr is a QoS hdr, use with care
248 * @hdr: struct ieee80211_hdr *hdr
249 * @hdr_len: header length
250 */
251
252static inline u8 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr, int hdr_len)
253{
254 return ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
255}
256
257static inline int iwl_check_bits(unsigned long field, unsigned long mask) 148static inline int iwl_check_bits(unsigned long field, unsigned long mask)
258{ 149{
259 return ((field & mask) == mask) ? 1 : 0; 150 return ((field & mask) == mask) ? 1 : 0;