Skip to contentSkip to conversation

Add support for per peer HTT tx stats for WCN3990

PATCH In review Surabhi Vishnoi 2 participants 5 messages Feb 27, 2019 – Sep 23, 2019 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover Add support for per peer HTT tx stats for WCN3990

WCN3990 firmware sends the HTT_TLV_T2H_MSG_TYPE_PEER_STATS in tlv format so the handling of this message has to be done in different manner.

This patchset adds support to attach rx_ops based on htt version and adds the handling of HTT_TLV_T2H_MSG_TYPE_PEER_STATS message based on HTT version.

Surabhi Vishnoi (2):
ath10k: Add support for adding htt_rx_ops based on htt_version
ath10k: Add support for per peer HTT tx stats for WCN3990

 drivers/net/wireless/ath/ath10k/htt.c     |   2 +
 drivers/net/wireless/ath/ath10k/htt.h     |  67 +++++++++++-
 drivers/net/wireless/ath/ath10k/htt_rx.c  | 165 ++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/hw.c      |  45 +++++++-
 drivers/net/wireless/ath/ath10k/hw.h      |  34 ++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   3 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  33 ++++++
 drivers/net/wireless/ath/ath10k/wmi.h     |   3 -
 8 files changed, 340 insertions(+), 12 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#1 lore raw

PATCH 1/2 ath10k: Add support for adding htt_rx_ops based on htt_version

Refactor the code to add the support to attach htt_rx_ops based on HTT version.

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

---
 drivers/net/wireless/ath/ath10k/htt.h    |  3 ++-
 drivers/net/wireless/ath/ath10k/htt_rx.c | 29 ++++++++++++++++++++++++++---
 2 files changed, 28 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +2 -1
index fef716a..0ab29bd 100644
@@ -1894,7 +1894,7 @@ struct ath10k_htt {
 
 	bool tx_mem_allocated;
 	const struct ath10k_htt_tx_ops *tx_ops;
-	const struct ath10k_htt_rx_ops *rx_ops;
+	struct ath10k_htt_rx_ops *rx_ops;
 };
 
 struct ath10k_htt_tx_ops {
@@ -1969,6 +1969,7 @@ struct ath10k_htt_rx_ops {
 				    int idx);
 	void* (*htt_get_vaddr_ring)(struct ath10k_htt *htt);
 	void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx);
+	void (*htt_fetch_peer_stats)(struct ath10k *ar, struct sk_buff *skb);
 };
 
 static inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt)
drivers/net/wireless/ath/ath10k/htt_rx.c +26 -3
index 4fc8856..c7a2411 100644
@@ -3143,6 +3143,11 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate)
 						    rate_idx);
 }
 
+static void ath10k_htt_fetch_peer_stats_tlv(struct ath10k *ar,
+					    struct sk_buff *skb)
+{
+}
+
 static void ath10k_htt_fetch_peer_stats(struct ath10k *ar,
 					struct sk_buff *skb)
 {
@@ -3556,7 +3561,7 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
 }
 EXPORT_SYMBOL(ath10k_htt_txrx_compl_task);
 
