Linux wireless drivers development
 help / color / mirror / Atom feed
From: David Carlier <devnexen@gmail.com>
To: johannes@sipsolutions.net, linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, David Carlier <devnexen@gmail.com>
Subject: [PATCH wireless-next] wifi: mac80211: fix unlocked STA statistics fallback
Date: Sat, 31 Oct 2026 20:01:33 +0000	[thread overview]
Message-ID: <20261031200133.473693-1-devnexen@gmail.com> (raw)

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


                 reply	other threads:[~2026-10-31 20:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261031200133.473693-1-devnexen@gmail.com \
    --to=devnexen@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox