summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/common.c
diff options
context:
space:
mode:
authorBenoit Papillault <benoit.papillault@free.fr>2009-11-24 15:49:18 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-11-28 15:04:50 -0500
commit1bc1488067ee2c295b933ef6decd6035230f1a1c (patch)
tree3e378bdeee251367d08fec654056e046b9853c6b /drivers/net/wireless/ath/ath9k/common.c
parente7824a50662f7f79b1a739f705b4d906c31cf221 (diff)
downloadop-kernel-dev-1bc1488067ee2c295b933ef6decd6035230f1a1c.zip
op-kernel-dev-1bc1488067ee2c295b933ef6decd6035230f1a1c.tar.gz
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>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/common.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index d96751c..4d775ae 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -236,16 +236,8 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
/* 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);
- padpos = 24;
fc = hdr->frame_control;
- if ((fc & cpu_to_le16(IEEE80211_FCTL_FROMDS|IEEE80211_FCTL_TODS)) ==
- cpu_to_le16(IEEE80211_FCTL_FROMDS|IEEE80211_FCTL_TODS)) {
- padpos += 6; /* ETH_ALEN */
- }
- if ((fc & cpu_to_le16(IEEE80211_STYPE_QOS_DATA|IEEE80211_FCTL_FTYPE)) ==
- cpu_to_le16(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) {
- padpos += 2;
- }
+ padpos = ath9k_cmn_padpos(hdr->frame_control);
/* The MAC header is padded to have 32-bit boundary if the
* packet payload is non-zero. The general calculation for
@@ -280,6 +272,20 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
}
EXPORT_SYMBOL(ath9k_cmn_rx_skb_postprocess);
+int ath9k_cmn_padpos(__le16 frame_control)
+{
+ int padpos = 24;
+ if (ieee80211_has_a4(frame_control)) {
+ padpos += ETH_ALEN;
+ }
+ if (ieee80211_is_data_qos(frame_control)) {
+ padpos += IEEE80211_QOS_CTL_LEN;
+ }
+
+ return padpos;
+}
+EXPORT_SYMBOL(ath9k_cmn_padpos);
+
static int __init ath9k_cmn_init(void)
{
return 0;
OpenPOWER on IntegriCloud