ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] mac80211: increment rx stats according to USES_RSS flag
@ 2021-02-17 11:56 Thiraviyam Mariyappan
  2021-04-08  9:39 ` Johannes Berg
  2021-04-08 10:01 ` Johannes Berg
  0 siblings, 2 replies; 6+ messages in thread
From: Thiraviyam Mariyappan @ 2021-02-17 11:56 UTC (permalink / raw)
  To: ath11k; +Cc: Thiraviyam Mariyappan, linux-wireless

Currently, rx_stats were updated regardless of USES_RSS flag is
enabled/disabled. So, updating the rx_stats from percpu pointers
according to the USES_RSS flag.

Signed-off-by: Thiraviyam Mariyappan <tmariyap@codeaurora.org>
---
v2:
*Subject(mac80211: fix rx byte values not updated on mesh link) and commit
log changed.
---
 net/mac80211/mesh.h       |  2 ++
 net/mac80211/mesh_plink.c |  4 ++-
 net/mac80211/rx.c         | 75 +++++++++++++++++++++++++++++++----------------
 3 files changed, 55 insertions(+), 26 deletions(-)

diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 40492d1..c8d9103 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -318,6 +318,8 @@ void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata,
 void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata);
 
 bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt);
+struct ieee80211_sta_rx_stats *ieee80211_get_rx_stats(struct ieee80211_hw *hw,
+						      struct sta_info *sta);
 
 #ifdef CONFIG_MAC80211_MESH
 static inline
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index aca26df..44b6ebb 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -416,6 +416,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_supported_band *sband;
 	u32 rates, basic_rates = 0, changed = 0;
 	enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth;
+	struct ieee80211_sta_rx_stats *stats;
 
 	sband = ieee80211_get_sband(sdata);
 	if (!sband)
@@ -425,7 +426,8 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
 					&basic_rates);
 
 	spin_lock_bh(&sta->mesh->plink_lock);
-	sta->rx_stats.last_rx = jiffies;
+	stats = ieee80211_get_rx_stats(&local->hw, sta);
+	stats->last_rx = jiffies;
 
 	/* rates and capabilities don't change during peering */
 	if (sta->mesh->plink_state == NL80211_PLINK_ESTAB &&
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index c1343c0..7c06ea2 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -78,6 +78,15 @@ static struct sk_buff *ieee80211_clean_skb(struct sk_buff *skb,
 	return skb;
 }
 
+struct ieee80211_sta_rx_stats *ieee80211_get_rx_stats(struct ieee80211_hw *hw,
+						      struct sta_info *sta)
+{
+	if (ieee80211_hw_check(hw, USES_RSS))
+		return this_cpu_ptr(sta->pcpu_rx_stats);
+	else
+		return &sta->rx_stats;
+}
+
 static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len,
 				     unsigned int rtap_space)
 {
@@ -1720,11 +1729,13 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 	struct sk_buff *skb = rx->skb;
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+	struct ieee80211_sta_rx_stats *stats;
 	int i;
 
 	if (!sta)
 		return RX_CONTINUE;
 
+	stats = ieee80211_get_rx_stats(&rx->sdata->local->hw, sta);
 	/*
 	 * Update last_rx only for IBSS packets which are for the current
 	 * BSSID and for station already AUTHORIZED to avoid keeping the
@@ -1734,49 +1745,49 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 	 * something went wrong the first time.
 	 */
 	if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
-		u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
+		u8 *bssid = ieee80211_get_bssid(hdr, skb->len,
 						NL80211_IFTYPE_ADHOC);
 		if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) &&
 		    test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
-			sta->rx_stats.last_rx = jiffies;
+			stats->last_rx = jiffies;
 			if (ieee80211_is_data(hdr->frame_control) &&
 			    !is_multicast_ether_addr(hdr->addr1))
-				sta->rx_stats.last_rate =
+				stats->last_rate =
 					sta_stats_encode_rate(status);
 		}
 	} else if (rx->sdata->vif.type == NL80211_IFTYPE_OCB) {
-		sta->rx_stats.last_rx = jiffies;
+		stats->last_rx = jiffies;
 	} else if (!ieee80211_is_s1g_beacon(hdr->frame_control) &&
 		   !is_multicast_ether_addr(hdr->addr1)) {
 		/*
 		 * Mesh beacons will update last_rx when if they are found to
 		 * match the current local configuration when processed.
 		 */
-		sta->rx_stats.last_rx = jiffies;
+		stats->last_rx = jiffies;
 		if (ieee80211_is_data(hdr->frame_control))
-			sta->rx_stats.last_rate = sta_stats_encode_rate(status);
+			stats->last_rate = sta_stats_encode_rate(status);
 	}
 
-	sta->rx_stats.fragments++;
+	stats->fragments++;
 
-	u64_stats_update_begin(&rx->sta->rx_stats.syncp);
-	sta->rx_stats.bytes += rx->skb->len;
-	u64_stats_update_end(&rx->sta->rx_stats.syncp);
+	u64_stats_update_begin(&stats->syncp);
+	stats->bytes += skb->len;
+	u64_stats_update_end(&stats->syncp);
 
 	if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
-		sta->rx_stats.last_signal = status->signal;
+		stats->last_signal = status->signal;
 		ewma_signal_add(&sta->rx_stats_avg.signal, -status->signal);
 	}
 
 	if (status->chains) {
-		sta->rx_stats.chains = status->chains;
+		stats->chains = status->chains;
 		for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) {
 			int signal = status->chain_signal[i];
 
 			if (!(status->chains & BIT(i)))
 				continue;
 
-			sta->rx_stats.chain_signal_last[i] = signal;
+			stats->chain_signal_last[i] = signal;
 			ewma_signal_add(&sta->rx_stats_avg.chain_signal[i],
 					-signal);
 		}
@@ -1838,8 +1849,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 		 * Update counter and free packet here to avoid
 		 * counting this as a dropped packed.
 		 */
-		sta->rx_stats.packets++;
-		dev_kfree_skb(rx->skb);
+		stats->packets++;
+		dev_kfree_skb(skb);
 		return RX_QUEUED;
 	}
 
@@ -2202,6 +2213,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
 	unsigned int frag, seq;
 	struct ieee80211_fragment_entry *entry;
 	struct sk_buff *skb;
+	struct ieee80211_sta_rx_stats *stats;
 
 	hdr = (struct ieee80211_hdr *)rx->skb->data;
 	fc = hdr->frame_control;
@@ -2330,8 +2342,10 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
  out:
 	ieee80211_led_rx(rx->local);
  out_no_led:
-	if (rx->sta)
-		rx->sta->rx_stats.packets++;
+	if (rx->sta) {
+		stats = ieee80211_get_rx_stats(&rx->sdata->local->hw, rx->sta);
+		stats->packets++;
+	}
 	return RX_CONTINUE;
 }
 
@@ -3124,6 +3138,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
 	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data;
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
 	int len = rx->skb->len;
+	struct ieee80211_sta_rx_stats *stats;
 
 	if (!ieee80211_is_action(mgmt->frame_control))
 		return RX_CONTINUE;
@@ -3405,16 +3420,20 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
 	return RX_CONTINUE;
 
  handled:
-	if (rx->sta)
-		rx->sta->rx_stats.packets++;
+	if (rx->sta) {
+		stats = ieee80211_get_rx_stats(&local->hw, rx->sta);
+		stats->packets++;
+	}
 	dev_kfree_skb(rx->skb);
 	return RX_QUEUED;
 
  queue:
 	skb_queue_tail(&sdata->skb_queue, rx->skb);
 	ieee80211_queue_work(&local->hw, &sdata->work);
-	if (rx->sta)
-		rx->sta->rx_stats.packets++;
+	if (rx->sta) {
+		stats = ieee80211_get_rx_stats(&local->hw, rx->sta);
+		stats->packets++;
+	}
 	return RX_QUEUED;
 }
 
@@ -3457,6 +3476,7 @@ ieee80211_rx_h_action_post_userspace(struct ieee80211_rx_data *rx)
 	struct ieee80211_sub_if_data *sdata = rx->sdata;
 	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data;
 	int len = rx->skb->len;
+	struct ieee80211_sta_rx_stats *stats;
 
 	if (!ieee80211_is_action(mgmt->frame_control))
 		return RX_CONTINUE;
@@ -3480,8 +3500,10 @@ ieee80211_rx_h_action_post_userspace(struct ieee80211_rx_data *rx)
 	return RX_CONTINUE;
 
  handled:
-	if (rx->sta)
-		rx->sta->rx_stats.packets++;
+	if (rx->sta) {
+		stats = ieee80211_get_rx_stats(&rx->sdata->local->hw, rx->sta);
+		stats->packets++;
+	}
 	dev_kfree_skb(rx->skb);
 	return RX_QUEUED;
 }
@@ -3575,6 +3597,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
 {
 	struct ieee80211_sub_if_data *sdata = rx->sdata;
 	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
+	struct ieee80211_sta_rx_stats *stats;
 	__le16 stype;
 
 	stype = mgmt->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE);
@@ -3625,8 +3648,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
 	/* queue up frame and kick off work to process it */
 	skb_queue_tail(&sdata->skb_queue, rx->skb);
 	ieee80211_queue_work(&rx->local->hw, &sdata->work);
-	if (rx->sta)
-		rx->sta->rx_stats.packets++;
+	if (rx->sta) {
+		stats = ieee80211_get_rx_stats(&rx->sdata->local->hw, rx->sta);
+		stats->packets++;
+	}
 
 	return RX_QUEUED;
 }
-- 
2.7.4


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mac80211: increment rx stats according to USES_RSS flag
  2021-02-17 11:56 [PATCHv2] mac80211: increment rx stats according to USES_RSS flag Thiraviyam Mariyappan
@ 2021-04-08  9:39 ` Johannes Berg
  2021-04-08 10:01 ` Johannes Berg
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2021-04-08  9:39 UTC (permalink / raw)
  To: Thiraviyam Mariyappan, ath11k; +Cc: linux-wireless

On Wed, 2021-02-17 at 17:26 +0530, Thiraviyam Mariyappan wrote:
> Currently, rx_stats were updated regardless of USES_RSS flag is
> enabled/disabled. So, updating the rx_stats from percpu pointers
> according to the USES_RSS flag.

I guess I'll fix it this time, but the commit log is still not saying
what it should.

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

Please, everyone @codeaurora, pay attention. I don't want to have this
discussion for every patch.

johannes


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mac80211: increment rx stats according to USES_RSS flag
  2021-02-17 11:56 [PATCHv2] mac80211: increment rx stats according to USES_RSS flag Thiraviyam Mariyappan
  2021-04-08  9:39 ` Johannes Berg
@ 2021-04-08 10:01 ` Johannes Berg
  2021-04-21 16:48   ` Thiraviyam Mariyappan
  1 sibling, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2021-04-08 10:01 UTC (permalink / raw)
  To: Thiraviyam Mariyappan, ath11k; +Cc: linux-wireless

On Wed, 2021-02-17 at 17:26 +0530, Thiraviyam Mariyappan wrote:
> Currently, rx_stats were updated regardless of USES_RSS flag is
> enabled/disabled. So, updating the rx_stats from percpu pointers
> according to the USES_RSS flag.

OK actually, I'm not going to fix the commit log, you'll probably have
to resend it anyway.


> @@ -425,7 +426,8 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
>  					&basic_rates);

>  	spin_lock_bh(&sta->mesh->plink_lock);
> -	sta->rx_stats.last_rx = jiffies;
> +	stats = ieee80211_get_rx_stats(&local->hw, sta);
> +	stats->last_rx = jiffies;

This doesn't really make much sense? Not sure why that is even updating
anything at all, it doesn't update anything else?

Or at least you didn't change anything else, maybe you should have?
> 
> @@ -1734,49 +1745,49 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
>  	 * something went wrong the first time.
>  	 */
>  	if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
> -		u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
> +		u8 *bssid = ieee80211_get_bssid(hdr, skb->len,

That seems unrelated.

> @@ -3625,8 +3648,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
>  	/* queue up frame and kick off work to process it */
>  	skb_queue_tail(&sdata->skb_queue, rx->skb);
>  	ieee80211_queue_work(&rx->local->hw, &sdata->work);
> -	if (rx->sta)
> -		rx->sta->rx_stats.packets++;
> +	if (rx->sta) {
> +		stats = ieee80211_get_rx_stats(&rx->sdata->local->hw, rx->sta);
> +		stats->packets++;
> +	}
> 

Picking this for no particular reason - everything else in this patch is
unnecessary since we have rx_path_lock held afaict, so it doesn't
matter. The whole per-cpu status stuff only matters once you get into
fast-rx path.


I'd argue that had you written a proper commit log that actually says
why you need to change things, you'd probably even have noticed these
issues yourself.

johannes


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mac80211: increment rx stats according to USES_RSS flag
  2021-04-08 10:01 ` Johannes Berg
@ 2021-04-21 16:48   ` Thiraviyam Mariyappan
  2021-04-23  7:58     ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Thiraviyam Mariyappan @ 2021-04-21 16:48 UTC (permalink / raw)
  To: Johannes Berg; +Cc: ath11k, linux-wireless

On 2021-04-08 15:31, Johannes Berg wrote:
> On Wed, 2021-02-17 at 17:26 +0530, Thiraviyam Mariyappan wrote:
>> Currently, rx_stats were updated regardless of USES_RSS flag is
>> enabled/disabled. So, updating the rx_stats from percpu pointers
>> according to the USES_RSS flag.
The issue is rx packets not incremented in mesh link and this change 
made to
overcome the issue.
> 
> OK actually, I'm not going to fix the commit log, you'll probably have
> to resend it anyway.
> 
> 
>> @@ -425,7 +426,8 @@ static void mesh_sta_info_init(struct 
>> ieee80211_sub_if_data *sdata,
>>  					&basic_rates);
> 
>>  	spin_lock_bh(&sta->mesh->plink_lock);
>> -	sta->rx_stats.last_rx = jiffies;
>> +	stats = ieee80211_get_rx_stats(&local->hw, sta);
>> +	stats->last_rx = jiffies;
> 
> This doesn't really make much sense? Not sure why that is even updating
> anything at all, it doesn't update anything else?
> 
> Or at least you didn't change anything else, maybe you should have?
>> 
>> @@ -1734,49 +1745,49 @@ ieee80211_rx_h_sta_process(struct 
>> ieee80211_rx_data *rx)
>>  	 * something went wrong the first time.
>>  	 */
>>  	if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
>> -		u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
>> +		u8 *bssid = ieee80211_get_bssid(hdr, skb->len,
> 
> That seems unrelated.
> 
>> @@ -3625,8 +3648,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data 
>> *rx)
>>  	/* queue up frame and kick off work to process it */
>>  	skb_queue_tail(&sdata->skb_queue, rx->skb);
>>  	ieee80211_queue_work(&rx->local->hw, &sdata->work);
>> -	if (rx->sta)
>> -		rx->sta->rx_stats.packets++;
>> +	if (rx->sta) {
>> +		stats = ieee80211_get_rx_stats(&rx->sdata->local->hw, rx->sta);
>> +		stats->packets++;
>> +	}
>> 
> 
> Picking this for no particular reason - everything else in this patch 
> is
> unnecessary since we have rx_path_lock held afaict, so it doesn't
> matter. The whole per-cpu status stuff only matters once you get into
> fast-rx path.
In case of Mesh fast_rx is not applicable, but still USES_RSS can be 
enabled from driver
when parallel RX is supported by HW/Driver, right? Hence checked for 
USES_RSS support to
update per cpu stats.Please correct me if the meaning of USES_RSS is 
misunderstood and
it applies only when fast_rx for a STA is enabled.
> 
> 
> I'd argue that had you written a proper commit log that actually says
> why you need to change things, you'd probably even have noticed these
> issues yourself.
> 
> johannes

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mac80211: increment rx stats according to USES_RSS flag
  2021-04-21 16:48   ` Thiraviyam Mariyappan
@ 2021-04-23  7:58     ` Johannes Berg
  2021-05-06 17:49       ` Thiraviyam Mariyappan
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2021-04-23  7:58 UTC (permalink / raw)
  To: Thiraviyam Mariyappan; +Cc: ath11k, linux-wireless

On Wed, 2021-04-21 at 22:18 +0530, Thiraviyam Mariyappan wrote:
> In case of Mesh fast_rx is not applicable, but still USES_RSS can be
> enabled from driver when parallel RX is supported by HW/Driver,
> right? 

Yes, I guess that's true.

> Hence checked for USES_RSS support to update per cpu stats.Please
> correct me if the meaning of USES_RSS is misunderstood and it applies
> only when fast_rx for a STA is enabled.
> 

Well, actually using multi-queue is pointless or even counter-productive
when you don't have fast-RX, since then you'll run into a common lock,
and doing much processing on multiple CPUs but under a common lock might
well be worse than doing it on a single CPU in the first place, since
you'll bounce the lock around all the time.

However, you're right that the driver might generally advertise
USES_RSS, but then not do it for mesh, but that throws off some
statistics.

Something like this might then be a much better fix though?


diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index ec6973ee88ef..f87e883862d9 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2092,7 +2092,7 @@ sta_get_last_rx_stats(struct sta_info *sta)
 	struct ieee80211_local *local = sta->local;
 	int cpu;
 
