From nobody Sun Jun 14 22:32:27 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gdp0X02fNz6hZvV for ; Sun, 14 Jun 2026 22:32:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gdp0W2r9Gz3cMb for ; Sun, 14 Jun 2026 22:32:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781476347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ggxPFECnUnswo2SL6T4gaqgB8e5gLXOsMLWccQu+cHU=; b=lJgTuB7SoLMZxxwjqb17+nSQoFl35FGP5zforRvSWfO01i7UqvuJMb7A02Yc/oeU7MMF2a ytKA0xS+n3XA3X1cvLfxsuz2/O2VIJA6spY8wV+qbCo1kX5MDk0gcuLs80c2qCyCXSoXOi dsrLfYXOULwWCeaE9GNAyB8PwDw6uo40ztV+5+rfO80j8m18B1rNPq/UYN3UV1ZpHOgkDc qzfv2ndobbFdOhR607ILJa4XaX2arBcUymmnVbgLTPkU53hWOte1N3h1VDNe+OhChJ3kj4 5wu7016C3tOmY7y5ULVwAim3z3JXUlMfZu0zNuMFvy0W2tWnshxZvQ/l9wgyZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781476347; a=rsa-sha256; cv=none; b=TNjkIG4parOy9RP6usA51SkmybXm8C5z8rKImA4pNToGiEoJpJbbvWLDc52onCjo02UqJd 6ze4CRHFUb2I0MJa9iRaWC1UfTNDT4LoAG4g1QeM2N6H2uV+TyxSE/TFf2uUD5ENcqWo2C o9UVpnTOweS7h36ee1Bf6oEAJLgO/LopdNqzQNkzfPunBVjUyFdSLUMHgm51If/rx589HT 3z04NryoeqsJPTSqlH1vrV75uhj6d71764QxcStIYWj1mKRsiw9zWDUhjprb4J8xR1cmuI FfuvMjSK2MrBt3WSISpM0Bn75quGCFNi/ElxVBB/VQ1CoaJgdibhlW9elPZfbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781476347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ggxPFECnUnswo2SL6T4gaqgB8e5gLXOsMLWccQu+cHU=; b=gkv6eUEvC/hWsWr2zwgpGJePN7AzEtt3EtOb5683FHG8eV4gpHOW/6FXa6tFhtRcTWtbV3 33u4SCBAD+96ZOP0BSbSrPhjkhN/BNi3/ghxW9pWGsckhCPbhxf+zmj6PixMUfd4iwmaP0 1YDABUS6Jndt+5FlUCbiO/wEbjSmh8XE/7fu8P5wli6i+Z+DtVwvaQTOlIbOWNk2B++E+B Gdzygf0hlRBFnEWhPCBbOyYiWtyd7OtqKUFNwOK7mB+jvwjtKHYcXd9gNHH8hNGFLbUD0O GsjXMEdI/h2Xfemxw7yeeVGT37O/QvrGizWsXVnv15/PR7KdSSVyIMBDJccdKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gdp0W2MSdzCl9 for ; Sun, 14 Jun 2026 22:32:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 428b4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 14 Jun 2026 22:32:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 31ded414b128 - main - LinuxKPI: 802.11: force update of net80211 crypto key flags List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31ded414b1282abdebcb24c18cc6dbebf84210f2 Auto-Submitted: auto-generated Date: Sun, 14 Jun 2026 22:32:27 +0000 Message-Id: <6a2f2bfb.428b4.6dff1db3@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=31ded414b1282abdebcb24c18cc6dbebf84210f2 commit 31ded414b1282abdebcb24c18cc6dbebf84210f2 Author: Bjoern A. Zeeb AuthorDate: 2026-06-13 11:25:42 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-06-14 22:31:38 +0000 LinuxKPI: 802.11: force update of net80211 crypto key flags Several drivers (rtw8x, mt76) do not announce the supported ciphers suites in the wiphy instance. This means we never populate net80211 ic_cryptocaps on device creation and thus not announcing any supported hw crypto offload forcing a fallback to software crypto. However when the mac80211 (*set_key) succeeds we know we can offload crypto. At that point the net80211 key flags have IEEE80211_KEY_SWCRYPT set which we want to clear. Historically the net80211 API does not allow this though there should be no ill side effects (base on a quick code inspection). We thus have to DECONST the key argument for now. It is expected that with MFP support this will need to become a common operation and the API will need to change as we will only get the information of some details from the driver on a per-cipher case when the (*set_key) downcall returns. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index b9ac7056f868..23b5009c0384 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1570,6 +1570,7 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) struct ieee80211_sta *sta; struct ieee80211_node *ni; struct ieee80211_key_conf *kc; + struct ieee80211_key *wk; uint32_t lcipher; uint16_t exp_flags; uint8_t keylen; @@ -1705,6 +1706,16 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) kc, kc->keyidx, kc->hw_key_idx, kc->flags, IEEE80211_KEY_FLAG_BITS); #endif + /* + * Getting here means we support HW crypto offload. + * Some drivers do not set the wiphy [n_]cipher_suites and thus we + * never populate ic_cryptocaps. which means SWCRYPT will be set and we + * should disable this now (before possibly setting other SW flags + * again for when we need partial SW support). + */ + wk = __DECONST(struct ieee80211_key *, k); + wk->wk_flags &= ~IEEE80211_KEY_SWCRYPT; + exp_flags = 0; switch (kc->cipher) { case WLAN_CIPHER_SUITE_TKIP: @@ -1724,8 +1735,8 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) #ifdef __notyet__ /* Do flags surgery; special see linuxkpi_ieee80211_ifattach(). */ if ((kc->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) != 0) { - k->wk_flags &= ~(IEEE80211_KEY_NOMICMGT|IEEE80211_KEY_NOMIC); - k->wk_flags |= IEEE80211_KEY_SWMIC; + wk->wk_flags &= ~(IEEE80211_KEY_NOMICMGT|IEEE80211_KEY_NOMIC); + wk->wk_flags |= IEEE80211_KEY_SWMIC; ic->ic_cryptocaps &= ~IEEE80211_CRYPTO_TKIPMIC } #endif @@ -1748,9 +1759,9 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) #ifdef __notyet__ /* Do flags surgery. */ if ((kc->flags & IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) == 0) - k->wk_flags |= IEEE80211_KEY_NOIVMGT; + wk->wk_flags |= IEEE80211_KEY_NOIVMGT; if ((kc->flags & IEEE80211_KEY_FLAG_GENERATE_IV) == 0) - k->wk_flags |= IEEE80211_KEY_NOIV; + wk->wk_flags |= IEEE80211_KEY_NOIV; #endif ieee80211_free_node(ni);