2024-02-12 12:17:45

by Hari Chandrakanthan

[permalink] [raw]
Subject: [PATCH 0/2] wifi: cfg80211/ath12k: Add support to rx retry stats

This patch series adds support to count station level rx retries.

wifi: cfg80211: Add support to rx retry stats
wifi: ath12k: Add support to rx retry stats

Tested-on: QCN9274 hw1.0 PCI WLAN.WBE.1.2.1-00148-QCAHKSWPL_SILICONZ-1

Hari Chandrakanthan (2):
wifi: cfg80211: Add support to rx retry stats
wifi: ath12k: Add support to rx retry stats

drivers/net/wireless/ath/ath12k/core.h | 1 +
drivers/net/wireless/ath/ath12k/dp_mon.c | 7 +++++++
drivers/net/wireless/ath/ath12k/hal_rx.h | 7 ++++++-
drivers/net/wireless/ath/ath12k/mac.c | 3 +++
include/net/cfg80211.h | 2 ++
include/uapi/linux/nl80211.h | 3 +++
net/wireless/nl80211.c | 1 +
7 files changed, 23 insertions(+), 1 deletion(-)

--
2.34.1



2024-02-12 12:19:13

by Hari Chandrakanthan

[permalink] [raw]
Subject: [PATCH 1/2] wifi: cfg80211: Add support to rx retry stats

Add support to count station level rx retries.
It denotes the number of data frames(MPDUs) with rx retry bit set.

The rx retry stats helps in understanding the medium
during UL transmission.

