]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.10/ath5k-use-correct-packet-type-when-transmitting.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.10 / ath5k-use-correct-packet-type-when-transmitting.patch
CommitLineData
c721e1e5
GKH
1From 2ac2927a953a01c83df255118922cce1523d1a18 Mon Sep 17 00:00:00 2001
2From: Bob Copeland <me@bobcopeland.com>
3Date: Tue, 9 Feb 2010 13:06:54 -0500
4Subject: ath5k: use correct packet type when transmitting
5
6From: Bob Copeland <me@bobcopeland.com>
7
8commit 2ac2927a953a01c83df255118922cce1523d1a18 upstream.
9
10The hardware needs to know what type of frames are being
11sent in order to fill in various fields, for example the
12timestamp in probe responses (before this patch, it was
13always 0). Set it correctly when initializing the TX
14descriptor.
15
16Signed-off-by: Bob Copeland <me@bobcopeland.com>
17Signed-off-by: John W. Linville <linville@tuxdriver.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19
20---
21 drivers/net/wireless/ath/ath5k/ath5k.h | 1 -
22 drivers/net/wireless/ath/ath5k/base.c | 26 +++++++++++++++++++++++++-
23 2 files changed, 25 insertions(+), 2 deletions(-)
24
25--- a/drivers/net/wireless/ath/ath5k/ath5k.h
26+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
27@@ -546,7 +546,6 @@ struct ath5k_txq_info {
28 /*
29 * Transmit packet types.
30 * used on tx control descriptor
31- * TODO: Use them inside base.c corectly
32 */
33 enum ath5k_pkt_type {
34 AR5K_PKT_TYPE_NORMAL = 0,
35--- a/drivers/net/wireless/ath/ath5k/base.c
36+++ b/drivers/net/wireless/ath/ath5k/base.c
37@@ -1220,6 +1220,29 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc
38 return 0;
39 }
40
41+static enum ath5k_pkt_type get_hw_packet_type(struct sk_buff *skb)
42+{
43+ struct ieee80211_hdr *hdr;
44+ enum ath5k_pkt_type htype;
45+ __le16 fc;
46+
47+ hdr = (struct ieee80211_hdr *)skb->data;
48+ fc = hdr->frame_control;
49+
50+ if (ieee80211_is_beacon(fc))
51+ htype = AR5K_PKT_TYPE_BEACON;
52+ else if (ieee80211_is_probe_resp(fc))
53+ htype = AR5K_PKT_TYPE_PROBE_RESP;
54+ else if (ieee80211_is_atim(fc))
55+ htype = AR5K_PKT_TYPE_ATIM;
56+ else if (ieee80211_is_pspoll(fc))
57+ htype = AR5K_PKT_TYPE_PSPOLL;
58+ else
59+ htype = AR5K_PKT_TYPE_NORMAL;
60+
61+ return htype;
62+}
63+
64 static int
65 ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
66 struct ath5k_txq *txq)
67@@ -1274,7 +1297,8 @@ ath5k_txbuf_setup(struct ath5k_softc *sc
68 sc->vif, pktlen, info));
69 }
70 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
71- ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
72+ ieee80211_get_hdrlen_from_skb(skb),
73+ get_hw_packet_type(skb),
74 (sc->power_level * 2),
75 hw_rate,
76 info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags,