Search Linux Wireless

Re: [PATCH] mac80211: ethtool: check link sta if deflink sta not found.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2023-10-03 at 14:58 -0700, greearb@xxxxxxxxxxxxxxx wrote:
> From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
> 
> While testing with wifi-7 radio put into AX mode, link-0 is created.
> sdata->deflink.u.mgd.bssid was 00 in this case, so sta was not
> found.
> 
> Use link-0 for sta if it is available to do a better job of reporting
> ethtool stats.
> 
> Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
> ---
>  net/mac80211/ethtool.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c
> index 6bd7fba8a867..1b58304fc68a 100644
> --- a/net/mac80211/ethtool.c
> +++ b/net/mac80211/ethtool.c
> @@ -96,6 +96,7 @@ static void ieee80211_get_stats2(struct net_device *dev,
>  	struct ieee80211_local *local = sdata->local;
>  	struct station_info sinfo;
>  	struct survey_info survey;
> +	struct ieee80211_link_data *link;
>  	int i, q;
>  	int z;
>  #define STA_STATS_SURVEY_LEN 7
> @@ -128,6 +129,12 @@ static void ieee80211_get_stats2(struct net_device *dev,
>  	if (sdata->vif.type == NL80211_IFTYPE_STATION) {
>  		sta = sta_info_get_bss(sdata, sdata->deflink.u.mgd.bssid);

Just don't even try this, link[0] is always valid.

> +		if (!sta) {
> +			link = sdata_dereference(sdata->link[0], sdata);

but link[0] is a bad idea anyway ... what if the AP only assigned link 1
and 2? Or you connected only there?

I'm not even sure this is really worth fixing, do you really want a
random link's statistics?

johannes




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux