Commit b0a9ede2 authored by Rajkumar Manoharan's avatar Rajkumar Manoharan Committed by John W. Linville

ath: Speedup key set/reset ops for HTC driver

By enabling buffered register write for ath9k_htc driver
avoids unnecessary dissociation while rekeying phase under
heavy traffic exchange.
Signed-off-by: default avatarRajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 81544026
...@@ -23,6 +23,14 @@ ...@@ -23,6 +23,14 @@
#define REG_READ (common->ops->read) #define REG_READ (common->ops->read)
#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg) #define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)
#define ENABLE_REGWRITE_BUFFER(_ah) \
if (common->ops->enable_write_buffer) \
common->ops->enable_write_buffer((_ah));
#define REGWRITE_BUFFER_FLUSH(_ah) \
if (common->ops->write_flush) \
common->ops->write_flush((_ah));
#define IEEE80211_WEP_NKID 4 /* number of key ids */ #define IEEE80211_WEP_NKID 4 /* number of key ids */
...@@ -42,6 +50,8 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry) ...@@ -42,6 +50,8 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry)
keyType = REG_READ(ah, AR_KEYTABLE_TYPE(entry)); keyType = REG_READ(ah, AR_KEYTABLE_TYPE(entry));
ENABLE_REGWRITE_BUFFER(ah);
REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), 0); REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), 0); REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), 0); REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), 0);
...@@ -66,6 +76,8 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry) ...@@ -66,6 +76,8 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry)
} }
REGWRITE_BUFFER_FLUSH(ah);
return true; return true;
} }
EXPORT_SYMBOL(ath_hw_keyreset); EXPORT_SYMBOL(ath_hw_keyreset);
...@@ -104,9 +116,13 @@ static bool ath_hw_keysetmac(struct ath_common *common, ...@@ -104,9 +116,13 @@ static bool ath_hw_keysetmac(struct ath_common *common,
} else { } else {
macLo = macHi = 0; macLo = macHi = 0;
} }
ENABLE_REGWRITE_BUFFER(ah);
REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), macLo); REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), macLo);
REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | unicast_flag); REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | unicast_flag);
REGWRITE_BUFFER_FLUSH(ah);
return true; return true;
} }
...@@ -223,6 +239,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, ...@@ -223,6 +239,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
mic3 = get_unaligned_le16(k->kv_txmic + 0) & 0xffff; mic3 = get_unaligned_le16(k->kv_txmic + 0) & 0xffff;
mic4 = get_unaligned_le32(k->kv_txmic + 4); mic4 = get_unaligned_le32(k->kv_txmic + 4);
ENABLE_REGWRITE_BUFFER(ah);
/* Write RX[31:0] and TX[31:16] */ /* Write RX[31:0] and TX[31:16] */
REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), mic0); REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), mic0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), mic1); REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), mic1);
...@@ -236,6 +254,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, ...@@ -236,6 +254,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry), REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry),
AR_KEYTABLE_TYPE_CLR); AR_KEYTABLE_TYPE_CLR);
REGWRITE_BUFFER_FLUSH(ah);
} else { } else {
/* /*
* TKIP uses four key cache entries (two for group * TKIP uses four key cache entries (two for group
...@@ -258,6 +278,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, ...@@ -258,6 +278,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
mic0 = get_unaligned_le32(k->kv_mic + 0); mic0 = get_unaligned_le32(k->kv_mic + 0);
mic2 = get_unaligned_le32(k->kv_mic + 4); mic2 = get_unaligned_le32(k->kv_mic + 4);
ENABLE_REGWRITE_BUFFER(ah);
/* Write MIC key[31:0] */ /* Write MIC key[31:0] */
REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), mic0); REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), mic0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0); REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0);
...@@ -270,8 +292,12 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, ...@@ -270,8 +292,12 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0); REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0);
REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry), REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry),
AR_KEYTABLE_TYPE_CLR); AR_KEYTABLE_TYPE_CLR);
REGWRITE_BUFFER_FLUSH(ah);
} }
ENABLE_REGWRITE_BUFFER(ah);
/* MAC address registers are reserved for the MIC entry */ /* MAC address registers are reserved for the MIC entry */
REG_WRITE(ah, AR_KEYTABLE_MAC0(micentry), 0); REG_WRITE(ah, AR_KEYTABLE_MAC0(micentry), 0);
REG_WRITE(ah, AR_KEYTABLE_MAC1(micentry), 0); REG_WRITE(ah, AR_KEYTABLE_MAC1(micentry), 0);
...@@ -283,7 +309,11 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, ...@@ -283,7 +309,11 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
*/ */
REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), key0); REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), key0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), key1); REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), key1);
REGWRITE_BUFFER_FLUSH(ah);
} else { } else {
ENABLE_REGWRITE_BUFFER(ah);
/* Write key[47:0] */ /* Write key[47:0] */
REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), key0); REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), key0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), key1); REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), key1);
...@@ -296,6 +326,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, ...@@ -296,6 +326,8 @@ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), key4); REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), key4);
REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType); REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType);
REGWRITE_BUFFER_FLUSH(ah);
/* Write MAC address for the entry */ /* Write MAC address for the entry */
(void) ath_hw_keysetmac(common, entry, mac); (void) ath_hw_keysetmac(common, entry, mac);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment