diff mbox

[RFC,2/5] ath: Add a keycache entry if beamforming is enabled.

Message ID 1289391829-8577-2-git-send-email-vnatarajan@atheros.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Vivek Natarajan Nov. 10, 2010, 12:23 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 501050c..214a25f 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -177,5 +177,7 @@  int ath_key_config(struct ath_common *common,
 bool ath_hw_keyreset(struct ath_common *common, u16 entry);
 void ath_hw_cycle_counters_update(struct ath_common *common);
 int32_t ath_hw_get_listen_time(struct ath_common *common);
+int ath_txbf_key_config(struct ath_common *common,
+			struct ieee80211_sta *sta);
 
 #endif /* ATH_H */
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
index 62e3dac..11f562e 100644
--- a/drivers/net/wireless/ath/key.c
+++ b/drivers/net/wireless/ath/key.c
@@ -115,6 +115,7 @@  static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
 	void *ah = common->ah;
 	u32 key0, key1, key2, key3, key4;
 	u32 keyType;
+	u32 txbf = 0;
 
 	if (entry >= common->keymax) {
 		ath_print(common, ATH_DBG_FATAL,
@@ -199,6 +200,9 @@  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_TYPE(entry), keyType);
 
+		REG_WRITE(ah, AR_KEYTABLE_TYPE(entry),
+				keyType | txbf);
+
 		/* Write MAC address for the entry */
 		(void) ath_hw_keysetmac(common, entry, mac);
 
@@ -435,6 +439,31 @@  static int ath_reserve_key_cache_slot(struct ath_common *common,
 	return -1;
 }
 
+int ath_txbf_key_config(struct ath_common *common, struct ieee80211_sta *sta)
+{
+	int idx, ret;
+	struct ath_keyval hk;
+
+	if (WARN_ON(!sta))
+		return -EOPNOTSUPP;
+
+	memset(&hk, 0, sizeof(hk));
+	hk.kv_type = ATH_CIPHER_CLR;
+
+	idx = ath_reserve_key_cache_slot(common, 0);
+
+	if (idx < 0)
+		return -ENOSPC;
+
+	ret = ath_hw_set_keycache_entry(common, idx, &hk, sta->addr);
+
+	if (!ret)
+		return -EIO;
+
+	return idx;
+}
+EXPORT_SYMBOL(ath_txbf_key_config);
+
 /*
  * Configure encryption in the HW.
  */