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 --- 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