From nobody Fri Aug 29 13:19:01 2025 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 4cCzPL07Vxz65W0B; Fri, 29 Aug 2025 13:19:02 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cCzPK3KF1z3V8b; Fri, 29 Aug 2025 13:19:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756473541; 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=sZ0FB3DpwBcUK1zDpNp1mIl8zOjtSArAblzVzULI2TA=; b=UB+6QLJIgqppfR/2nJec/i96QlzYsn5PecnNiQfXLuwVWybnIeU1chEoxxOFsrGcIMtHJW dakHdtYwOSs9wZu4eRLCFIULkchBtYoEfY6iUUfMZabePcWjS29JzvC70uaf5fu6PSaN3Q 86haIFujpQ8cRZxqqNUrXF+vhWVr9vKM1zu75QZC+/XrAfI0mkE3vRP1zaxu//RpS/bzZA NAN5DQ/7R2mIt7Hi7sz2crgn7PvfhfxAhQb0Mw6EyW3ofGQj9fvaoLcXHx49KlSUznw4QG Vui3YiRoLduOAvtU1vOGWspyWxb4GGAv2FQnmV00ElTT99roEtNQQksp576+BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756473541; 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=sZ0FB3DpwBcUK1zDpNp1mIl8zOjtSArAblzVzULI2TA=; b=jxCOu83xgTmOx6Gc+L0LQ2IrqpsmFClIxT/hM4/kudHvMjf2HYqpjjdaLR3SVThnNj8dJV aGVp7K5u64bBwyU8fZqd5lmaHH3m2jim6DOiSbObS1Ui/d+iq/03FiUhZ+fQ4k8AUQCpaK xIqJJhHTxs6ER5zkoBDBd2gu82NmzkyQq2ShB+wyHMMAzzXD2xh0qjmmeOPfOpx3WGigY4 GjG90TKcRxlOkxRechiB15ONJYb7q4UVAnTdVT+u4tnJs/rRCcoSi+nIWbqH0DuS6NmS/q 2JdfciO1V2QqZK86AB5Uh8hyojDLrWKIi8KytwgxEzpj2jgkUMbUQE86ilA/gw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756473541; a=rsa-sha256; cv=none; b=C8wgamgWTWtqZo2kAZL9UQ8ieAdSilKAEawL2ooYAoxd102mdU31ECQlTnms/y7z0Qua7A NCR6aguUwtPpmqJ93y034rIGFS3CUmXovzbY8lKIw+6SAZLP1YSAI2uo/3Dnfmp475K0L5 Rgt1dPguMW94b49WaBYIFRW17pDOJzI0FxmB4L4DRt4XjTAo7MQ2eR6h3bf7T84L2Kn8Mq E2TVTa1Zw6q7fA5Da2W1mRncGszdq8OmUqHW2XOfBtv9+T+Oy8FsOTFk3/FJenU1c5oxWx gPMLc9wExK0Qs+U7t/+leTd8vP7QoI4vMEhPYCcfaNjWky+qZVDDtL+T9ED1OA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cCzPK2vQZzh8Y; Fri, 29 Aug 2025 13:19:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 57TDJ15a072285; Fri, 29 Aug 2025 13:19:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57TDJ1QK072282; Fri, 29 Aug 2025 13:19:01 GMT (envelope-from git) Date: Fri, 29 Aug 2025 13:19:01 GMT Message-Id: <202508291319.57TDJ1QK072282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 075a75efa6f6 - main - LinuxKPI: 802.11: improve scanning when not using the net80211 chanlist 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: 075a75efa6f6c9c95f53e0810a9029bcb0667138 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=075a75efa6f6c9c95f53e0810a9029bcb0667138 commit 075a75efa6f6c9c95f53e0810a9029bcb0667138 Author: Bjoern A. Zeeb AuthorDate: 2025-08-27 07:19:32 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-08-29 13:18:42 +0000 LinuxKPI: 802.11: improve scanning when not using the net80211 chanlist With the option to not use the net80211 scan list but scan all channels (if we can scan all bands at once, etc.) we possibly scanned more channels than needed (or we should have). Add a helper function to sort out disabled channels and channels which are not on the net80211 ic_chan_active list (e.g. removed by regdomain). This could potentially also remove channels for a 2nd band for software scanning, but in the offload cases it should not. Add scan logging for the disabled channels and add scan logging to print the finalized channel list we are using for this scan (as net80211 has a similar logging). Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 63 +++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 1f7a0fa9d9b0..4ac2482e4138 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4413,15 +4413,31 @@ lkpi_scan_chan_list_resort(struct linuxkpi_ieee80211_channel **cpp, size_t nchan } } } +} -#if 0 - printf("SCANLIST (nchan=%zu):", nchan); - for (i = 0; i < nchan; i++) { - lc = *(cpp + i); - printf(" %d", ieee80211_mhz2ieee(lc->center_freq, lkpi_nl80211_band_to_net80211_band(lc->band))); +static bool +lkpi_scan_chan(struct linuxkpi_ieee80211_channel *c, + struct ieee80211com *ic, bool log) +{ + + if ((c->flags & IEEE80211_CHAN_DISABLED) != 0) { + if (log) + TRACE_SCAN(ic, "Skipping disabled chan " + "on band %s [%#x/%u/%#x]", + lkpi_nl80211_band_name(c->band), c->hw_value, + c->center_freq, c->flags); + return (false); } - printf("\n"); -#endif + if (isclr(ic->ic_chan_active, ieee80211_mhz2ieee(c->center_freq, + lkpi_nl80211_band_to_net80211_band(c->band)))) { + if (log) + TRACE_SCAN(ic, "Skipping !active chan " + "on band %s [%#x/%u/%#x]", + lkpi_nl80211_band_name(c->band), c->hw_value, + c->center_freq, c->flags); + return (false); + } + return (true); } #endif @@ -4529,8 +4545,17 @@ sw_scan: continue; } if (hw->wiphy->bands[band] != NULL) { - nchan += hw->wiphy->bands[band]->n_channels; + struct linuxkpi_ieee80211_channel *channels; + int n; + band_mask |= (1 << band); + + channels = hw->wiphy->bands[band]->channels; + n = hw->wiphy->bands[band]->n_channels; + for (i = 0; i < n; i++) { + if (lkpi_scan_chan(&channels[i], ic, true)) + nchan++; + } } } #endif @@ -4639,11 +4664,29 @@ sw_scan: continue; channels = supband->channels; - for (i = 0; i < supband->n_channels; i++) - *(cpp + n++) = &channels[i]; + for (i = 0; i < supband->n_channels; i++) { + if (lkpi_scan_chan(&channels[i], ic, false)) + *(cpp + n++) = &channels[i]; + } } if (lkpi_order_scanlist) lkpi_scan_chan_list_resort(cpp, nchan); + + if ((linuxkpi_debug_80211 & D80211_SCAN) != 0) { + printf("%s:%d: %s SCAN Channel List (nchan=%zu): ", + __func__, __LINE__, ic->ic_name, nchan); + for (i = 0; i < nchan; i++) { + struct linuxkpi_ieee80211_channel *xc; + + xc = *(cpp + i); + printf(" %d(%d)", + ieee80211_mhz2ieee(xc->center_freq, + lkpi_nl80211_band_to_net80211_band( + xc->band)), + xc->center_freq); + } + printf("\n"); + } #endif hw_req->req.n_ssids = ssid_count;