Commit e6510b11 authored by Chun-Yeow Yeoh's avatar Chun-Yeow Yeoh Committed by John W. Linville

ath9k|ath9k_htc: Seperate the software crypto flag for Tx and Rx

Use the sw_mgmt_crypto_tx flag to trigger the CCMP encryption
for transmitted management frames to be done in software while
the sw_mgmt_crypto_rx flag is used to trigger the CCMP decryption
for received management frames to be done in software.
Signed-off-by: default avatarChun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7bf16521
...@@ -159,7 +159,7 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common, ...@@ -159,7 +159,7 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
if (test_bit(keyix, common->keymap)) if (test_bit(keyix, common->keymap))
rxs->flag |= RX_FLAG_DECRYPTED; rxs->flag |= RX_FLAG_DECRYPTED;
} }
if (ah->sw_mgmt_crypto && if (ah->sw_mgmt_crypto_rx &&
(rxs->flag & RX_FLAG_DECRYPTED) && (rxs->flag & RX_FLAG_DECRYPTED) &&
ieee80211_is_mgmt(fc)) ieee80211_is_mgmt(fc))
/* Use software decrypt for management frames. */ /* Use software decrypt for management frames. */
......
...@@ -1447,7 +1447,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw, ...@@ -1447,7 +1447,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key->cipher == WLAN_CIPHER_SUITE_TKIP) if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
if (priv->ah->sw_mgmt_crypto && if (priv->ah->sw_mgmt_crypto_tx &&
key->cipher == WLAN_CIPHER_SUITE_CCMP) key->cipher == WLAN_CIPHER_SUITE_CCMP)
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
ret = 0; ret = 0;
......
...@@ -1598,16 +1598,19 @@ static void ath9k_hw_init_mfp(struct ath_hw *ah) ...@@ -1598,16 +1598,19 @@ static void ath9k_hw_init_mfp(struct ath_hw *ah)
* frames when constructing CCMP AAD. */ * frames when constructing CCMP AAD. */
REG_RMW_FIELD(ah, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT, REG_RMW_FIELD(ah, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT,
0xc7ff); 0xc7ff);
ah->sw_mgmt_crypto = false; ah->sw_mgmt_crypto_tx = false;
ah->sw_mgmt_crypto_rx = false;
} else if (AR_SREV_9160_10_OR_LATER(ah)) { } else if (AR_SREV_9160_10_OR_LATER(ah)) {
/* Disable hardware crypto for management frames */ /* Disable hardware crypto for management frames */
REG_CLR_BIT(ah, AR_PCU_MISC_MODE2, REG_CLR_BIT(ah, AR_PCU_MISC_MODE2,
AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE); AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE);
REG_SET_BIT(ah, AR_PCU_MISC_MODE2, REG_SET_BIT(ah, AR_PCU_MISC_MODE2,
AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT); AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT);
ah->sw_mgmt_crypto = true; ah->sw_mgmt_crypto_tx = true;
ah->sw_mgmt_crypto_rx = true;
} else { } else {
ah->sw_mgmt_crypto = true; ah->sw_mgmt_crypto_tx = true;
ah->sw_mgmt_crypto_rx = true;
} }
} }
......
...@@ -753,7 +753,8 @@ struct ath_hw { ...@@ -753,7 +753,8 @@ struct ath_hw {
} eeprom; } eeprom;
const struct eeprom_ops *eep_ops; const struct eeprom_ops *eep_ops;
bool sw_mgmt_crypto; bool sw_mgmt_crypto_tx;
bool sw_mgmt_crypto_rx;
bool is_pciexpress; bool is_pciexpress;
bool aspm_enabled; bool aspm_enabled;
bool is_monitoring; bool is_monitoring;
......
...@@ -1655,7 +1655,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw, ...@@ -1655,7 +1655,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key->cipher == WLAN_CIPHER_SUITE_TKIP) if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
if (sc->sc_ah->sw_mgmt_crypto && if (sc->sc_ah->sw_mgmt_crypto_tx &&
key->cipher == WLAN_CIPHER_SUITE_CCMP) key->cipher == WLAN_CIPHER_SUITE_CCMP)
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
ret = 0; ret = 0;
......
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