Skip to contentSkip to conversation

ath11k: drop tx_info from ath11k_sta

PATCH RESEND In review John Crispin 3 participants 11 messages Feb 4, 2020 – Feb 12, 2020 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/4 ath11k: drop tx_info from ath11k_sta

We will start using ieee80211_tx_status_ext() so we do not need to track tx rates inside a struct ieee80211_tx_info. It is currently not possible to populate that struct with HE rate info anyhow.

---
 drivers/net/wireless/ath/ath11k/core.h  |  1 -
 drivers/net/wireless/ath/ath11k/dp_rx.c | 51 +------------------------
 2 files changed, 2 insertions(+), 50 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +0 -1
index 15676dce98b1..66f09056c01b 100644
@@ -336,7 +336,6 @@ struct ath11k_sta {
 	u32 smps;
 
 	struct work_struct update_wk;
-	struct ieee80211_tx_info tx_info;
 	struct rate_info txrate;
 	struct rate_info last_txrate;
 	u64 rx_duration;
drivers/net/wireless/ath/ath11k/dp_rx.c +2 -49

94 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH RESEND v2 2/4 ath11k: add HE rate accounting to driver

Parse and store the out-of-band rates reported by the FW.

---
 drivers/net/wireless/ath/ath11k/core.h        |  2 +
 drivers/net/wireless/ath/ath11k/debugfs_sta.c |  7 +++
 drivers/net/wireless/ath/ath11k/dp.h          |  9 ++++
 drivers/net/wireless/ath/ath11k/dp_rx.c       | 48 +++++++++++++++++--
 drivers/net/wireless/ath/ath11k/dp_tx.c       |  1 +
 drivers/net/wireless/ath/ath11k/hal_rx.c      | 13 +++--
 drivers/net/wireless/ath/ath11k/hal_rx.h      | 30 ++++++++++++
 drivers/net/wireless/ath/ath11k/rx_desc.h     |  8 ++++
 8 files changed, 112 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +2 -0
index 66f09056c01b..80414b2fa4db 100644
@@ -248,6 +248,8 @@ struct ath11k_rx_peer_stats {
 	u64 pream_cnt[HAL_RX_PREAMBLE_MAX];
 	u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX];
 	u64 rx_duration;
+	u64 dcm_count;
+	u64 ru_alloc_cnt[HAL_RX_RU_ALLOC_TYPE_MAX];
 };
 
 #define ATH11K_HE_MCS_NUM       12
drivers/net/wireless/ath/ath11k/debugfs_sta.c +7 -0
index 743760c9bcae..bdfc22915d51 100644
@@ -379,6 +379,13 @@ static ssize_t ath11k_dbg_sta_dump_rx_stats(struct file *file,
 		len += scnprintf(buf + len, size - len, "%llu ", rx_stats->nss_count[i]);
 	len += scnprintf(buf + len, size - len, "\nRX Duration:%llu ",
 			 rx_stats->rx_duration);
+	len += scnprintf(buf + len, size - len,
+			 "\nDCM: %llu\nRU: 26 %llu 52: %llu 106: %llu 242: %llu 484: %llu 996: %llu\n",
+			 rx_stats->dcm_count, rx_stats->ru_alloc_cnt[0],
+			 rx_stats->ru_alloc_cnt[1], rx_stats->ru_alloc_cnt[2],
+			 rx_stats->ru_alloc_cnt[3], rx_stats->ru_alloc_cnt[4],
+			 rx_stats->ru_alloc_cnt[5]);
+
 	len += scnprintf(buf + len, size - len, "\n");
 
 	spin_unlock_bh(&ar->ab->base_lock);
drivers/net/wireless/ath/ath11k/dp.h +9 -0
index 6ef5be4201b2..3592c39f84de 100644
@@ -1066,6 +1066,13 @@ struct htt_ppdu_stats_common {
 	u16 bw_mhz;
 } __packed;
 
+enum htt_ppdu_stats_gi {
+	HTT_PPDU_STATS_SGI_0_8_US,
+	HTT_PPDU_STATS_SGI_0_4_US,
+	HTT_PPDU_STATS_SGI_1_6_US,
+	HTT_PPDU_STATS_SGI_3_2_US,
+};
+
 #define HTT_PPDU_STATS_USER_RATE_INFO0_USER_POS_M	GENMASK(3, 0)
 #define HTT_PPDU_STATS_USER_RATE_INFO0_MU_GROUP_ID_M	GENMASK(11, 4)
 
@@ -1094,6 +1101,8 @@ struct htt_ppdu_stats_common {
 		FIELD_GET(HTT_PPDU_STATS_USER_RATE_FLAGS_MCS_M, _val)
 #define HTT_USR_RATE_GI(_val) \
 		FIELD_GET(HTT_PPDU_STATS_USER_RATE_FLAGS_GI_M, _val)
+#define HTT_USR_RATE_DCM(_val) \
+		FIELD_GET(HTT_PPDU_STATS_USER_RATE_FLAGS_DCM_M, _val)
 
 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_LTF_SIZE_M		GENMASK(1, 0)
 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_STBC_M		BIT(2)
drivers/net/wireless/ath/ath11k/dp_rx.c +45 -3

94 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/dp_tx.c +1 -0
index 95d9fe759e0f..7b532bf9acd8 100644
@@ -7,6 +7,7 @@
 #include "dp_tx.h"
 #include "debug.h"
 #include "hw.h"
+#include "peer.h"
 
 /* NOTE: Any of the mapped ring id value must not exceed DP_TCL_NUM_RING_MAX */
 static const u8
drivers/net/wireless/ath/ath11k/hal_rx.c +10 -3
index 9e0f8064e427..58c57f91b672 100644
@@ -1001,6 +1001,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		}
 
 		ppdu_info->nss = nsts + 1;
+		ppdu_info->dcm = dcm;
 		ppdu_info->reception_type = HAL_RX_RECEPTION_TYPE_SU;
 		break;
 	}
