From nobody Sat Apr 18 01:12:50 2026 X-Original-To: dev-commits-src-main@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 4fyDJL5TDlz6ZTdp for ; Sat, 18 Apr 2026 01:12: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 4fyDJL1hqlz3nRy for ; Sat, 18 Apr 2026 01:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776474770; 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=vGmjKP5hdicl4OpAP5HUubkbiRM49a7xX46nHRU48cU=; b=hwOzUnvVToT2tjHwQe763nuE4J4iq0SWdp/u4Tzk59WxfjOBDbSObi3XppNK1Q5BdvvoYN Oq5jFtiFJlPTq6xdpCIUxlm4T4N2e15sw7rs9kuRvh8Evs5vwSgysZTU8PGdDt/TiDWPDN THMhtSg2RE009FD/7uIW8LnzT2xma4Bl2HvWyo94juZc7D+tXBjj7er5aKBb1qGrhML38z lfW994oMT/r5AFB+eha5x1fdbBX5Z6ZbpzYH5ydODlY/cQGK5c4tEt8Y6LgiPVPjoi4p80 YGAfudbFl3el91DIgWOVPH16vyK8699aN6vNm5ETatGUGd7Afz8XcZRWb2zaAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776474770; a=rsa-sha256; cv=none; b=HhKM2cGFYvdbctx5oL7t27Zr0nTxeZUVJ5/zH4Q25Oq4tVURQyv6liGfbphc0DKI8EAfaN +rXlljYs9kK2M1v7rD3HQYwshJFSBP+N0HKrsZ5pgnrHlnG680gVt+Azbj5RCGzRN7mObO elwAbnI0r2wOtmY5mAO4Q8plCBxROhi0QcAb88aFbzvVb67ts2ZYLzqQyddMkb5SH2MDug FgiutOP4mPqHAmzMi7cRbxnV8pSG2r0/8eFRodDV+CHJLcpVCWdii57j2RsweUNHutxqoR ztjzU4dLLFmNZbJF1uBjPwVk8yze3mKFmWpMJwvRwWm8ITWzZxIDhfncqVKvYA== 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=1776474770; 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=vGmjKP5hdicl4OpAP5HUubkbiRM49a7xX46nHRU48cU=; b=hUUwAIcX+CtoopzEjqUgvvDOQSt/phFYZdQ4YjzPwpSEQtGctSB9a8Z3xmLLpGegMWIjX0 tLlkC5l/pzdk3Ynr9lWY6HAHJNWpnlEE3xQini5TTJBEyTNymK2s83JxfgcYnnj2BV+p1i yjaR/yQQk1I6mG38am6MClWC1/zpoPTnKyu2kZinBQMB/3UAd3zb4lK+1mRBxCXFv+gP0X wqKsr9tZlEQMIrOJihVbJX807BjXX3NOPH6wfxDp7dlcx1eLWH5BAr1ADFl7cENTohwzER mozVZ3mUoRALx2FggICnRor3k4Y2Iec0QWdt072GMGIo8uInlc5/msGq8vmdlw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fyDJL1319z339 for ; Sat, 18 Apr 2026 01:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 44a57 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 18 Apr 2026 01:12:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 9f20a4ebf044 - main - LinuxKPI: 802.11: make sure dtim_period is set List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 9f20a4ebf044eb0cab83397c83f13bb3958abf6a Auto-Submitted: auto-generated Date: Sat, 18 Apr 2026 01:12:50 +0000 Message-Id: <69e2da92.44a57.539c2a67@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9f20a4ebf044eb0cab83397c83f13bb3958abf6a commit 9f20a4ebf044eb0cab83397c83f13bb3958abf6a Author: Bjoern A. Zeeb AuthorDate: 2026-04-17 02:34:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-04-18 01:12:10 +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 MFC after: 3 days --- 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;