ath9k: Proper padding/unpadding for the TX/RX path.

Software padding is done on the TX path and software unpadding is done on the
RX path. This patch corrects the position where the padding occurs. A specific
function computes the pad position and this function is used in the TX and RX
path. This patch has been tested by generating every possible 802.11 frames
with every possible frame_control field and a varying length. This patch is
useful for analyzing non standard 802.11 frames going over the air

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Benoit Papillault
2009-11-24 15:49:18 +01:00
committed by John W. Linville
parent e7824a5066
commit 1bc1488067
4 changed files with 31 additions and 18 deletions

View File

@@ -1596,6 +1596,7 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
int hdrlen;
__le16 fc;
int padpos, padsize;
tx_info->pad[0] = 0;
switch (txctl->frame_type) {
@@ -1614,7 +1615,13 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
ATH_TXBUF_RESET(bf);
bf->aphy = aphy;
bf->bf_frmlen = skb->len + FCS_LEN - (hdrlen & 3);
bf->bf_frmlen = skb->len + FCS_LEN;
/* Remove the padding size from bf_frmlen, if any */
padpos = ath9k_cmn_padpos(hdr->frame_control);
padsize = padpos & 3;
if (padsize && skb->len>padpos+padsize) {
bf->bf_frmlen -= padsize;
}
if (conf_is_ht(&hw->conf) && !is_pae(skb))
bf->bf_state.bf_type |= BUF_HT;