提交 1d0bb42d 编写于 作者: F Felix Fietkau 提交者: John W. Linville

ath9k_hw: add multicast key search support

If a MAC address for a key table entry is flagged with the
multicast bit (0x01), indicate to the hardware that multicast
lookup instead of unicast lookup should be used. The multicast
bit itself never makes it to the actual keytable entry register,
as it is shifted out.
Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 fd515941
...@@ -1485,6 +1485,7 @@ EXPORT_SYMBOL(ath9k_hw_keyreset); ...@@ -1485,6 +1485,7 @@ EXPORT_SYMBOL(ath9k_hw_keyreset);
bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac) bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac)
{ {
u32 macHi, macLo; u32 macHi, macLo;
u32 unicast_flag = AR_KEYTABLE_VALID;
if (entry >= ah->caps.keycache_size) { if (entry >= ah->caps.keycache_size) {
ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
...@@ -1493,6 +1494,16 @@ bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac) ...@@ -1493,6 +1494,16 @@ bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac)
} }
if (mac != NULL) { if (mac != NULL) {
/*
* AR_KEYTABLE_VALID indicates that the address is a unicast
* address, which must match the transmitter address for
* decrypting frames.
* Not setting this bit allows the hardware to use the key
* for multicast frame decryption.
*/
if (mac[0] & 0x01)
unicast_flag = 0;
macHi = (mac[5] << 8) | mac[4]; macHi = (mac[5] << 8) | mac[4];
macLo = (mac[3] << 24) | macLo = (mac[3] << 24) |
(mac[2] << 16) | (mac[2] << 16) |
...@@ -1505,7 +1516,7 @@ bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac) ...@@ -1505,7 +1516,7 @@ bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac)
macLo = macHi = 0; macLo = macHi = 0;
} }
REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), macLo); REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), macLo);
REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | AR_KEYTABLE_VALID); REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | unicast_flag);
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册