From nobody Wed Apr 22 21:08:49 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 4g1BfV3cphz6bKyb for ; Wed, 22 Apr 2026 21:08:50 +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 4g1BfT6kywz3lFT for ; Wed, 22 Apr 2026 21:08:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776892129; 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=PI6seTii7tIY0RJF9zP/ElLjoG4ai6ZUGPiHtfE89Kw=; b=bPQwteTyEycmPsAHWZPOJEoX4ltYSQ7Q1UJv4TFak8v6Juin4g+Cj+1Eum5IZYzBCDdBST UfGvyo3kVmIpMsn8raJL7Z3tejLVOawGqCFOU2Fbw8yGdLtmpCMxe845jRhiOemEBrcamc jRQd6MGoKcN9SFLnulIz8NG01CJRF0hAvj5MU4RzvQQ/2HIuyUmxdjmXs4ZIDEdLEqwpJD zq2UDooNh8zU2NsfvCwqN4lyGFSii8H9z8aMBMl4/tZgDWa72odsgcSODRH4vijIyiDfBs tqwPx0sjWchHC0NdszS9hKH1RkRUjF/nr4uJf/k8qjz1+SE76/ezg0ChrBan7Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776892130; a=rsa-sha256; cv=none; b=KLyooHa9um09383gK6qhxTdJXD14pmJNOScoPj+Ymg98cjPHp/4wICHQ45GN3O1AaeHCTK Y7DJkyxMH20473S6VIHN1hfee6ygWEpsWSFHTvNyxWMFXGnKaU3t1mJJwDrMGIdizLDFmX Ko+apgTfDHhDLm7/+EhI1/Bt9T+LDBv40RDQX5JRLd7s8ES7RHaqEF8G0/rbUwpZm/W0vA QNmL+HRPf2s+ThJQd70KRu2tmudx9YL1DhIHiWE4fFbdRxuxmHVi92Yp6eFZ6sBW39O0xv Ldlv9bQnhhUPP3LSlQ5MM6KHgAx7/PJ+2EVr+XPTbFmqyabw11JTo4CoObQk2A== 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=1776892129; 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=PI6seTii7tIY0RJF9zP/ElLjoG4ai6ZUGPiHtfE89Kw=; b=weGsDLb8WCB8puO53jY4UZAfM8SuDLhAyVAvxklbV6B0YF6kfKkUgmVJiZr+O8b1ROZs+L WlskkxnThtTUyqwtgvwH9wgtBJeROydCqW4I5Qxzhq64F9tKt66ynNtxlPpaez4BQ0ABQP INqyJaUFi7rMi0q+GlAB4hX3RHKm8x+N1zTStQoiqyy+KPV3ynoEPkQ1bNrtBL63uYBLNJ qXszCbOwKtTsv46l2hgwb17nwL5fnpiGuSP7Dz1DqTvf87/fkgLq6AkxlnrASJ6CTk4DAQ /KRhKbYJKBGOV4zD9RC4XPy+McqEH1qQnoYj0MyOqWsckmBor0YuEOuAjb08nQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g1BfT6HXpznpL for ; Wed, 22 Apr 2026 21:08:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30511 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 22 Apr 2026 21:08:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 83648b5d42e6 - stable/15 - LinuxKPI: 802.11: make sure dtim_period is set 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 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 83648b5d42e67e2be2c084028d684009a84da5a7 Auto-Submitted: auto-generated Date: Wed, 22 Apr 2026 21:08:49 +0000 Message-Id: <69e938e1.30511.500975d2@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=83648b5d42e67e2be2c084028d684009a84da5a7 commit 83648b5d42e67e2be2c084028d684009a84da5a7 Author: Bjoern A. Zeeb AuthorDate: 2026-04-17 02:34:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-04-22 20:57:06 +0000 LinuxKPI: 802.11: make sure dtim_period is set When going from ASSOC to RUN LinuxKPI based wireless drivers have certian expectations written in various ways. I believe mac80211 waits to see a beacon before setting the vif to assoc (or the sta to AUTHORIZED). We have some comments in lkpi_update_dtim_tsf() for that. In practice we can filter out the beacons already and know when they came in as we count them but it is hard to split up the state machine and defer the work. So we make sure that dtim_period is set to at least 1 before calling the (*vif_cfg_change) after setting assoc to true; 0 is a reserved value according to the standards. We will update it once we see a beacon and in case the value differs from 1 shortly afterwards from the recv_mgmt callback. While iwlwifi seems to have coped with our initial implementation, rtw89 may hit a DIV 0 if dtim_period is 0 depending on how well the rx path races with our unlocking in assoc_to_run. Sponsored by: The FreeBSD Foundation (cherry picked from commit 9f20a4ebf044eb0cab83397c83f13bb3958abf6a) --- sys/compat/linuxkpi/common/src/linux_80211.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 89395f2f98b8..b9528295ad8e 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2013,12 +2013,23 @@ lkpi_update_dtim_tsf(struct ieee80211_vif *vif, struct ieee80211_node *ni, * make sure we do not do it on every beacon we still may * get so only do if something changed. vif->bss_conf.dtim_period * should be 0 as we start up (we also reset it on teardown). + * + * If we are assoc we need to make sure dtim_period is non-0. + * 0 is a reserved value and drivers assume they can DIV by it. + * In theory this means we need to wait for the first beacon + * before we finalize the vif being assoc. In practise that + * is harder until net80211 learns how to. Work around like + * this for the moment. */ - if (vif->cfg.assoc && - vif->bss_conf.dtim_period != ni->ni_dtim_period && - ni->ni_dtim_period > 0) { - vif->bss_conf.dtim_period = ni->ni_dtim_period; - bss_changed |= BSS_CHANGED_BEACON_INFO; + if (vif->cfg.assoc) { + if (vif->bss_conf.dtim_period != ni->ni_dtim_period && + ni->ni_dtim_period > 0) { + vif->bss_conf.dtim_period = ni->ni_dtim_period; + bss_changed |= BSS_CHANGED_BEACON_INFO; + } else if (vif->bss_conf.dtim_period == 0) { + vif->bss_conf.dtim_period = 1; + bss_changed |= BSS_CHANGED_BEACON_INFO; + } } vif->bss_conf.sync_dtim_count = ni->ni_dtim_count;