Signed-off-by: Hari Chandrakanthan <[email protected]>
---
include/net/cfg80211.h | 2 ++
include/uapi/linux/nl80211.h | 3 +++
net/wireless/nl80211.c | 1 +
3 files changed, 6 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b137a33a1b68..0623942b1f09 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1995,6 +1995,7 @@ struct cfg80211_tid_stats {
* @rxrate: current unicast bitrate to this station
* @rx_packets: packets (MSDUs & MMPDUs) received from this station
* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
+ * @rx_retries: number of rx packets(MPDUs) from this station with retry bit set.
* @tx_retries: cumulative retry counts (MPDUs)
* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
* @rx_dropped_misc: Dropped for un-specified reason.
@@ -2075,6 +2076,7 @@ struct station_info {
struct rate_info rxrate;
u32 rx_packets;
u32 tx_packets;
+ u32 rx_retries;
u32 tx_retries;
u32 tx_failed;
u32 rx_dropped_misc;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dced2c49daec..5eee77409f00 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3846,6 +3846,8 @@ enum nl80211_sta_bss_param {
* of STA's association
* @NL80211_STA_INFO_CONNECTED_TO_AS: set to true if STA has a path to a
* authentication server (u8, 0 or 1)
+ * @NL80211_STA_INFO_RX_RETRIES: number of rx packets(MPDUs) from this station
+ * with retry bit set (u32)
* @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute
*/
@@ -3894,6 +3896,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_AIRTIME_LINK_METRIC,
NL80211_STA_INFO_ASSOC_AT_BOOTTIME,
NL80211_STA_INFO_CONNECTED_TO_AS,
+ NL80211_STA_INFO_RX_RETRIES,

/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 569234bc2be6..4aca00520bff 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6613,6 +6613,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,

PUT_SINFO(RX_PACKETS, rx_packets, u32);
PUT_SINFO(TX_PACKETS, tx_packets, u32);
+ PUT_SINFO(RX_RETRIES, rx_retries, u32);
PUT_SINFO(TX_RETRIES, tx_retries, u32);
PUT_SINFO(TX_FAILED, tx_failed, u32);
PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32);
--
2.34.1


2024-02-12 12:19:15

by Hari Chandrakanthan

[permalink] [raw]
Subject: [PATCH 2/2] wifi: ath12k: Add support to rx retry stats

Add support to count station level rx retries.
It denotes the number of data frames(MPDUs) received with rx retry bit
set.

The rx retry stats helps in understanding the medium during
UL transmission.

Tested-on: QCN9274 hw1.0 PCI WLAN.WBE.1.2.1-00148-QCAHKSWPL_SILICONZ-1

Signed-off-by: Hari Chandrakanthan <[email protected]>
---
drivers/net/wireless/ath/ath12k/core.h | 1 +
drivers/net/wireless/ath/ath12k/dp_mon.c | 7 +++++++
drivers/net/wireless/ath/ath12k/hal_rx.h | 7 ++++++-
drivers/net/wireless/ath/ath12k/mac.c | 3 +++
4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 6dbe817d2ec7..9a73c90818a0 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -415,6 +415,7 @@ struct ath12k_sta {
struct ath12k_rx_peer_stats *rx_stats;
struct ath12k_wbm_tx_stats *wbm_tx_stats;
u32 bw_prev;
+ u32 rx_retries;
};

#define ATH12K_MIN_5G_FREQ 4150
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index f44bc5494ce7..aa46661bc1c0 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -774,9 +774,11 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab,
u16 peer_id;

info[1] = __le32_to_cpu(mpdu_start->info1);
+ info[3] = __le32_to_cpu(mpdu_start->info3);
peer_id = u32_get_bits(info[1], HAL_RX_MPDU_START_INFO1_PEERID);
if (peer_id)
ppdu_info->peer_id = peer_id;
+ ppdu_info->mpdu_retry = info[3] & HAL_RX_MPDU_START_INFO3_MPDU_RETRY;

ppdu_info->mpdu_len += u32_get_bits(info[1],
HAL_RX_MPDU_START_INFO2_MPDU_LEN);
@@ -785,6 +787,8 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab,
ppdu_info->userid = userid;
ppdu_info->ampdu_id[userid] =
u32_get_bits(info[0], HAL_RX_MPDU_START_INFO1_PEERID);
+ ppdu_info->userstats[userid].mpdu_retry = info[3] & HAL_RX_MPDU_START_INFO3_MPDU_RETRY;
+
}

mon_mpdu = kzalloc(sizeof(*mon_mpdu), GFP_ATOMIC);
@@ -2207,6 +2211,8 @@ static void ath12k_dp_mon_rx_update_peer_su_stats(struct ath12k *ar,
struct ath12k_rx_peer_stats *rx_stats = arsta->rx_stats;
u32 num_msdu;

+ arsta->rx_retries += ppdu_info->mpdu_retry;
+
if (!rx_stats)
return;

@@ -2376,6 +2382,7 @@ ath12k_dp_mon_rx_update_user_stats(struct ath12k *ar,

arsta = ath12k_sta_to_arsta(peer->sta);
rx_stats = arsta->rx_stats;
+ arsta->rx_retries = user_stats->mpdu_retry;

if (!rx_stats)
return;
diff --git a/drivers/net/wireless/ath/ath12k/hal_rx.h b/drivers/net/wireless/ath/ath12k/hal_rx.h
index fcfb6c819047..da195c815db8 100644
--- a/drivers/net/wireless/ath/ath12k/hal_rx.h
+++ b/drivers/net/wireless/ath/ath12k/hal_rx.h
@@ -142,6 +142,7 @@ struct hal_rx_user_status {
u32 mpdu_fcs_ok_bitmap[HAL_RX_NUM_WORDS_PER_PPDU_BITMAP];
u32 mpdu_ok_byte_count;
u32 mpdu_err_byte_count;
+ bool mpdu_retry;
};

#define HAL_MAX_UL_MU_USERS 37
@@ -229,6 +230,7 @@ struct hal_rx_mon_ppdu_info {
bool first_msdu_in_mpdu;
bool is_ampdu;
u8 medium_prot_type;
+ bool mpdu_retry;
};

#define HAL_RX_PPDU_START_INFO0_PPDU_ID GENMASK(15, 0)
@@ -446,10 +448,13 @@ struct hal_rx_phyrx_rssi_legacy_info {
#define HAL_RX_MPDU_START_INFO0_PPDU_ID GENMASK(31, 16)
#define HAL_RX_MPDU_START_INFO1_PEERID GENMASK(31, 16)
#define HAL_RX_MPDU_START_INFO2_MPDU_LEN GENMASK(13, 0)
+#define HAL_RX_MPDU_START_INFO3_MPDU_RETRY BIT(19)
struct hal_rx_mpdu_start {
__le32 info0;
__le32 info1;
- __le32 rsvd1[11];
+ __le32 rsvd1[8];
+ __le32 info3;
+ __le32 rsvd3[2];
__le32 info2;
__le32 rsvd2[9];
} __packed;
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index fc0d14ea328e..fed46b9fdd72 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7078,6 +7078,9 @@ static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw,
/* TODO: Use real NF instead of default one. */
sinfo->signal = arsta->rssi_comb + ATH12K_DEFAULT_NOISE_FLOOR;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
+
+ sinfo->rx_retries = arsta->rx_retries;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_RETRIES);
}

static const struct ieee80211_ops ath12k_ops = {
--
2.34.1


2024-02-12 12:55:31

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 0/2] wifi: cfg80211/ath12k: Add support to rx retry stats

On Mon, 2024-02-12 at 17:46 +0530, Hari Chandrakanthan wrote:
> This patch series adds support to count station level rx retries.
>
> wifi: cfg80211: Add support to rx retry stats
> wifi: ath12k: Add support to rx retry stats
>
> Tested-on: QCN9274 hw1.0 PCI WLAN.WBE.1.2.1-00148-QCAHKSWPL_SILICONZ-1
>
> Hari Chandrakanthan (2):
> wifi: cfg80211: Add support to rx retry stats
> wifi: ath12k: Add support to rx retry stats

There's trivial work here to expose them from mac80211, so please do
that. Also not entirely sure then why you need it in ath12k, but perhaps
if it's already done header conversion?

johannes

2024-02-25 14:55:34

by Hari Chandrakanthan

[permalink] [raw]
Subject: Re: [PATCH 0/2] wifi: cfg80211/ath12k: Add support to rx retry stats


On 2/12/2024 6:25 PM, Johannes Berg wrote:
> On Mon, 2024-02-12 at 17:46 +0530, Hari Chandrakanthan wrote:
>> This patch series adds support to count station level rx retries.
>>
>> wifi: cfg80211: Add support to rx retry stats
>> wifi: ath12k: Add support to rx retry stats
>>
>> Tested-on: QCN9274 hw1.0 PCI WLAN.WBE.1.2.1-00148-QCAHKSWPL_SILICONZ-1
>>
>> Hari Chandrakanthan (2):
>> wifi: cfg80211: Add support to rx retry stats
>> wifi: ath12k: Add support to rx retry stats
> There's trivial work here to expose them from mac80211, so please do
> that. Also not entirely sure then why you need it in ath12k, but perhaps
> if it's already done header conversion?
>
> johannes

When RX_FLAG_8023 is set, the rx skb contains 802.3 header.
Also the flag member(u32) in struct ieee80211_rx_status is also completely
utilized. can we extend it to u64 and use a bit in the u64 to indicate
that retry bit
is set in 802.11 header when rx decap is offloaded?