-	if (!ieee80211_hw_check(&local->hw, USES_RSS))
+	if (!sta->pcpu_rx_stats)
 		return stats;
 
 	for_each_possible_cpu(cpu) {
@@ -2192,9 +2192,7 @@ static void sta_set_tidstats(struct sta_info *sta,
 	int cpu;
 
 	if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) {
-		if (!ieee80211_hw_check(&local->hw, USES_RSS))
-			tidstats->rx_msdu +=
-				sta_get_tidstats_msdu(&sta->rx_stats, tid);
+		tidstats->rx_msdu += sta_get_tidstats_msdu(&sta->rx_stats, tid);
 
 		if (sta->pcpu_rx_stats) {
 			for_each_possible_cpu(cpu) {
@@ -2308,8 +2306,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
 
 	if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) |
 			       BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) {
-		if (!ieee80211_hw_check(&local->hw, USES_RSS))
-			sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats);
+		sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats);
 
 		if (sta->pcpu_rx_stats) {
 			for_each_possible_cpu(cpu) {


johannes


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] mac80211: increment rx stats according to USES_RSS flag
  2021-04-23  7:58     ` Johannes Berg
@ 2021-05-06 17:49       ` Thiraviyam Mariyappan
  0 siblings, 0 replies; 6+ messages in thread
From: Thiraviyam Mariyappan @ 2021-05-06 17:49 UTC (permalink / raw)
  To: Johannes Berg; +Cc: ath11k, linux-wireless

On 2021-04-23 13:28, Johannes Berg wrote:
> On Wed, 2021-04-21 at 22:18 +0530, Thiraviyam Mariyappan wrote:
>> In case of Mesh fast_rx is not applicable, but still USES_RSS can be
>> enabled from driver when parallel RX is supported by HW/Driver,
>> right? 
> 
> Yes, I guess that's true.
> 
>> Hence checked for USES_RSS support to update per cpu stats.Please
>> correct me if the meaning of USES_RSS is misunderstood and it applies
>> only when fast_rx for a STA is enabled.
>> 
> 
> Well, actually using multi-queue is pointless or even 
> counter-productive
> when you don't have fast-RX, since then you'll run into a common lock,
> and doing much processing on multiple CPUs but under a common lock 
> might
> well be worse than doing it on a single CPU in the first place, since
> you'll bounce the lock around all the time.
> 
> However, you're right that the driver might generally advertise
> USES_RSS, but then not do it for mesh, but that throws off some
> statistics.
> 
> Something like this might then be a much better fix though?
Below fix good to me and working fine.
> 
> 
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index ec6973ee88ef..f87e883862d9 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -2092,7 +2092,7 @@ sta_get_last_rx_stats(struct sta_info *sta)
>  	struct ieee80211_local *local = sta->local;
>  	int cpu;
> 
> -	if (!ieee80211_hw_check(&local->hw, USES_RSS))
> +	if (!sta->pcpu_rx_stats)
>  		return stats;
> 
>  	for_each_possible_cpu(cpu) {
> @@ -2192,9 +2192,7 @@ static void sta_set_tidstats(struct sta_info 
> *sta,
>  	int cpu;
> 
>  	if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) {
> -		if (!ieee80211_hw_check(&local->hw, USES_RSS))
> -			tidstats->rx_msdu +=
> -				sta_get_tidstats_msdu(&sta->rx_stats, tid);
> +		tidstats->rx_msdu += sta_get_tidstats_msdu(&sta->rx_stats, tid);
> 
>  		if (sta->pcpu_rx_stats) {
>  			for_each_possible_cpu(cpu) {
> @@ -2308,8 +2306,7 @@ void sta_set_sinfo(struct sta_info *sta, struct
> station_info *sinfo,
> 
>  	if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) |
>  			       BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) {
> -		if (!ieee80211_hw_check(&local->hw, USES_RSS))
> -			sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats);
> +		sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats);
> 
>  		if (sta->pcpu_rx_stats) {
>  			for_each_possible_cpu(cpu) {
> 
> 
> johannes

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-06 17:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-17 11:56 [PATCHv2] mac80211: increment rx stats according to USES_RSS flag Thiraviyam Mariyappan
2021-04-08  9:39 ` Johannes Berg
2021-04-08 10:01 ` Johannes Berg
2021-04-21 16:48   ` Thiraviyam Mariyappan
2021-04-23  7:58     ` Johannes Berg
2021-05-06 17:49       ` Thiraviyam Mariyappan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).