-static const struct ath10k_htt_rx_ops htt_rx_ops_32 = {
+static struct ath10k_htt_rx_ops htt_rx_ops_32 = {
 	.htt_get_rx_ring_size = ath10k_htt_get_rx_ring_size_32,
 	.htt_config_paddrs_ring = ath10k_htt_config_paddrs_ring_32,
 	.htt_set_paddrs_ring = ath10k_htt_set_paddrs_ring_32,
@@ -3564,7 +3569,10 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
 	.htt_reset_paddrs_ring = ath10k_htt_reset_paddrs_ring_32,
 };
 
-static const struct ath10k_htt_rx_ops htt_rx_ops_64 = {
+/* FIXME: Some other way to attach ops to static const htt rx_ops
+ * without removing const??
+ */
+static struct ath10k_htt_rx_ops htt_rx_ops_64 = {
 	.htt_get_rx_ring_size = ath10k_htt_get_rx_ring_size_64,
 	.htt_config_paddrs_ring = ath10k_htt_config_paddrs_ring_64,
 	.htt_set_paddrs_ring = ath10k_htt_set_paddrs_ring_64,
@@ -3572,7 +3580,7 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
 	.htt_reset_paddrs_ring = ath10k_htt_reset_paddrs_ring_64,
 };
 
-static const struct ath10k_htt_rx_ops htt_rx_ops_hl = {
+static struct ath10k_htt_rx_ops htt_rx_ops_hl = {
 };
 
 void ath10k_htt_set_rx_ops(struct ath10k_htt *htt)
@@ -3585,4 +3593,19 @@ void ath10k_htt_set_rx_ops(struct ath10k_htt *htt)
 		htt->rx_ops = &htt_rx_ops_64;
 	else
 		htt->rx_ops = &htt_rx_ops_32;
+
+	switch (ar->running_fw->fw_file.htt_op_version) {
+	case ATH10K_FW_HTT_OP_VERSION_MAIN:
+	case ATH10K_FW_HTT_OP_VERSION_10_1:
+	case ATH10K_FW_HTT_OP_VERSION_10_4:
+		htt->rx_ops->htt_fetch_peer_stats = ath10k_htt_fetch_peer_stats;
+	break;
+	case ATH10K_FW_HTT_OP_VERSION_TLV:
+		htt->rx_ops->htt_fetch_peer_stats = ath10k_htt_fetch_peer_stats_tlv;
+	break;
+	case ATH10K_FW_HTT_OP_VERSION_MAX:
+	case ATH10K_FW_HTT_OP_VERSION_UNSET:
+		WARN_ON(1);
+	return;
+	}
 }
Signature · 7 lines
1.9.1


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#2 lore raw

Re: [PATCH 1/2] ath10k: Add support for adding htt_rx_ops based on htt_version

Quoted 7 lines · Surabhi Vishnoi

Refactor the code to add the support to attach htt_rx_ops based on HTT version.

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

[...]

Quoted 19 lines
drivers/net/wireless/ath/ath10k/htt_rx.c +7 -1
@@ -3572,7 +3580,7 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
 	.htt_reset_paddrs_ring = ath10k_htt_reset_paddrs_ring_64,
 };
 
-static const struct ath10k_htt_rx_ops htt_rx_ops_hl = {
+static struct ath10k_htt_rx_ops htt_rx_ops_hl = {
 };
 
 void ath10k_htt_set_rx_ops(struct ath10k_htt *htt)
@@ -3585,4 +3593,19 @@ void ath10k_htt_set_rx_ops(struct ath10k_htt *htt)
 		htt->rx_ops = &htt_rx_ops_64;
 	else
 		htt->rx_ops = &htt_rx_ops_32;
+
+	switch (ar->running_fw->fw_file.htt_op_version) {
+	case ATH10K_FW_HTT_OP_VERSION_MAIN:
+	case ATH10K_FW_HTT_OP_VERSION_10_1:
+	case ATH10K_FW_HTT_OP_VERSION_10_4:
+		htt->rx_ops->htt_fetch_peer_stats = ath10k_htt_fetch_peer_stats;

drivers/net/wireless/ath/ath10k/htt_rx.c void ath10k_htt_set_rx_ops(struct ath10k_htt *htt) · line 3611

Quoted 10 lines
drivers/net/wireless/ath/ath10k/htt_rx.c +9 -0
+	break;
+	case ATH10K_FW_HTT_OP_VERSION_TLV:
+		htt->rx_ops->htt_fetch_peer_stats = ath10k_htt_fetch_peer_stats_tlv;
+	break;
+	case ATH10K_FW_HTT_OP_VERSION_MAX:
+	case ATH10K_FW_HTT_OP_VERSION_UNSET:
+		WARN_ON(1);
+	return;
+	}
 }

I just realised this won't work. Let's say that there's both a qca988x and a qca6174 PCI device on the same host. Then htt->rx_ops is shared by _both_ devices and the htt_fetch_peer_stats field will contain the value of the last initialised ath10k device.

So back to the drawing board. As this feature is for wcn3990 would it be enough to modify htt_rx_ops_64? IIRC only wcn3990 support 64bit HTT interface, right? Of course then qca6174 won't support this feature, but does the qca6174 firmware even support that?

Signature · 6 lines
Kalle Valo

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#3 lore raw

PATCH 2/2 ath10k: Add support for per peer HTT tx stats for WCN3990

In reply to Surabhi Vishnoi

The firmware sends peer stats to the host driver if the firmware advertises WMI_SERVICE_PEER_STATS service and the host driver indicates the WMI_RSRC_CFG_FLAG_TX_PEER_STATS capability in the host capab flag in wmi init cmd.

When peer stats are enabled, firmware sends one HTT event HTT_TLV_T2H_MSG_TYPE_PEER_STATS for every four PPDUs transmitted. HTT msg payload has tag followed by length followed by success pkts/bytes, failed pkts/bytes, retry pkts/bytes and rate info per ppdu.

Parse peer stats sent by the firmware in tlv format and update the tx rate information and tx_stats debugfs entry per STA.

To get the tx_stats:
echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/enable_extd_tx_stats cat /sys/kernel/debug/ieee80211/phyX/net:wlanX/stations/xx:xx:xx:xx:xx:xx/tx_stats

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

---
 drivers/net/wireless/ath/ath10k/htt.c     |   2 +
 drivers/net/wireless/ath/ath10k/htt.h     |  64 ++++++++++++++
 drivers/net/wireless/ath/ath10k/htt_rx.c  | 136 +++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/hw.c      |  45 +++++++++-
 drivers/net/wireless/ath/ath10k/hw.h      |  34 ++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |   3 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  33 ++++++++
 drivers/net/wireless/ath/ath10k/wmi.h     |   3 -
 8 files changed, 312 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/htt.c +2 -0
index d235ff3..828e76d 100644
@@ -89,6 +89,8 @@
 	[HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR] =
 		HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR,
 	[HTT_TLV_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,
+	[HTT_TLV_T2H_MSG_TYPE_PEER_STATS] =
+				HTT_T2H_MSG_TYPE_PEER_STATS,
 };
 
 static const enum htt_t2h_msg_type htt_10_4_t2h_msg_types[] = {
drivers/net/wireless/ath/ath10k/htt.h +64 -0

82 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/htt_rx.c +132 -4

156 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/hw.c +44 -1

63 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/hw.h +34 -0
index de7dc01..737e4f7 100644
@@ -159,6 +159,13 @@ enum qca9377_chip_id_rev {
 
 #define REG_DUMP_COUNT_QCA988X 60
 
+#define ATH10K_HW_BW_MASK				GENMASK(4, 3)
+#define ATH10K_HW_GI_MASK				GENMASK(5, 5)
+#define ATH10K_HW_SKIPPED_RATE_CTRL_MASK		GENMASK(6, 6)
+#define ATH10K_HW_WCN3990_BW_BIT_MASK			GENMASK(5, 3)
+#define ATH10K_HW_WCN3990_GI_MASK			GENMASK(6, 6)
+#define ATH10K_HW_WCN3990_SKIPPED_RATE_CTRL_MASK	GENMASK(7, 7)
+
 struct ath10k_fw_ie {
 	__le32 id;
 	__le32 len;
@@ -616,6 +623,9 @@ struct ath10k_hw_ops {
 	void (*set_coverage_class)(struct ath10k *ar, s16 value);
 	int (*enable_pll_clk)(struct ath10k *ar);
 	bool (*rx_desc_get_msdu_limit_error)(struct htt_rx_desc *rxd);
+	int (*get_bw)(u8 flags);
+	int (*get_gi)(u8 flags);
+	int (*get_skipped_rate_ctrl)(u8 flags);
 };
 
 extern const struct ath10k_hw_ops qca988x_ops;
@@ -643,6 +653,30 @@ struct ath10k_hw_ops {
 	return false;
 }
 
+static inline int
+ath10k_get_bw(struct ath10k_hw_params *hw, u8 flags)
+{
+	if (hw->hw_ops->get_bw)
+		return hw->hw_ops->get_bw(flags);
+	return 0;
+}
+
+static inline int
+ath10k_get_gi(struct ath10k_hw_params *hw, u8 flags)
+{
+	if (hw->hw_ops->get_gi)
+		return hw->hw_ops->get_gi(flags);
+	return 0;
+}
+
+static inline int
+ath10k_get_skipped_rate_ctrl(struct ath10k_hw_params *hw, u8 flags)
+{
+	if (hw->hw_ops->get_skipped_rate_ctrl)
+		return hw->hw_ops->get_skipped_rate_ctrl(flags);
+	return 0;
+}
+
 /* Target specific defines for MAIN firmware */
 #define TARGET_NUM_VDEVS			8
 #define TARGET_NUM_PEER_AST			2
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -0
index 9b2ed0e..b700fe1 100644
@@ -1706,6 +1706,9 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
 	cfg->num_ocb_schedules = __cpu_to_le32(0);
 	cfg->host_capab = __cpu_to_le32(WMI_TLV_FLAG_MGMT_BUNDLE_TX_COMPL);
 
+	if (ath10k_peer_stats_enabled(ar))
+		cfg->host_capab |= __cpu_to_le32(WMI_RSRC_CFG_FLAG_TX_PEER_STATS);
+
 	ath10k_wmi_put_host_mem_chunks(ar, chunks);
 
 	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv init\n");
drivers/net/wireless/ath/ath10k/wmi-tlv.h +33 -0
index 03d02ed..d5a090f 100644
@@ -13,6 +13,7 @@
 #define WMI_TLV_PDEV_PARAM_UNSUPPORTED 0
 #define WMI_TLV_VDEV_PARAM_UNSUPPORTED 0
 #define WMI_TLV_MGMT_TX_FRAME_MAX_LEN	64
+#define WMI_RSRC_CFG_FLAG_TX_PEER_STATS          BIT(21)
 
 enum wmi_tlv_grp_id {
 	WMI_TLV_GRP_START = 0x3,
@@ -1384,6 +1385,36 @@ enum wmi_tlv_service {
 	WMI_TLV_SERVICE_AP_TWT = 153,
 	WMI_TLV_SERVICE_GMAC_OFFLOAD_SUPPORT = 154,
 	WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT = 155,
+	WMI_TLV_SERVICE_PEER_TID_CONFIGS_SUPPORT = 156,
+	WMI_TLV_SERVICE_VDEV_SWRETRY_PER_AC_CONFIG_SUPPORT = 157,
+	WMI_TLV_SERVICE_DUAL_BEACON_ON_SINGLE_MAC_SCC_SUPPORT = 158,
+	WMI_TLV_SERVICE_DUAL_BEACON_ON_SINGLE_MAC_MCC_SUPPORT = 159,
+	WMI_TLV_SERVICE_MOTION_DET = 160,
+	WMI_TLV_SERVICE_INFRA_MBSSID = 161,
+	WMI_TLV_SERVICE_OBSS_SPATIAL_REUSE = 162,
+	WMI_TLV_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT = 163,
+	WMI_TLV_SERVICE_NAN_DBS_SUPPORT = 164,
+	WMI_TLV_SERVICE_NDI_DBS_SUPPORT = 165,
+	WMI_TLV_SERVICE_NAN_SAP_SUPPORT = 166,
+	WMI_TLV_SERVICE_NDI_SAP_SUPPORT = 167,
+	WMI_TLV_SERVICE_CFR_CAPTURE_SUPPORT = 168,
+	WMI_TLV_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_1 = 169,
+	WMI_TLV_SERVICE_ESP_SUPPORT = 170,
+	WMI_TLV_SERVICE_PEER_CHWIDTH_CHANGE = 171,
+	WMI_TLV_SERVICE_WLAN_HPCS_PULSE = 172,
+	WMI_TLV_SERVICE_PER_VDEV_CHAINMASK_CONFIG_SUPPORT = 173,
+	WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI = 174,
+	WMI_TLV_SERVICE_NAN_DISABLE_SUPPORT = 175,
+	WMI_TLV_SERVICE_HTT_H2T_NO_HTC_HDR_LEN_IN_MSG_LEN = 176,
+	WMI_TLV_SERVICE_COEX_SUPPORT_UNEQUAL_ISOLATION = 177,
+	WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT = 178,
+	WMI_TLV_SERVICE_SUPPORT_EXTEND_ADDRESS = 179,
+	WMI_TLV_SERVICE_BEACON_RECEPTION_STATS = 180,
+	WMI_TLV_SERVICE_FETCH_TX_PN = 181,
+	WMI_TLV_SERVICE_PEER_UNMAP_RESPONSE_SUPPORT = 182,
+	WMI_TLV_SERVICE_TX_PER_PEER_AMPDU_SIZE = 183,
+	WMI_TLV_SERVICE_BSS_COLOR_SWITCH_COUNT = 184,
+	WMI_TLV_SERVICE_PEER_STATS = 185,
 
 	WMI_TLV_MAX_EXT_SERVICE = 256,
 };
@@ -1557,6 +1588,8 @@ enum wmi_tlv_service {
 	SVCMAP(WMI_TLV_SERVICE_THERM_THROT,
 	       WMI_SERVICE_THERM_THROT,
 	       WMI_TLV_MAX_SERVICE);
+	SVCMAP(WMI_TLV_SERVICE_PEER_STATS,
+	       WMI_SERVICE_PEER_STATS, WMI_TLV_MAX_SERVICE);
 }
 
 #undef SVCMAP
drivers/net/wireless/ath/ath10k/wmi.h +0 -3
index 39a6568..e89066b 100644
@@ -5043,13 +5043,10 @@ enum wmi_rate_preamble {
 #define ATH10K_HW_PREAMBLE(rate)	(((rate) >> 6) & 0x3)
 #define ATH10K_HW_MCS_RATE(rate)	((rate) & 0xf)
 #define ATH10K_HW_LEGACY_RATE(rate)	((rate) & 0x3f)
-#define ATH10K_HW_BW(flags)		(((flags) >> 3) & 0x3)
-#define ATH10K_HW_GI(flags)		(((flags) >> 5) & 0x1)
 #define ATH10K_HW_RATECODE(rate, nss, preamble) \
 	(((preamble) << 6) | ((nss) << 4) | (rate))
 #define ATH10K_HW_AMPDU(flags)		((flags) & 0x1)
 #define ATH10K_HW_BA_FAIL(flags)	(((flags) >> 1) & 0x3)
-#define ATH10K_FW_SKIPPED_RATE_CTRL(flags)	(((flags) >> 6) & 0x1)
 
 #define ATH10K_VHT_MCS_NUM	10
 #define ATH10K_BW_NUM		4
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 2/2] ath10k: Add support for per peer HTT tx stats for WCN3990

Quoted 22 lines · Surabhi Vishnoi

The firmware sends peer stats to the host driver if the firmware advertises WMI_SERVICE_PEER_STATS service and the host driver indicates the WMI_RSRC_CFG_FLAG_TX_PEER_STATS capability in the host capab flag in wmi init cmd.

When peer stats are enabled, firmware sends one HTT event HTT_TLV_T2H_MSG_TYPE_PEER_STATS for every four PPDUs transmitted. HTT msg payload has tag followed by length followed by success pkts/bytes, failed pkts/bytes, retry pkts/bytes and rate info per ppdu.

Parse peer stats sent by the firmware in tlv format and update the tx rate information and tx_stats debugfs entry per STA.

To get the tx_stats:
echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/enable_extd_tx_stats cat /sys/kernel/debug/ieee80211/phyX/net:wlanX/stations/xx:xx:xx:xx:xx:xx/tx_stats

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

[...]

drivers/net/wireless/ath/ath10k/htt_rx.c bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) · line 3570

Quoted 7 lines
drivers/net/wireless/ath/ath10k/htt_rx.c +1 -1
@@ -3438,7 +3566,7 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
 		ath10k_htt_rx_tx_mode_switch_ind(ar, skb);
 		break;
 	case HTT_T2H_MSG_TYPE_PEER_STATS:
-		ath10k_htt_fetch_peer_stats(ar, skb);
+		htt->rx_ops->htt_fetch_peer_stats(ar, skb);
 		break;

I think this belongs to patch 1.

drivers/net/wireless/ath/ath10k/hw.h enum qca9377_chip_id_rev { · line 163

Quoted 1 line
drivers/net/wireless/ath/ath10k/hw.h +1 -0
+#define ATH10K_HW_GI_MASK				GENMASK(5, 5)

BIT(5)

drivers/net/wireless/ath/ath10k/hw.h enum qca9377_chip_id_rev { · line 164

Quoted 1 line
drivers/net/wireless/ath/ath10k/hw.h +1 -0
+#define ATH10K_HW_SKIPPED_RATE_CTRL_MASK		GENMASK(6, 6)

BIT(6)

Quoted 1 line

+#define ATH10K_HW_WCN3990_GI_MASK GENMASK(6, 6)

BIT(6)

Quoted 1 line

+#define ATH10K_HW_WCN3990_SKIPPED_RATE_CTRL_MASK GENMASK(7, 7)

BIT(7)

Signature · 6 lines
Kalle Valo

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k