All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-next] wifi: mac80211: fix unlocked STA statistics fallback
@ 2026-10-31 20:01 David Carlier
  0 siblings, 0 replies; only message in thread
From: David Carlier @ 2026-10-31 20:01 UTC (permalink / raw)
  To: johannes, linux-wireless; +Cc: linux-kernel, David Carlier

The unlocked station statistics path returns -EAGAIN whenever the driver
has no atomic statistics op, even if it has no statistics op at all.
For drivers without any statistics op, which is most of them, every
get/dump therefore falls back to the wiphy mutex and the unlocked path
never helps.

Only return -EAGAIN when the driver has a locked op but no atomic one.
The link variant also checked the wrong op before calling the atomic
link callback, ignored its return value, and lost its entry tracepoint.
Fix those too.

Fixes: ab5d6dd9c9b0 ("wifi: mac80211: implement unlocked STA statistics")
Signed-off-by: David Carlier <devnexen@gmail.com>
---
 net/mac80211/driver-ops.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 1f3e0765a8ab..d19ae7fbcb6a 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -659,12 +659,14 @@ int drv_sta_statistics(struct ieee80211_local *local,
 						   &sdata->vif,
 						   sta, sinfo);
 	} else {
-		ret = -EAGAIN;
+		ret = 0;
 
 		if (local->ops->sta_statistics_atomic)
 			ret = local->ops->sta_statistics_atomic(&local->hw,
 								&sdata->vif,
 								sta, sinfo);
+		else if (local->ops->sta_statistics)
+			ret = -EAGAIN;
 	}
 
 	trace_drv_return_int(local, ret);
@@ -684,6 +686,8 @@ int drv_link_sta_statistics(struct ieee80211_local *local,
 	if (!check_sdata_in_driver(sdata))
 		return 0;
 
+	trace_drv_link_sta_statistics(local, sdata, link_sta);
+
 	if (locked) {
 		might_sleep();
 		lockdep_assert_wiphy(local->hw.wiphy);
@@ -696,16 +700,18 @@ int drv_link_sta_statistics(struct ieee80211_local *local,
 							link_sta,
 							link_sinfo);
 	} else {
-		ret = -EAGAIN;
+		ret = 0;
 
-		if (local->ops->sta_statistics_atomic)
+		if (local->ops->link_sta_statistics_atomic)
 			ret = local->ops->link_sta_statistics_atomic(&local->hw,
 								     &sdata->vif,
 								     link_sta,
 								     link_sinfo);
+		else if (local->ops->link_sta_statistics)
+			ret = -EAGAIN;
 	}
 
 	trace_drv_return_int(local, ret);
 
-	return 0;
+	return ret;
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-31 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-31 20:01 [PATCH wireless-next] wifi: mac80211: fix unlocked STA statistics fallback David Carlier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.