aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-07-15 21:44:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-22 16:29:54 -0400
commit358c8d9d332230b14e130b78a6930996cdbf84c2 (patch)
tree0a563e201e4c5fff9564579877ff0e5f0dd58294 /net/mac80211/tx.c
parente7827a7031a931c74c48e4a53f73ed862f0c8da0 (diff)
mac80211: use ieee80211 frame control directly
Remove the last users of the rx/tx_data->fc data members and use the le16 frame_control from the header directly. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 9c60dedc3687..96ffb4d8dfbb 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -82,6 +82,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
82 struct ieee80211_rate *txrate; 82 struct ieee80211_rate *txrate;
83 struct ieee80211_local *local = tx->local; 83 struct ieee80211_local *local = tx->local;
84 struct ieee80211_supported_band *sband; 84 struct ieee80211_supported_band *sband;
85 struct ieee80211_hdr *hdr;
85 86
86 sband = local->hw.wiphy->bands[tx->channel->band]; 87 sband = local->hw.wiphy->bands[tx->channel->band];
87 txrate = &sband->bitrates[tx->rate_idx]; 88 txrate = &sband->bitrates[tx->rate_idx];
@@ -107,8 +108,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
107 * at the highest possible rate belonging to the PHY rates in the 108 * at the highest possible rate belonging to the PHY rates in the
108 * BSSBasicRateSet 109 * BSSBasicRateSet
109 */ 110 */
110 111 hdr = (struct ieee80211_hdr *)tx->skb->data;
111 if ((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) { 112 if (ieee80211_is_ctl(hdr->frame_control)) {
112 /* TODO: These control frames are not currently sent by 113 /* TODO: These control frames are not currently sent by
113 * 80211.o, but should they be implemented, this function 114 * 80211.o, but should they be implemented, this function
114 * needs to be updated to support duration field calculation. 115 * needs to be updated to support duration field calculation.
@@ -213,9 +214,8 @@ static int inline is_ieee80211_device(struct net_device *dev,
213static ieee80211_tx_result debug_noinline 214static ieee80211_tx_result debug_noinline
214ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) 215ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
215{ 216{
216#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 217
217 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 218 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
218#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
219 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 219 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
220 u32 sta_flags; 220 u32 sta_flags;
221 221
@@ -223,8 +223,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
223 return TX_CONTINUE; 223 return TX_CONTINUE;
224 224
225 if (unlikely(tx->local->sta_sw_scanning) && 225 if (unlikely(tx->local->sta_sw_scanning) &&
226 ((tx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || 226 !ieee80211_is_probe_req(hdr->frame_control))
227 (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ))
228 return TX_DROP; 227 return TX_DROP;
229 228
230 if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) 229 if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
@@ -238,7 +237,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
238 if (likely(tx->flags & IEEE80211_TX_UNICAST)) { 237 if (likely(tx->flags & IEEE80211_TX_UNICAST)) {
239 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && 238 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) &&
240 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 239 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
241 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 240 ieee80211_is_data(hdr->frame_control))) {
242#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 241#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
243 DECLARE_MAC_BUF(mac); 242 DECLARE_MAC_BUF(mac);
244 printk(KERN_DEBUG "%s: dropped data frame to not " 243 printk(KERN_DEBUG "%s: dropped data frame to not "
@@ -249,7 +248,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
249 return TX_DROP; 248 return TX_DROP;
250 } 249 }
251 } else { 250 } else {
252 if (unlikely((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && 251 if (unlikely(ieee80211_is_data(hdr->frame_control) &&
253 tx->local->num_sta == 0 && 252 tx->local->num_sta == 0 &&
254 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS)) { 253 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS)) {
255 /* 254 /*
@@ -315,6 +314,7 @@ static ieee80211_tx_result
315ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) 314ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
316{ 315{
317 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 316 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
317 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
318 318
319 /* 319 /*
320 * broadcast/multicast frame 320 * broadcast/multicast frame
@@ -329,7 +329,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
329 return TX_CONTINUE; 329 return TX_CONTINUE;
330 330
331 /* no buffering for ordered frames */ 331 /* no buffering for ordered frames */
332 if (tx->fc & IEEE80211_FCTL_ORDER) 332 if (ieee80211_has_order(hdr->frame_control))
333 return TX_CONTINUE; 333 return TX_CONTINUE;
334 334
335 /* no stations in PS mode */ 335 /* no stations in PS mode */
@@ -367,12 +367,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
367{ 367{
368 struct sta_info *sta = tx->sta; 368 struct sta_info *sta = tx->sta;
369 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 369 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
370 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
370 u32 staflags; 371 u32 staflags;
371 DECLARE_MAC_BUF(mac); 372 DECLARE_MAC_BUF(mac);
372 373
373 if (unlikely(!sta || 374 if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control)))
374 ((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT &&
375 (tx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP)))
376 return TX_CONTINUE; 375 return TX_CONTINUE;
377 376
378 staflags = get_sta_flags(sta); 377 staflags = get_sta_flags(sta);
@@ -437,7 +436,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
437{ 436{
438 struct ieee80211_key *key; 437 struct ieee80211_key *key;
439 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 438 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
440 u16 fc = tx->fc; 439 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
441 440
442 if (unlikely(tx->skb->do_not_encrypt)) 441 if (unlikely(tx->skb->do_not_encrypt))
443 tx->key = NULL; 442 tx->key = NULL;
@@ -454,22 +453,16 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
454 tx->key = NULL; 453 tx->key = NULL;
455 454
456 if (tx->key) { 455 if (tx->key) {
457 u16 ftype, stype;
458
459 tx->key->tx_rx_count++; 456 tx->key->tx_rx_count++;
460 /* TODO: add threshold stuff again */ 457 /* TODO: add threshold stuff again */
461 458
462 switch (tx->key->conf.alg) { 459 switch (tx->key->conf.alg) {
463 case ALG_WEP: 460 case ALG_WEP:
464 ftype = fc & IEEE80211_FCTL_FTYPE; 461 if (ieee80211_is_auth(hdr->frame_control))
465 stype = fc & IEEE80211_FCTL_STYPE;
466
467 if (ftype == IEEE80211_FTYPE_MGMT &&
468 stype == IEEE80211_STYPE_AUTH)
469 break; 462 break;
470 case ALG_TKIP: 463 case ALG_TKIP:
471 case ALG_CCMP: 464 case ALG_CCMP:
472 if (!WLAN_FC_DATA_PRESENT(fc)) 465 if (!ieee80211_is_data_present(hdr->frame_control))
473 tx->key = NULL; 466 tx->key = NULL;
474 break; 467 break;
475 } 468 }