Linux wireless drivers development
 help / color / mirror / Atom feed
From: Andrea Covelli <andcov23@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	Kavita Kavita <kavita.kavita@oss.qualcomm.com>,
	Sai Pratyusha Magam <sai.magam@oss.qualcomm.com>
Subject: Re: [PATCH] wifi: mac80211: defer AP-side FT key upload until association
Date: Tue,  4 Aug 2026 00:30:17 +0200	[thread overview]
Message-ID: <20260803223020.1370646-1-andcov23@gmail.com> (raw)
In-Reply-To: <cfcb2f3748aa51b7001ee41c6dd4d578b0cdca28.camel@sipsolutions.net>

Hi Johannes,

> I think I'd mostly like to understand how it interacts. SMD Transition
> won't actually handle this particular path, but client-side has a similar
> issue where the key is available before the STA entry for the AP is fully
> available.

I compared this with your posted group-key RFC. Its SMD-specific GTK/CIGTK
slots are separate from this pairwise PTK path, but the generic key-slot
refactoring also covers sta->ptk[] and moves the ASSOC gate. This AP-side
mechanism requires an existing, lookupable sta_info and a PTK slot, so it
cannot represent a key arriving before that point or handle the earlier
client-side phase as-is. The deferred flag can still live on the individual
ieee80211_key after rebasing. With the new tailroom handling, the ASSOC-time
retry would call ieee80211_key_enable_hw_accel(key, true), since it is
updating an already-linked key and must adjust tailroom accounting after a
successful hardware upload.

> Now looking at the code I also wonder devices could just deal with the key
> installed before the station is marked associated?

mt7915's set_key() currently returns -EOPNOTSUPP until its AUTH-to-ASSOC setup
marks the WCID ready, while wlcore allocates its per-peer firmware HLID during
that transition. Outside the EPP-specific
NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION opt-in, I could not find a mac80211
capability that guarantees early set_key() is safe for an ordinary AP-side FT
PTK, so I did not assume that every driver can be called early.

The OpenWrt PR also provides a useful A/B result for the
SW_CRYPTO_CONTROL interaction. The initial revision deferred the key with
ret left as -EOPNOTSUPP. It removed the error on mt76, but the error remained
on EAP1200H and OnHub, whose standard OpenWrt profiles use ath10k-ct. A
follow-up moved the deferred branch ahead of the sta->uploaded check and set
ret = 1. The subsequent report for the same device set showed the error gone:

https://github.com/openwrt/openwrt/pull/23181#issuecomment-4500287395

The revised path removed the reported error on those configurations. This is
consistent with synthesizing ret = 1 having permitted software crypto, but it
does not show whether ath10k accepts set_key() before ASSOC, because the
callback was skipped, or whether the key was later uploaded to hardware. It
also illustrates precisely the SW_CRYPTO_CONTROL issue you raised: only an
actual return value of 1 from the driver authorizes software crypto. I do not
want mac80211 to synthesize that permission.

For an upstream solution, would you prefer a genuine dormant-key state, where
the key is neither uploaded nor authorized for software use until ASSOC and
upload failure has a defined path, or should affected drivers handle the early
key themselves, either by installing it immediately or caching it until their
peer setup completes? The latter could use an explicit capability so mac80211
relaxes the ASSOC gate only for drivers supporting that ordering. For a
SW_CRYPTO_CONTROL driver that cannot install or cache the key early, an
explicit return value of 1 followed by a mac80211 retry at ASSOC is another
possible contract. I would avoid adding that, however, and understood your
question as suggesting that driver-side handling should be investigated first.

I have kept v2 local while clarifying this direction and dropped the stable
CC as suggested.

Best,
Andrea

      reply	other threads:[~2026-08-03 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 16:14 [PATCH] wifi: mac80211: defer AP-side FT key upload until association andcov23
2026-07-30 16:21 ` Johannes Berg
2026-07-30 17:00   ` Andrea Covelli
2026-07-30 18:54     ` Johannes Berg
2026-08-03 22:30       ` Andrea Covelli [this message]

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=20260803223020.1370646-1-andcov23@gmail.com \
    --to=andcov23@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kavita.kavita@oss.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sai.magam@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