Re: [PATCH wireless-next v4 13/21] wifi: mac80211: apply SMD BSS Transition STA sub-states

From: Johannes Berg

Date: Tue Nov 10 2026 - 15:40:41 EST


On Fri, 2026-11-06 at 13:28 +0530, Pooventhiran G wrote:
>
> +static int sta_apply_smd_state_flags(struct sta_info *sta,
> + u32 mask, u32 set)
> +{
> + bool smd_prep_target, smd_exec_current, smd_dl_drain;
> + u32 expected_mask = BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) |
> + BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) |
> + BIT(NL80211_STA_FLAG_SMD_DL_DRAIN);
> + u32 smd_flags;
> +
> + if (!(mask & expected_mask))
> + return 0;

Not sure I'd call that "expected", it's more like "relevant" (for this
function)?

> + smd_flags = mask & expected_mask & set;
> + if (WARN_ON(hweight32(smd_flags) > 1))
> + return -EINVAL;

WARN? Isn't that potentially reachable from userspace?

> + smd_prep_target =
> + !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_PREP_TARGET));
> + smd_exec_current =
> + !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT));
> + smd_dl_drain =
> + !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_DL_DRAIN));

bool, so you don't need the !!

> +
> + if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) &&
> + (smd_exec_current || smd_dl_drain))
> + return -EINVAL;
> +
> + if (smd_prep_target) {
> + clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT);
> + clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN);
> + set_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET);

might be better to set then clear?

> + /*
> + * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026,
> + * subclause 11.3.1).
> + * Only meaningful for SMD-capable stations (WLAN_STA_SMD set).
> + */
> + if (test_sta_flag(sta, WLAN_STA_SMD)) {
> + ret = sta_apply_smd_state_flags(sta, mask, set);

Sounds more like an LLM invention than a useful comment ...

It'd be good to know why any of this was needed I guess.

johannes