aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-01-29 11:07:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:21 -0500
commit38f3714d66b5679aee2a4fe23b1235c3829fcce4 (patch)
tree375e30764e348fd4afb4babb3a54b056e3332894 /net/mac80211
parent145de9b693943f052c2c15efbc31b2851fedb6e0 (diff)
mac80211: dissolve pre-rx handlers
These handlers do not really return a status and the compiler can do a much better job when they're simply static functions that it can inline if appropriate. Also makes the code shorter. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ieee80211.c1
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/rx.c96
3 files changed, 37 insertions, 62 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index f8e734f0da1a..3961d4c4320c 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1407,7 +1407,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
1407 local->hw.queues = 1; /* default */ 1407 local->hw.queues = 1; /* default */
1408 1408
1409 local->mdev = mdev; 1409 local->mdev = mdev;
1410 local->rx_pre_handlers = ieee80211_rx_pre_handlers;
1411 local->rx_handlers = ieee80211_rx_handlers; 1410 local->rx_handlers = ieee80211_rx_handlers;
1412 local->tx_handlers = ieee80211_tx_handlers; 1411 local->tx_handlers = ieee80211_tx_handlers;
1413 1412
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index cfd0717c0033..9d09ba8cc02b 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -480,7 +480,6 @@ struct ieee80211_local {
480 * deliver multicast frames both back to wireless 480 * deliver multicast frames both back to wireless
481 * media and to the local net stack */ 481 * media and to the local net stack */
482 482
483 ieee80211_rx_handler *rx_pre_handlers;
484 ieee80211_rx_handler *rx_handlers; 483 ieee80211_rx_handler *rx_handlers;
485 ieee80211_tx_handler *tx_handlers; 484 ieee80211_tx_handler *tx_handlers;
486 485
@@ -816,7 +815,6 @@ void ieee80211_regdomain_init(void);
816void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode); 815void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
817 816
818/* rx handling */ 817/* rx handling */
819extern ieee80211_rx_handler ieee80211_rx_pre_handlers[];
820extern ieee80211_rx_handler ieee80211_rx_handlers[]; 818extern ieee80211_rx_handler ieee80211_rx_handlers[];
821 819
822/* tx handling */ 820/* tx handling */
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 535407d07fa4..3aae8e9e4e0a 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -249,15 +249,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
249} 249}
250 250
251 251
252/* pre-rx handlers 252static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx)
253 *
254 * these don't have dev/sdata fields in the rx data
255 * The sta value should also not be used because it may
256 * be NULL even though a STA (in IBSS mode) will be added.
257 */
258
259static ieee80211_txrx_result
260ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
261{ 253{
262 u8 *data = rx->skb->data; 254 u8 *data = rx->skb->data;
263 int tid; 255 int tid;
@@ -290,8 +282,40 @@ ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
290 /* Set skb->priority to 1d tag if highest order bit of TID is not set. 282 /* Set skb->priority to 1d tag if highest order bit of TID is not set.
291 * For now, set skb->priority to 0 for other cases. */ 283 * For now, set skb->priority to 0 for other cases. */
292 rx->skb->priority = (tid > 7) ? 0 : tid; 284 rx->skb->priority = (tid > 7) ? 0 : tid;
285}
293 286
294 return TXRX_CONTINUE; 287static void ieee80211_verify_ip_alignment(struct ieee80211_txrx_data *rx)
288{
289#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
290 int hdrlen;
291
292 if (!WLAN_FC_DATA_PRESENT(rx->fc))
293 return;
294
295 /*
296 * Drivers are required to align the payload data in a way that
297 * guarantees that the contained IP header is aligned to a four-
298 * byte boundary. In the case of regular frames, this simply means
299 * aligning the payload to a four-byte boundary (because either
300 * the IP header is directly contained, or IV/RFC1042 headers that
301 * have a length divisible by four are in front of it.
302 *
303 * With A-MSDU frames, however, the payload data address must
304 * yield two modulo four because there are 14-byte 802.3 headers
305 * within the A-MSDU frames that push the IP header further back
306 * to a multiple of four again. Thankfully, the specs were sane
307 * enough this time around to require padding each A-MSDU subframe
308 * to a length that is a multiple of four.
309 *
310 * Padding like atheros hardware adds which is inbetween the 802.11
311 * header and the payload is not supported, the driver is required
312 * to move the 802.11 header further back in that case.
313 */
314 hdrlen = ieee80211_get_hdrlen(rx->fc);
315 if (rx->flags & IEEE80211_TXRXD_RX_AMSDU)
316 hdrlen += ETH_HLEN;
317 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3);
318#endif
295} 319}
296 320
297 321
@@ -340,52 +364,6 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
340 return load; 364 return load;
341} 365}
342 366
343#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
344static ieee80211_txrx_result
345ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx)
346{
347 int hdrlen;
348
349 if (!WLAN_FC_DATA_PRESENT(rx->fc))
350 return TXRX_CONTINUE;
351
352 /*
353 * Drivers are required to align the payload data in a way that
354 * guarantees that the contained IP header is aligned to a four-
355 * byte boundary. In the case of regular frames, this simply means
356 * aligning the payload to a four-byte boundary (because either
357 * the IP header is directly contained, or IV/RFC1042 headers that
358 * have a length divisible by four are in front of it.
359 *
360 * With A-MSDU frames, however, the payload data address must
361 * yield two modulo four because there are 14-byte 802.3 headers
362 * within the A-MSDU frames that push the IP header further back
363 * to a multiple of four again. Thankfully, the specs were sane
364 * enough this time around to require padding each A-MSDU subframe
365 * to a length that is a multiple of four.
366 *
367 * Padding like atheros hardware adds which is inbetween the 802.11
368 * header and the payload is not supported, the driver is required
369 * to move the 802.11 header further back in that case.
370 */
371 hdrlen = ieee80211_get_hdrlen(rx->fc);
372 if (rx->flags & IEEE80211_TXRXD_RX_AMSDU)
373 hdrlen += ETH_HLEN;
374 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3);
375
376 return TXRX_CONTINUE;
377}
378#endif
379
380ieee80211_rx_handler ieee80211_rx_pre_handlers[] =
381{
382 ieee80211_rx_h_parse_qos,
383#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
384 ieee80211_rx_h_verify_ip_alignment,
385#endif
386 NULL
387};
388
389/* rx handlers */ 367/* rx handlers */
390 368
391static ieee80211_txrx_result 369static ieee80211_txrx_result
@@ -1747,9 +1725,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1747 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning)) 1725 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning))
1748 rx.flags |= IEEE80211_TXRXD_RXIN_SCAN; 1726 rx.flags |= IEEE80211_TXRXD_RXIN_SCAN;
1749 1727
1750 if (__ieee80211_invoke_rx_handlers(local, local->rx_pre_handlers, &rx, 1728 ieee80211_parse_qos(&rx);
1751 sta) != TXRX_CONTINUE) 1729 ieee80211_verify_ip_alignment(&rx);
1752 goto end; 1730
1753 skb = rx.skb; 1731 skb = rx.skb;
1754 1732
1755 if (sta && !(sta->flags & (WLAN_STA_WDS | WLAN_STA_ASSOC_AP)) && 1733 if (sta && !(sta->flags & (WLAN_STA_WDS | WLAN_STA_ASSOC_AP)) &&