aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/323-rt2x00-support-get_tkip_seq-fix-TX-streams-rt2800.patch
blob: c2cb53994ea7e6efcbf4a75cf20548e37afed084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 0479f29b2d4d8e95eece75e9bfda9a6a5e7bc77e Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Sat, 14 Feb 2009 19:56:24 +0100
Subject: [PATCH] rt2x00: support get_tkip_seq, fix TX streams (rt2800usb)

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2800usb.c |   23 ++++++++++++++++++++++-
 drivers/net/wireless/rt2x00/rt2800usb.h |    6 ------
 2 files changed, 22 insertions(+), 7 deletions(-)

--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1465,6 +1465,8 @@ static int rt2800usb_init_registers(stru
 
 	rt2x00usb_register_read(rt2x00dev, TX_RTS_CFG, &reg);
 	rt2x00_set_field32(&reg, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32);
+	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES,
+			   IEEE80211_MAX_RTS_THRESHOLD);
 	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_FBK_EN, 0);
 	rt2x00usb_register_write(rt2x00dev, TX_RTS_CFG, reg);
 
@@ -2521,7 +2523,10 @@ static int rt2800usb_probe_hw_mode(struc
 	spec->ht.ampdu_factor = 3;
 	spec->ht.ampdu_density = 4;
 	spec->ht.mcs.tx_params =
-	    IEEE80211_HT_MCS_TX_DEFINED;
+	    IEEE80211_HT_MCS_TX_DEFINED |
+	    IEEE80211_HT_MCS_TX_RX_DIFF |
+	    ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
+		IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
 
 	switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
 	case 3:
@@ -2625,6 +2630,21 @@ static int rt2800usb_probe_hw(struct rt2
 /*
  * IEEE80211 stack callback functions.
  */
+static void rt2800usb_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
+				   u32 *iv32, u16 *iv16)
+{
+	struct rt2x00_dev *rt2x00dev = hw->priv;
+	struct mac_iveiv_entry iveiv_entry;
+	u32 offset;
+
+	offset = MAC_IVEIV_ENTRY(hw_key_idx);
+	rt2x00usb_register_multiread(rt2x00dev, offset,
+				      &iveiv_entry, sizeof(iveiv_entry));
+
+	memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16));
+	memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32));
+}
+
 static int rt2800usb_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -2754,6 +2774,7 @@ static const struct ieee80211_ops rt2800
 	.configure_filter	= rt2x00mac_configure_filter,
 	.set_key		= rt2x00mac_set_key,
 	.get_stats		= rt2x00mac_get_stats,
+	.get_tkip_seq		= rt2800usb_get_tkip_seq,
 	.set_rts_threshold	= rt2800usb_set_rts_threshold,
 	.bss_info_changed	= rt2x00mac_bss_info_changed,
 	.conf_tx		= rt2800usb_conf_tx,
--- a/drivers/net/wireless/rt2x00/rt2800usb.h
+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
@@ -1339,12 +1339,6 @@ struct mac_iveiv_entry {
 } __attribute__ ((packed));
 
 /*
- * MAC_IVEIV:
- */
-#define MAC_IVEIV_EIV			FIELD32(0x20000000)
-#define MAC_IVEIV_KEYIDX		FIELD32(0xc0000000)
-
-/*
  * MAC_WCID_ATTRIBUTE:
  */
 #define MAC_WCID_ATTRIBUTE_KEYTAB	FIELD32(0x00000001)