Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Priyansha Tiwari <priyansha.tiwari@oss.qualcomm.com>
Cc: linux-wireless@vger.kernel.org, quic_drohan@quicinc.com,
	 veerendranath.jakkam@oss.qualcomm.com
Subject: Re: [PATCH wireless-next v4 3/4] wifi: mac80211: implement STA-mode peer probing
Date: Wed, 10 Jun 2026 08:57:01 +0200	[thread overview]
Message-ID: <f2c173f969bb3fd8685fcff9636f7aa6fa078a7f.camel@sipsolutions.net> (raw)
In-Reply-To: <20260608090727.2389161-4-pritiwa@qti.qualcomm.com>

Hi,

> +	const u8 *peer_addr;

That seems vaguely confusing when we already have "peer", maybe you
should call this dst_addr to go with src_addr.

>  	/* the lock is needed to assign the cookie later */
>  	lockdep_assert_wiphy(local->hw.wiphy);
>  
> -	rcu_read_lock();
> -	sta = sta_info_get_bss(sdata, peer);
> -	if (!sta) {
> -		ret = -ENOLINK;
> -		goto unlock;
> -	}
> -
> -	qos = sta->sta.wme;
> -
> -	if (ieee80211_vif_is_mld(&sdata->vif)) {
> -		if (sta->sta.mlo) {
> -			link_id = IEEE80211_LINK_UNSPECIFIED;
> -		} else {
> -			/*
> -			 * For non-MLO clients connected to an AP MLD, band
> -			 * information is not used; instead, sta->deflink is
> -			 * used to send packets.
> -			 */
> -			link_id = sta->deflink.link_id;
> +	switch (sdata->vif.type) {
> +	case NL80211_IFTYPE_AP:
> +	case NL80211_IFTYPE_P2P_GO:
> +		sta = sta_info_get_bss(sdata, peer);
> +		if (!sta)
> +			return -ENOLINK;

I don't really understand why you move a bunch of the per-STA handling
into the switch?

> +		qos = sta->sta.wme;

This is definitely in all the branches, and must be there. Why not pull
it out?

> +		fromds = true;
> +		break;
> +
> +	case NL80211_IFTYPE_STATION:

(nit: spurious blank line)

> +	case NL80211_IFTYPE_P2P_CLIENT:

Both of the P2P cases aren't needed here and are just confusing.

> +		link_id = IEEE80211_LINK_UNSPECIFIED;
> +		peer_addr = sdata->vif.cfg.ap_addr;
> +		src_addr = sdata->vif.addr;
> +		if (!ieee80211_vif_is_mld(&sdata->vif)) {
> +			chanctx_conf = wiphy_dereference(local->hw.wiphy,
> +							 sdata->vif.bss_conf.chanctx_conf);
> +			if (WARN_ON(!chanctx_conf))
> +				return -EINVAL;

(that WARN_ON could perhaps be triggered since you didn't check for the
STA first?)

> +			band = chanctx_conf->def.chan->band;
> +		} else {
> +			band = 0;
>  		}
> -		band = chanctx_conf->def.chan->band;
> -		link_id = 0;
> +		sta = sta_info_get(sdata, peer_addr);
> +		if (!sta)
> +			return -ENOLINK;
> +		qos = sta->sta.wme;

At the very least you could pull out 'qos = sta->sta.wme', but I wonder
if you could pull out more of the sta lookup too by just saying

	if (vif.type == NL80211_IFTYPE_STATION)
		peer = sdata->vif.cfg.ap_addr;

and then leaving more of the current behaviour intact. Even the MLO link
thing could be left since it won't actually be able to be used since the
AP will be MLO/non-MLO with the vif, unlike in AP mode.

IOW, it feels like with that you should get away with far less
difference between AP and client, perhaps no other than this and the DS
bits.

johannes

  reply	other threads:[~2026-06-10  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08  9:07 [PATCH wireless-next v4 0/4] wifi: nl80211: introduce PROBE_PEER for AP and STA Priyansha Tiwari
2026-06-08  9:07 ` [PATCH wireless-next v4 1/4] wifi: nl80211/cfg80211: rename probe_client to probe_peer Priyansha Tiwari
2026-06-08  9:07 ` [PATCH wireless-next v4 2/4] wifi: cfg80211/nl80211: add STA-mode peer probing Priyansha Tiwari
2026-06-08  9:07 ` [PATCH wireless-next v4 3/4] wifi: mac80211: implement " Priyansha Tiwari
2026-06-10  6:57   ` Johannes Berg [this message]
2026-06-08  9:07 ` [PATCH wireless-next v4 4/4] wifi: mac80211_hwsim: report TX status link_id Priyansha Tiwari

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=f2c173f969bb3fd8685fcff9636f7aa6fa078a7f.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=priyansha.tiwari@oss.qualcomm.com \
    --cc=quic_drohan@quicinc.com \
    --cc=veerendranath.jakkam@oss.qualcomm.com \
    /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