diff mbox series

wifi: ethtool: add monitor channel reporting

Message ID 20241112211422.331928-1-dylan.eskew@candelatech.com
State Superseded
Headers show
Series wifi: ethtool: add monitor channel reporting | expand

Commit Message

Dylan Eskew Nov. 12, 2024, 9:14 p.m. UTC
When running ethtool on a monitor interface, the channel
wasn't reporting properly. This adds logic to properly report
the channel for monitor interfaces in ethtool.

Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>
---
 net/mac80211/ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Kalle Valo Nov. 13, 2024, 2:32 p.m. UTC | #1
Dylan Eskew <dylan.eskew@candelatech.com> writes:

> When running ethtool on a monitor interface, the channel
> wasn't reporting properly. This adds logic to properly report
> the channel for monitor interfaces in ethtool.
>
> Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>

I think the subject should have mac80211, something like:

wifi: mac80211: ethtool: ...
Dylan Eskew Nov. 13, 2024, 2:38 p.m. UTC | #2
> I think the subject should have mac80211, something like:
>
> wifi: mac80211: ethtool: ...

Nod, understood.

-- Dylan
diff mbox series

Patch

diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c
index 99f6174a9d69..d36f4e22230b 100644
--- a/net/mac80211/ethtool.c
+++ b/net/mac80211/ethtool.c
@@ -160,6 +160,10 @@  static void ieee80211_get_stats(struct net_device *dev,
 	chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
 	if (chanctx_conf)
 		channel = chanctx_conf->def.chan;
+	else if (local->open_count > 0 &&
+		 local->open_count == local->monitors &&
+		 sdata->vif.type == NL80211_IFTYPE_MONITOR)
+		channel = local->monitor_chanreq.oper.chan;
 	else
 		channel = NULL;
 	rcu_read_unlock();