@@ -1038,9 +1039,15 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		break;
 	}
 	case HAL_PHYRX_HE_SIG_B1_MU: {
-		/* TODO: Check if resource unit(RU) allocation stats
-		 * are required
-		 */
+		struct hal_rx_he_sig_b1_mu_info *he_sig_b1_mu =
+			(struct hal_rx_he_sig_b1_mu_info *)tlv_data;
+		u16 ru_tones;
+
+		info0 = __le32_to_cpu(he_sig_b1_mu->info0);
+
+		ru_tones = FIELD_GET(HAL_RX_HE_SIG_B1_MU_INFO_INFO0_RU_ALLOCATION,
+				     info0);
+		ppdu_info->ru_alloc = ath11k_he_ru_tones_to_nl80211_he_ru_alloc(ru_tones);
 		ppdu_info->reception_type = HAL_RX_RECEPTION_TYPE_MU_MIMO;
 		break;
 	}
drivers/net/wireless/ath/ath11k/hal_rx.h +30 -0
index bb022c781c48..e863e4abfcc1 100644
@@ -99,6 +99,8 @@ struct hal_rx_mon_ppdu_info {
 	u8 beamformed;
 	u8 rssi_comb;
 	u8 tid;
+	u8 dcm;
+	u8 ru_alloc;
 	u8 reception_type;
 	u64 rx_duration;
 };
@@ -325,6 +327,34 @@ enum hal_rx_mon_status
 ath11k_hal_rx_parse_mon_status(struct ath11k_base *ab,
 			       struct hal_rx_mon_ppdu_info *ppdu_info,
 			       struct sk_buff *skb);
+
+static inline u32 ath11k_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones)
+{
+	u32 ret = 0;
+
+	switch (ru_tones) {
+	case RU_26:
+		ret = NL80211_RATE_INFO_HE_RU_ALLOC_26;
+		break;
+	case RU_52:
+		ret = NL80211_RATE_INFO_HE_RU_ALLOC_52;
+		break;
+	case RU_106:
+		ret = NL80211_RATE_INFO_HE_RU_ALLOC_106;
+		break;
+	case RU_242:
+		ret = NL80211_RATE_INFO_HE_RU_ALLOC_242;
+		break;
+	case RU_484:
+		ret = NL80211_RATE_INFO_HE_RU_ALLOC_484;
+		break;
+	case RU_996:
+		ret = NL80211_RATE_INFO_HE_RU_ALLOC_996;
+		break;
+	}
+	return ret;
+}
+
 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_0 0xDDBEEF
 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_1 0xADBEEF
 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_2 0xBDBEEF
