Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171711
b: refs/heads/master
c: c9b1417
h: refs/heads/master
i:
  171709: fe9a4f1
  171707: f6dc438
  171703: d9e82a9
  171695: ab671c2
  171679: 0f87e47
  171647: 7a3f93d
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Nov 11, 2009
1 parent c2c7bb9 commit 0153afb
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc1e001bf498a19dcb46676d933cd0e92dc53ef3
refs/heads/master: c9b1417055cd2518e8a3b4b27e1f8e4b72821dff
89 changes: 52 additions & 37 deletions trunk/drivers/net/wireless/ath/ath9k/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,55 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,
return 0;
}

static void ath9k_rx_skb_postprocess(struct ath_common *common,
struct sk_buff *skb,
struct ath_rx_status *rx_stats,
struct ieee80211_rx_status *rxs,
bool decrypt_error)
{
struct ath_hw *ah = common->ah;
struct ieee80211_hdr *hdr;
int hdrlen, padsize;
u8 keyix;
__le16 fc;

/* see if any padding is done by the hw and remove it */
hdr = (struct ieee80211_hdr *) skb->data;
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
fc = hdr->frame_control;

/* The MAC header is padded to have 32-bit boundary if the
* packet payload is non-zero. The general calculation for
* padsize would take into account odd header lengths:
* padsize = (4 - hdrlen % 4) % 4; However, since only
* even-length headers are used, padding can only be 0 or 2
* bytes and we can optimize this a bit. In addition, we must
* not try to remove padding from short control frames that do
* not have payload. */
padsize = hdrlen & 3;
if (padsize && hdrlen >= 24) {
memmove(skb->data + padsize, skb->data, hdrlen);
skb_pull(skb, padsize);
}

keyix = rx_stats->rs_keyix;

if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) {
rxs->flag |= RX_FLAG_DECRYPTED;
} else if (ieee80211_has_protected(fc)
&& !decrypt_error && skb->len >= hdrlen + 4) {
keyix = skb->data[hdrlen + 3] >> 6;

if (test_bit(keyix, common->keymap))
rxs->flag |= RX_FLAG_DECRYPTED;
}
if (ah->sw_mgmt_crypto &&
(rxs->flag & RX_FLAG_DECRYPTED) &&
ieee80211_is_mgmt(fc))
/* Use software decrypt for management frames. */
rxs->flag &= ~RX_FLAG_DECRYPTED;
}

static void ath_opmode_init(struct ath_softc *sc)
{
struct ath_hw *ah = sc->sc_ah;
Expand Down Expand Up @@ -716,10 +765,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
*/
struct ieee80211_hw *hw = NULL;
struct ieee80211_hdr *hdr;
int hdrlen, padsize, retval;
int retval;
bool decrypt_error = false;
u8 keyix;
__le16 fc;

spin_lock_bh(&sc->rx.rxbuflock);

Expand Down Expand Up @@ -830,40 +877,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)

skb_put(skb, rx_stats->rs_datalen);

/* see if any padding is done by the hw and remove it */
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
fc = hdr->frame_control;

/* The MAC header is padded to have 32-bit boundary if the
* packet payload is non-zero. The general calculation for
* padsize would take into account odd header lengths:
* padsize = (4 - hdrlen % 4) % 4; However, since only
* even-length headers are used, padding can only be 0 or 2
* bytes and we can optimize this a bit. In addition, we must
* not try to remove padding from short control frames that do
* not have payload. */
padsize = hdrlen & 3;
if (padsize && hdrlen >= 24) {
memmove(skb->data + padsize, skb->data, hdrlen);
skb_pull(skb, padsize);
}

keyix = rx_stats->rs_keyix;

if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) {
rxs->flag |= RX_FLAG_DECRYPTED;
} else if (ieee80211_has_protected(fc)
&& !decrypt_error && skb->len >= hdrlen + 4) {
keyix = skb->data[hdrlen + 3] >> 6;

if (test_bit(keyix, common->keymap))
rxs->flag |= RX_FLAG_DECRYPTED;
}
if (ah->sw_mgmt_crypto &&
(rxs->flag & RX_FLAG_DECRYPTED) &&
ieee80211_is_mgmt(fc))
/* Use software decrypt for management frames. */
rxs->flag &= ~RX_FLAG_DECRYPTED;
ath9k_rx_skb_postprocess(common, skb, rx_stats,
rxs, decrypt_error);

/* We will now give hardware our shiny new allocated skb */
bf->bf_mpdu = requeue_skb;
Expand Down

0 comments on commit 0153afb

Please sign in to comment.