diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-06-15 02:33:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-26 16:49:13 -0400 |
commit | 85365820590e2fb54684c7163047f866ccbf4760 (patch) | |
tree | e6be27b9109fdf017da9e555e190b4dae3c730a9 | |
parent | 24b56e705587cd3a51efb1229e73ea6e3e757f05 (diff) |
zd1211rw: use frame control helpers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 6d86b365f150..317c5e24f80c 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -376,8 +376,6 @@ static int zd_calc_tx_length_us(u8 *service, u8 zd_rate, u16 tx_length) | |||
376 | static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, | 376 | static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, |
377 | struct ieee80211_hdr *header, u32 flags) | 377 | struct ieee80211_hdr *header, u32 flags) |
378 | { | 378 | { |
379 | u16 fctl = le16_to_cpu(header->frame_control); | ||
380 | |||
381 | /* | 379 | /* |
382 | * CONTROL TODO: | 380 | * CONTROL TODO: |
383 | * - if backoff needed, enable bit 0 | 381 | * - if backoff needed, enable bit 0 |
@@ -395,8 +393,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, | |||
395 | cs->control |= ZD_CS_MULTICAST; | 393 | cs->control |= ZD_CS_MULTICAST; |
396 | 394 | ||
397 | /* PS-POLL */ | 395 | /* PS-POLL */ |
398 | if ((fctl & (IEEE80211_FCTL_FTYPE|IEEE80211_FCTL_STYPE)) == | 396 | if (ieee80211_is_pspoll(header->frame_control)) |
399 | (IEEE80211_FTYPE_CTL|IEEE80211_STYPE_PSPOLL)) | ||
400 | cs->control |= ZD_CS_PS_POLL_FRAME; | 397 | cs->control |= ZD_CS_PS_POLL_FRAME; |
401 | 398 | ||
402 | if (flags & IEEE80211_TX_CTL_USE_RTS_CTS) | 399 | if (flags & IEEE80211_TX_CTL_USE_RTS_CTS) |
@@ -550,13 +547,11 @@ static int zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
550 | static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr, | 547 | static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr, |
551 | struct ieee80211_rx_status *stats) | 548 | struct ieee80211_rx_status *stats) |
552 | { | 549 | { |
553 | u16 fc = le16_to_cpu(rx_hdr->frame_control); | ||
554 | struct sk_buff *skb; | 550 | struct sk_buff *skb; |
555 | struct sk_buff_head *q; | 551 | struct sk_buff_head *q; |
556 | unsigned long flags; | 552 | unsigned long flags; |
557 | 553 | ||
558 | if ((fc & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) != | 554 | if (!ieee80211_is_ack(rx_hdr->frame_control)) |
559 | (IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK)) | ||
560 | return 0; | 555 | return 0; |
561 | 556 | ||
562 | q = &zd_hw_mac(hw)->ack_wait_queue; | 557 | q = &zd_hw_mac(hw)->ack_wait_queue; |
@@ -584,8 +579,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
584 | const struct rx_status *status; | 579 | const struct rx_status *status; |
585 | struct sk_buff *skb; | 580 | struct sk_buff *skb; |
586 | int bad_frame = 0; | 581 | int bad_frame = 0; |
587 | u16 fc; | 582 | __le16 fc; |
588 | bool is_qos, is_4addr, need_padding; | 583 | int need_padding; |
589 | int i; | 584 | int i; |
590 | u8 rate; | 585 | u8 rate; |
591 | 586 | ||
@@ -644,13 +639,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
644 | && !mac->pass_ctrl) | 639 | && !mac->pass_ctrl) |
645 | return 0; | 640 | return 0; |
646 | 641 | ||
647 | fc = le16_to_cpu(*((__le16 *) buffer)); | 642 | fc = *(__le16 *)buffer; |
648 | 643 | need_padding = ieee80211_is_data_qos(fc) ^ ieee80211_has_a4(fc); | |
649 | is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && | ||
650 | (fc & IEEE80211_STYPE_QOS_DATA); | ||
651 | is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | ||
652 | (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); | ||
653 | need_padding = is_qos ^ is_4addr; | ||
654 | 644 | ||
655 | skb = dev_alloc_skb(length + (need_padding ? 2 : 0)); | 645 | skb = dev_alloc_skb(length + (need_padding ? 2 : 0)); |
656 | if (skb == NULL) | 646 | if (skb == NULL) |