Skip to contentSkip to conversation

ath6k: report antenna configuration.

PATCH In review [email protected] 2 participants 5 messages Oct 21, 2015 – Oct 29, 2015 Atheros ATH6KL wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ath6k: report antenna configuration.

From: Ben Greear <[email protected]>

This lets 'iw phy phy0 info' report antennas for
the radio device:

...

	Available Antennas: TX 0x2 RX 0x2
	Configured Antennas: TX 0x2 RX 0x2

...

---

This patch series is on top of my various local patches in a 4.2.3 kernel.

 drivers/net/wireless/ath/ath6kl/cfg80211.c | 17 +++++++++++++++++
 drivers/net/wireless/ath/ath6kl/core.h     |  2 ++
 2 files changed, 19 insertions(+)
drivers/net/wireless/ath/ath6kl/cfg80211.c +17 -0
index 5b3d79e..ed25ad6 100644
@@ -3231,6 +3231,15 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 					wait, buf, len, no_cck);
 }
 
+static int ath6kl_get_antenna(struct wiphy *wiphy,
+			      u32 *tx_ant, u32 *rx_ant)
+{
+	struct ath6kl *ar = wiphy_priv(wiphy);
+	*tx_ant = ar->hw.tx_ant;
+	*rx_ant = ar->hw.rx_ant;
+	return 0;
+}
+
 static void ath6kl_mgmt_frame_register(struct wiphy *wiphy,
 				       struct wireless_dev *wdev,
 				       u16 frame_type, bool reg)
@@ -3448,6 +3457,7 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
 	.cancel_remain_on_channel = ath6kl_cancel_remain_on_channel,
 	.mgmt_tx = ath6kl_mgmt_tx,
 	.mgmt_frame_register = ath6kl_mgmt_frame_register,
+	.get_antenna = ath6kl_get_antenna,
 	.sched_scan_start = ath6kl_cfg80211_sscan_start,
 	.sched_scan_stop = ath6kl_cfg80211_sscan_stop,
 	.set_bitrate_mask = ath6kl_cfg80211_set_bitrate,
@@ -3795,11 +3805,18 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
 		ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
 		ath6kl_band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff;
 		ath6kl_band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff;
+		ar->hw.tx_ant = 2;
+		ar->hw.rx_ant = 2;
 	} else {
 		ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
 		ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
+		ar->hw.tx_ant = 1;
+		ar->hw.rx_ant = 1;
 	}
 
+	wiphy->available_antennas_tx = ar->hw.tx_ant;
+	wiphy->available_antennas_rx = ar->hw.rx_ant;
+
 	if (band_2gig)
 		wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
 	if (band_5gig)
drivers/net/wireless/ath/ath6kl/core.h +2 -0
index 2b78c86..5f3acfe 100644
@@ -782,6 +782,8 @@ struct ath6kl {
 		u32 refclk_hz;
 		u32 uarttx_pin;
 		u32 testscript_addr;
+		u8 tx_ant;
+		u8 rx_ant;
 		enum wmi_phy_cap cap;
 
 		u32 flags;
Signature · 1 line
2.4.3
#1 lore raw

PATCH 2/3 ath6k: add error message to explain lack of HT.

From: Ben Greear <[email protected]>

It can take a user a while to understand why their NIC that advertises 802.11n support cannot actually do 802.11n. Print out a warning in the logs to save the next poor person to use this NIC some trouble.

---
 drivers/net/wireless/ath/ath6kl/cfg80211.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath6kl/cfg80211.c +3 -0
index ed25ad6..6fcb39b 100644
@@ -3797,6 +3797,9 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
 		ath6kl_band_2ghz.ht_cap.ht_supported = false;
 		ath6kl_band_5ghz.ht_cap.cap = 0;
 		ath6kl_band_5ghz.ht_cap.ht_supported = false;
+
+		if (ht)
+			ath6kl_err("Firmware lacks RSN-CAP-OVERRIDE, so HT (802.11n) is disabled.");
 	}
 
 	if (test_bit(ATH6KL_FW_CAPABILITY_64BIT_RATES,
Signature · 1 line
2.4.3
#2 lore raw

PATCH 3/3 ath6k: fix firmware version assignment.

In reply to [email protected]

From: Ben Greear <[email protected]>

Improper use of strlcpy caused garbage to be appended to the firmware version string. Fix this by paying attention to the ie_lenth.

---
 drivers/net/wireless/ath/ath6kl/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/init.c +1 -1
index 6e473fa..e3f3a6a 100644
@@ -994,7 +994,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
 		switch (ie_id) {
 		case ATH6KL_FW_IE_FW_VERSION:
 			strlcpy(ar->wiphy->fw_version, data,
-				sizeof(ar->wiphy->fw_version));
+				min(sizeof(ar->wiphy->fw_version), ie_len+1));
 
 			ath6kl_dbg(ATH6KL_DBG_BOOT,
 				   "found fw version %s\n",
Signature · 1 line
2.4.3