b43: use frame control helpers

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Harvey Harrison 2008-06-14 23:33:39 -07:00 committed by John W. Linville
parent 8536582059
commit f37d923422

View file

@ -193,7 +193,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
const struct ieee80211_hdr *wlhdr = const struct ieee80211_hdr *wlhdr =
(const struct ieee80211_hdr *)fragment_data; (const struct ieee80211_hdr *)fragment_data;
int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)); int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT));
u16 fctl = le16_to_cpu(wlhdr->frame_control); __le16 fctl = wlhdr->frame_control;
struct ieee80211_rate *fbrate; struct ieee80211_rate *fbrate;
u8 rate, rate_fb; u8 rate, rate_fb;
int rate_ofdm, rate_fb_ofdm; int rate_ofdm, rate_fb_ofdm;
@ -259,7 +259,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
B43_TXH_MAC_KEYIDX; B43_TXH_MAC_KEYIDX;
mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
B43_TXH_MAC_KEYALG; B43_TXH_MAC_KEYALG;
wlhdr_len = ieee80211_get_hdrlen(fctl); wlhdr_len = ieee80211_hdrlen(fctl);
iv_len = min((size_t) info->control.iv_len, iv_len = min((size_t) info->control.iv_len,
ARRAY_SIZE(txhdr->iv)); ARRAY_SIZE(txhdr->iv));
memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
@ -317,8 +317,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
/* MAC control */ /* MAC control */
if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
mac_ctl |= B43_TXH_MAC_ACK; mac_ctl |= B43_TXH_MAC_ACK;
if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && if (!ieee80211_is_pspoll(fctl))
((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
mac_ctl |= B43_TXH_MAC_HWSEQ; mac_ctl |= B43_TXH_MAC_HWSEQ;
if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
mac_ctl |= B43_TXH_MAC_STMSDU; mac_ctl |= B43_TXH_MAC_STMSDU;
@ -509,7 +508,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
struct b43_plcp_hdr6 *plcp; struct b43_plcp_hdr6 *plcp;
struct ieee80211_hdr *wlhdr; struct ieee80211_hdr *wlhdr;
const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
u16 fctl; __le16 fctl;
u16 phystat0, phystat3, chanstat, mactime; u16 phystat0, phystat3, chanstat, mactime;
u32 macstat; u32 macstat;
u16 chanid; u16 chanid;
@ -549,7 +548,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
goto drop; goto drop;
} }
wlhdr = (struct ieee80211_hdr *)(skb->data); wlhdr = (struct ieee80211_hdr *)(skb->data);
fctl = le16_to_cpu(wlhdr->frame_control); fctl = wlhdr->frame_control;
if (macstat & B43_RX_MAC_DEC) { if (macstat & B43_RX_MAC_DEC) {
unsigned int keyidx; unsigned int keyidx;
@ -564,7 +563,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
B43_WARN_ON(keyidx >= dev->max_nr_keys); B43_WARN_ON(keyidx >= dev->max_nr_keys);
if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) {
wlhdr_len = ieee80211_get_hdrlen(fctl); wlhdr_len = ieee80211_hdrlen(fctl);
if (unlikely(skb->len < (wlhdr_len + 3))) { if (unlikely(skb->len < (wlhdr_len + 3))) {
b43dbg(dev->wl, b43dbg(dev->wl,
"RX: Packet size underrun (3)\n"); "RX: Packet size underrun (3)\n");
@ -604,9 +603,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
* of timestamp, i.e. about 65 milliseconds after the PHY received * of timestamp, i.e. about 65 milliseconds after the PHY received
* the first symbol. * the first symbol.
*/ */
if (((fctl & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) {
== (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) ||
dev->wl->radiotap_enabled) {
u16 low_mactime_now; u16 low_mactime_now;
b43_tsf_read(dev, &status.mactime); b43_tsf_read(dev, &status.mactime);