drivers/net/wireless/ath/ath11k/rx_desc.h +8 -0
index a5aff801f17f..4d586fd1f872 100644
@@ -1209,4 +1209,12 @@ struct hal_rx_desc {
 	u8 msdu_payload[0];
 } __packed;
 
+#define HAL_RX_RU_ALLOC_TYPE_MAX 6
+#define RU_26  1
+#define RU_52  2
+#define RU_106 4
+#define RU_242 9
+#define RU_484 18
+#define RU_996 37
+
 #endif /* ATH11K_RX_DESC_H */
Signature · 1 line
2.20.1
#2 lore raw

PATCH RESEND v2 3/4 ath11k: switch to using ieee80211_tx_status_ext()

In reply to John Crispin

This allows us to pass HE rates down into the stack.

---
 drivers/net/wireless/ath/ath11k/dp_tx.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/dp_tx.c +19 -5
index 7b532bf9acd8..66a6cfd54ad9 100644
@@ -357,9 +357,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 				       struct sk_buff *msdu,
 				       struct hal_tx_status *ts)
 {
+	struct ieee80211_tx_status status = { 0 };
 	struct ath11k_base *ab = ar->ab;
 	struct ieee80211_tx_info *info;
 	struct ath11k_skb_cb *skb_cb;
+	struct ath11k_peer *peer;
+	struct ath11k_sta *arsta;
 
 	if (WARN_ON_ONCE(ts->buf_rel_source != HAL_WBM_REL_SRC_MODULE_TQM)) {
 		/* Must not happen */
@@ -423,12 +426,23 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 		ath11k_dp_tx_cache_peer_stats(ar, msdu, ts);
 	}
 
-	/* NOTE: Tx rate status reporting. Tx completion status does not have
-	 * necessary information (for example nss) to build the tx rate.
-	 * Might end up reporting it out-of-band from HTT stats.
-	 */
 
-	ieee80211_tx_status(ar->hw, msdu);
+	spin_lock_bh(&ab->base_lock);
+	peer = ath11k_peer_find_by_id(ab, ts->peer_id);
+	if (peer) {
+		arsta = (struct ath11k_sta *)peer->sta->drv_priv;
+		status.sta = peer->sta;
+		status.skb = msdu;
+		status.info = info;
+		status.rate = &arsta->last_txrate;
+	}
+	rcu_read_unlock();
+	if (peer)
+		ieee80211_tx_status_ext(ar->hw, &status);
+	else
+		dev_kfree_skb_any(msdu);
+	spin_unlock_bh(&ab->base_lock);
+	return;
 
 exit:
 	rcu_read_unlock();
Signature · 1 line
2.20.1
#3 lore raw

Re: [RESEND V2 3/4] ath11k: switch to using ieee80211_tx_status_ext()

Quoted 12 lines · John Crispin

This allows us to pass HE rates down into the stack.

---
 drivers/net/wireless/ath/ath11k/dp_tx.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/dp_tx.c +0 -0
index 7b532bf9acd8..66a6cfd54ad9 100644

drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · line 360

Quoted 4 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +1 -0
@@ -357,9 +357,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 				       struct sk_buff *msdu,
 				       struct hal_tx_status *ts)
 {
+	struct ieee80211_tx_status status = { 0 };

This adds a sparse warning:

drivers/net/wireless/ath/ath11k/dp_tx.c:350:47: warning: Using plain integer as NULL pointer

Seems like a false warning, no? But not sure how to shut up the warning, using '{ NULL }' would do that but just feels wrong. Any opinions?

There was also a trivial checkpatch warning:

drivers/net/wireless/ath/ath11k/dp_tx.c:419: Please don't use multiple blank lines

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw

Re: [RESEND V2 3/4] ath11k: switch to using ieee80211_tx_status_ext()

On Tuesday, 11 February 2020 14:10:04 CET Kalle Valo wrote:
[...]

Quoted 12 lines

drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · line 360

Quoted 9 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +1 -0
index 7b532bf9acd8..66a6cfd54ad9 100644
@@ -357,9 +357,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 				       struct sk_buff *msdu,
 				       struct hal_tx_status *ts)
 {
+	struct ieee80211_tx_status status = { 0 };

This adds a sparse warning:

Quoted 4 lines

drivers/net/wireless/ath/ath11k/dp_tx.c:350:47: warning: Using plain integer as NULL pointer

Seems like a false warning, no? But not sure how to shut up the warning, using '{ NULL }' would do that but just feels wrong. Any opinions?

Why is this a false warning? The structure is following:

    struct ieee80211_tx_status {
    	struct ieee80211_sta *sta;
    	struct ieee80211_tx_info *info;
    	struct sk_buff *skb;
    	struct rate_info *rate;
    };

And this is a pre-C99 initializer. The equal C99-Initializer would be

    struct ieee80211_tx_status status = {
    	.sta = NULL,
	};

So it is initializing status.sta with 0. But status.sta is a pointer and we should use NULL for pointers instead of plain 0. If you want to initialize the object on stack to zero but not initialize each member then just use {}.

Kind regards,
Sven

#5 lore raw

Re: [RESEND V2 3/4] ath11k: switch to using ieee80211_tx_status_ext()

Quoted 34 lines · Sven Eckelmann

On Tuesday, 11 February 2020 14:10:04 CET Kalle Valo wrote:
[...]

Quoted 12 lines

drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · line 360

Quoted 9 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +1 -0
index 7b532bf9acd8..66a6cfd54ad9 100644
@@ -357,9 +357,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
  				       struct sk_buff *msdu,
  				       struct hal_tx_status *ts)
  {
+	struct ieee80211_tx_status status = { 0 };

This adds a sparse warning:

Quoted 4 lines

drivers/net/wireless/ath/ath11k/dp_tx.c:350:47: warning: Using plain integer as NULL pointer

Seems like a false warning, no? But not sure how to shut up the warning, using '{ NULL }' would do that but just feels wrong. Any opinions?

Why is this a false warning? The structure is following:

     struct ieee80211_tx_status {
     	struct ieee80211_sta *sta;
     	struct ieee80211_tx_info *info;
     	struct sk_buff *skb;
     	struct rate_info *rate;
     };

And this is a pre-C99 initializer. The equal C99-Initializer would be

     struct ieee80211_tx_status status = {
     	.sta = NULL,
	};
Quoted 8 lines

So it is initializing status.sta with 0. But status.sta is a pointer and we should use NULL for pointers instead of plain 0. If you want to initialize the object on stack to zero but not initialize each member then just use {}.

Kind regards,
Sven

yup, i just need to drop the 0 and use {}. I'll respin/send
John

#6 lore raw

Re: [RESEND V2 3/4] ath11k: switch to using ieee80211_tx_status_ext()

In reply to Sven Eckelmann
Quoted 31 lines · Sven Eckelmann

On Tuesday, 11 February 2020 14:10:04 CET Kalle Valo wrote:
[...]

Quoted 12 lines

drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · line 360

Quoted 9 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +1 -0
index 7b532bf9acd8..66a6cfd54ad9 100644
@@ -357,9 +357,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 				       struct sk_buff *msdu,
 				       struct hal_tx_status *ts)
 {
+	struct ieee80211_tx_status status = { 0 };

This adds a sparse warning:

Quoted 5 lines

drivers/net/wireless/ath/ath11k/dp_tx.c:350:47: warning: Using plain integer as NULL pointer

Seems like a false warning, no? But not sure how to shut up the warning, using '{ NULL }' would do that but just feels wrong. Any opinions?

Why is this a false warning? The structure is following:

    struct ieee80211_tx_status {
    	struct ieee80211_sta *sta;
    	struct ieee80211_tx_info *info;
    	struct sk_buff *skb;
    	struct rate_info *rate;
    };

And this is a pre-C99 initializer. The equal C99-Initializer would be

Quoted 8 lines
    struct ieee80211_tx_status status = {
    	.sta = NULL,
	};

So it is initializing status.sta with 0. But status.sta is a pointer and we should use NULL for pointers instead of plain 0. If you want to initialize the object on stack to zero but not initialize each member then just use {}.

Ah, of course. Thanks for pointing this out.

Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

PATCH 4/4 ath11k: add more HE fields into radiotap header

In reply to John Crispin

From: Miles Hu <[email protected]>

This patch adds code to parse HE fields inside ppdu TLVs. Then it adds the populates the additional info into the ratiotap header. Also fix missing QoS tag in native wifi mode. Finally rssi and tsf are also added.

---
 drivers/net/wireless/ath/ath11k/dp_rx.c    | 106 ++++-
 drivers/net/wireless/ath/ath11k/hal_desc.h |   1 +
 drivers/net/wireless/ath/ath11k/hal_rx.c   | 435 +++++++++++++++++++--
 drivers/net/wireless/ath/ath11k/hal_rx.h   | 226 ++++++++++-
 4 files changed, 703 insertions(+), 65 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +87 -19
index 9cf331bdcf16..84428b25cb58 100644
@@ -190,7 +190,7 @@ static u8 *ath11k_dp_rxdesc_get_80211hdr(struct hal_rx_desc *rx_desc)
 {
 	u8 *rx_pkt_hdr;
 
-	rx_pkt_hdr = &rx_desc->msdu_payload[0];
+	rx_pkt_hdr = &rx_desc->hdr_status[0];
 
 	return rx_pkt_hdr;
 }
@@ -2070,7 +2070,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap
 	char tid[32];
 
 	status = IEEE80211_SKB_RXCB(msdu);
-	if (status->encoding == RX_ENC_HE) {
+	if (status->encoding == RX_ENC_HE && !(status->flag & RX_FLAG_RADIOTAP_HE)) {
 		he = skb_push(msdu, sizeof(known));
 		memcpy(he, &known, sizeof(known));
 		status->flag |= RX_FLAG_RADIOTAP_HE;
@@ -3843,11 +3843,14 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
 			    struct ieee80211_rx_status *rxs)
 {
 	struct sk_buff *msdu, *mpdu_buf, *prev_buf;
-	u32 decap_format, wifi_hdr_len;
+	u32 decap_format;
 	struct hal_rx_desc *rx_desc;
 	char *hdr_desc;
 	u8 *dest;
 	struct ieee80211_hdr_3addr *wh;
+	static u32 pkt_type;
+
+	pkt_type++;
 
 	mpdu_buf = NULL;
 
@@ -3880,38 +3883,27 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
 
 		skb_trim(prev_buf, prev_buf->len - HAL_RX_FCS_LEN);
 	} else if (decap_format == DP_RX_DECAP_TYPE_NATIVE_WIFI) {
-		__le16 qos_field;
 		u8 qos_pkt = 0;
 
 		rx_desc = (struct hal_rx_desc *)head_msdu->data;
 		hdr_desc = ath11k_dp_rxdesc_get_80211hdr(rx_desc);
 
 		/* Base size */
-		wifi_hdr_len = sizeof(struct ieee80211_hdr_3addr);
 		wh = (struct ieee80211_hdr_3addr *)hdr_desc;
 
 		if (ieee80211_is_data_qos(wh->frame_control)) {
-			struct ieee80211_qos_hdr *qwh =
-					(struct ieee80211_qos_hdr *)hdr_desc;
-
-			qos_field = qwh->qos_ctrl;
 			qos_pkt = 1;
 		}
 		msdu = head_msdu;
 
 		while (msdu) {
-			rx_desc = (struct hal_rx_desc *)msdu->data;
-			hdr_desc = ath11k_dp_rxdesc_get_80211hdr(rx_desc);
-
+			ath11k_dp_rx_msdus_set_payload(msdu);
 			if (qos_pkt) {
 				dest = skb_push(msdu, sizeof(__le16));
 				if (!dest)
 					goto err_merge_fail;
-				memcpy(dest, hdr_desc, wifi_hdr_len);
-				memcpy(dest + wifi_hdr_len,
-				       (u8 *)&qos_field, sizeof(__le16));
+				memcpy(dest, hdr_desc, sizeof(struct ieee80211_qos_hdr));
 			}
-			ath11k_dp_rx_msdus_set_payload(msdu);
 			prev_buf = msdu;
 			msdu = msdu->next;
 		}
@@ -3941,8 +3933,83 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
 	return NULL;
 }
 
+static void
+ath11k_dp_rx_update_radiotap_he(struct hal_rx_mon_ppdu_info *rx_status,
+				u8 *rtap_buf)
+{
+	u32 rtap_len = 0;
+
+	put_unaligned_le16(rx_status->he_data1, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	put_unaligned_le16(rx_status->he_data2, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	put_unaligned_le16(rx_status->he_data3, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	put_unaligned_le16(rx_status->he_data4, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	put_unaligned_le16(rx_status->he_data5, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	put_unaligned_le16(rx_status->he_data6, &rtap_buf[rtap_len]);
+}
+
+static void
+ath11k_dp_rx_update_radiotap_he_mu(struct hal_rx_mon_ppdu_info *rx_status,
+				   u8 *rtap_buf)
+{
+	u32 rtap_len = 0;
+
+	put_unaligned_le16(rx_status->he_flags1, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	put_unaligned_le16(rx_status->he_flags2, &rtap_buf[rtap_len]);
+	rtap_len += 2;
+
+	rtap_buf[rtap_len] = rx_status->he_RU[0];
+	rtap_len += 1;
+
+	rtap_buf[rtap_len] = rx_status->he_RU[1];
+	rtap_len += 1;
+
+	rtap_buf[rtap_len] = rx_status->he_RU[2];
+	rtap_len += 1;
+
+	rtap_buf[rtap_len] = rx_status->he_RU[3];
+}
+
+static void ath11k_update_radiotap(struct hal_rx_mon_ppdu_info *ppduinfo,
+				   struct sk_buff *mon_skb,
+				   struct ieee80211_rx_status *rxs)
+{
+	u8 *ptr = NULL;
+
+	if (ppduinfo->he_mu_flags) {
+		rxs->flag |= RX_FLAG_RADIOTAP_HE_MU;
+		rxs->encoding = RX_ENC_HE;
+		ptr = skb_push(mon_skb, sizeof(struct ieee80211_radiotap_he_mu));
+		ath11k_dp_rx_update_radiotap_he_mu(ppduinfo, ptr);
+	}
+	if (ppduinfo->he_flags) {
+		rxs->flag |= RX_FLAG_RADIOTAP_HE;
+		rxs->encoding = RX_ENC_HE;
+		ptr = skb_push(mon_skb, sizeof(struct ieee80211_radiotap_he));
+		ath11k_dp_rx_update_radiotap_he(ppduinfo, ptr);
+	}
+
+	rxs->flag |= RX_FLAG_MACTIME_START;
+	rxs->signal = ppduinfo->rssi_comb + ATH11K_DEFAULT_NOISE_FLOOR;
+	rxs->nss = ppduinfo->nss;
+
+	rxs->mactime = ppduinfo->tsft;
+}
+
 static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id,
 				    struct sk_buff *head_msdu,
+				    struct hal_rx_mon_ppdu_info *ppduinfo,
 				    struct sk_buff *tail_msdu,
 				    struct napi_struct *napi)
 {
@@ -3972,11 +4039,9 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id,
 		} else {
 			rxs->flag |= RX_FLAG_ALLOW_SAME_PN;
 		}
-		rxs->flag |= RX_FLAG_ONLY_MONITOR;
-
+		ath11k_update_radiotap(ppduinfo, mon_skb, rxs);
 		status = IEEE80211_SKB_RXCB(mon_skb);
 		*status = *rxs;
-
 		ath11k_dp_rx_deliver_msdu(ar, napi, mon_skb);
 		mon_skb = skb_next;
 	} while (mon_skb);
@@ -4043,6 +4108,7 @@ static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, u32 quota,
 		}
 		if (head_msdu && tail_msdu) {
 			ath11k_dp_rx_mon_deliver(ar, dp->mac_id, head_msdu,
+						 &pmon->mon_ppdu_info,
 						 tail_msdu, napi);
 			rx_mon_stats->dest_mpdu_done++;
 		}
@@ -4083,6 +4149,8 @@ static void ath11k_dp_rx_mon_status_process_tlv(struct ath11k *ar,
 	while (!skb_queue_empty(&pmon->rx_status_q)) {
 		status_skb = skb_dequeue(&pmon->rx_status_q);
 
+		memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info));
+
 		tlv_status = ath11k_hal_rx_parse_mon_status(ar->ab, ppdu_info,
 							    status_skb);
 		if (tlv_status == HAL_TLV_STATUS_PPDU_DONE) {
drivers/net/wireless/ath/ath11k/hal_desc.h +1 -0
index 5e200380cca4..c33f628a0958 100644
@@ -472,6 +472,7 @@ enum hal_tlv_tag {
 
 #define HAL_TLV_HDR_TAG		GENMASK(9, 1)
 #define HAL_TLV_HDR_LEN		GENMASK(25, 10)
+#define HAL_TLV_USR_ID		GENMASK(31, 26)
 
 #define HAL_TLV_ALIGN	4
 
drivers/net/wireless/ath/ath11k/hal_rx.c +394 -41

550 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/hal_rx.h +221 -5

300 lines not on this page · raw message

Signature · 1 line
2.20.1
#8 lore raw

Re: [PATCH 4/4] ath11k: add more HE fields into radiotap header

Quoted 8 lines · John Crispin

From: Miles Hu <[email protected]>

This patch adds code to parse HE fields inside ppdu TLVs. Then it adds the populates the additional info into the ratiotap header. Also fix missing QoS tag in native wifi mode. Finally rssi and tsf are also added.

John's s-o-b missing and loads of warnings:

drivers/net/wireless/ath/ath11k/hal_rx.c: In function 'ath11k_hal_rx_parse_mon_status_tlv':
drivers/net/wireless/ath/ath11k/hal_rx.c:1074:13: warning: variable 'cp_ltf' set but not used [-Wunused-but-set-variable] drivers/net/wireless/ath/ath11k/hal_rx.c:822:48: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath11k/hal_rx.c:822:48: expected unsigned int [usertype] ul_ofdma_user_v0_word0
drivers/net/wireless/ath/ath11k/hal_rx.c:822:48: got restricted __le32 [usertype] info6
drivers/net/wireless/ath/ath11k/hal_rx.c:824:48: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath11k/hal_rx.c:824:48: expected unsigned int [usertype] ul_ofdma_user_v0_word1
drivers/net/wireless/ath/ath11k/hal_rx.c:824:48: got restricted __le32
drivers/net/wireless/ath/ath11k/hal_rx.c:835:17: warning: cast to restricted __le32 drivers/net/wireless/ath/ath11k/hal_rx.c:835:17: warning: restricted __le32 degrades to integer drivers/net/wireless/ath/ath11k/hal_rx.c:835:17: warning: restricted __le32 degrades to integer drivers/net/wireless/ath/ath11k/hal_rx.c:838:17: warning: cast to restricted __le32 drivers/net/wireless/ath/ath11k/hal_rx.c:838:17: warning: restricted __le32 degrades to integer drivers/net/wireless/ath/ath11k/hal_rx.c:838:17: warning: restricted __le32 degrades to integer drivers/net/wireless/ath/ath11k/hal_rx.c:951:60: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath11k/hal_rx.c:951:60: expected unsigned int
drivers/net/wireless/ath/ath11k/hal_rx.c:951:60: got restricted __le32
drivers/net/wireless/ath/ath11k/hal_rx.c:952:60: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath11k/hal_rx.c:952:60: expected unsigned int
drivers/net/wireless/ath/ath11k/hal_rx.c:952:60: got restricted __le32
drivers/net/wireless/ath/ath11k/hal_rx.c:1469:33: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath11k/hal_rx.c:1469:33: expected unsigned long long [usertype] tsft
drivers/net/wireless/ath/ath11k/hal_rx.c:1469:33: got restricted __le32
drivers/net/wireless/ath/ath11k/hal_rx.c:1470:84: warning: restricted __le32 degrades to integer drivers/net/wireless/ath/ath11k/dp_rx.c:3894: braces {} are not necessary for single statement blocks

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#9 lore raw
In reply to John Crispin
Quoted 6 lines · John Crispin

We will start using ieee80211_tx_status_ext() so we do not need to track tx rates inside a struct ieee80211_tx_info. It is currently not possible to populate that struct with HE rate info anyhow.

2 patches applied to ath-next branch of ath.git, thanks.

be43ce646b93 ath11k: drop tx_info from ath11k_sta 6a0c370259c7 ath11k: add HE rate accounting to driver

Signature · 3 lines
https://patchwork.kernel.org/patch/11364815/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#10 lore raw
In reply to John Crispin
Quoted 6 lines · John Crispin

We will start using ieee80211_tx_status_ext() so we do not need to track tx rates inside a struct ieee80211_tx_info. It is currently not possible to populate that struct with HE rate info anyhow.

2 patches applied to ath-next branch of ath.git, thanks.

be43ce646b93 ath11k: drop tx_info from ath11k_sta 6a0c370259c7 ath11k: add HE rate accounting to driver

Signature · 8 lines
https://patchwork.kernel.org/patch/11364815/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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