From nobody Thu Sep 14 21:21:15 2023 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 4Rmqxl6trsz4sS1f; Thu, 14 Sep 2023 21:21:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rmqxl2ySZz3Cdq; Thu, 14 Sep 2023 21:21:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694726475; 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=k72vK9TJ3cq3bDJnmJ9NAy2I5xF2O64/TsyisIJXkIM=; b=kUKj0gGcVDbgt+HPN9qx0bSVQU/wpYAylB+OI6wVOceyngFOc9GnETud0SR0o+ps7eKJVC GDZgcOAo8cZfTbPwJu7pgDXg+ipl5bSO/8Ot2XwqF4fIVfn9d3at6zR1FCpJo22AbxrmaX 9CnLxPjojiXe8fA2Y5ENG2nDn9kDrSS7/cwvA9NMhjY1VDDimgHKp4D4yO9zqCgPw3ICHz Ax1faFE8tXX7RVsW5Z1l2uZXFQQUF9Zu3Q2bSk95kK3nnnp52Kd83zlzUdEb8lOnaEXig4 x6r5/9hG5kWQhBvTeAYPLPW1wKBnvOVMJKd5CxgZBkX+ACECUAmdrSeO1Est3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694726475; a=rsa-sha256; cv=none; b=rn71la/HGoVaeGFS7HSkDjopz2/I80JNzYXDW4CfXv9IPlrVBBrEuspYpyCLB9zgZ1Dh6D +R26QkwB3327CDJh00cTbpCbd0lMU3cUfP3HxfUo43iD4bnPgraZpWvSQx3YOohKdQfRNb E/a5rvrzTjmS3wd3/brU5RIuz2K8eb1bT2+z0ScyjPJXBzgOBcU0Eo6eV9Ul2+uTh6rJyb 2VPGadFcytkjp5s3DKmYWB7dAhBfs6m34lV9HU7r54gZzeSkDjM1rGpVE+LZxJNlwBrFCu qxSb0X63+ksmLNtRjfOCTsbjzRhPLyMPCyk3UF0wGCX+Ed6X9wFd3bOcqkZfdw== 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=1694726475; 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=k72vK9TJ3cq3bDJnmJ9NAy2I5xF2O64/TsyisIJXkIM=; b=kE2FnXMmbl2WiRzC6Jl3iycSJQ9E1ihUPFQeskvnYXOTJaLly9ukFe1WhvV8TC4BE52R71 X+lq9hSuz93RQwnhp0XLUWQDj4JO+VODabSIYj/4vYV4ybFhiwv7Z6slGOa9pcAWQ3c4Zu y0xfQwMHnRrgGvLnBcqQXItL0U2qZrbozU2I8/kVG4MCZMg383Ie+y62XZSpPMY8njjbWr AoC3BanbcxJgFsWuTQBF4szrmmH1LkrVF5cQWJA4JtAMM6IZlyyyPOdvraPyvbcIHFyQTf GCsnjKTTt6OMPuf3/HCgYnr8SsVvvvzJyvyMR9pUzvCKFJGUVh3tLY4MD1ZkwA== 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 4Rmqxl229xz1C2N; Thu, 14 Sep 2023 21:21:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38ELLF4a023505; Thu, 14 Sep 2023 21:21:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38ELLFZw023502; Thu, 14 Sep 2023 21:21:15 GMT (envelope-from git) Date: Thu, 14 Sep 2023 21:21:15 GMT Message-Id: <202309142121.38ELLFZw023502@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: f454a4a10dc0 - main - LinuxKPI: 802.11: fix counting the number of supbands 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: f454a4a10dc027474a85269cb4a3f50bbbf90528 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f454a4a10dc027474a85269cb4a3f50bbbf90528 commit f454a4a10dc027474a85269cb4a3f50bbbf90528 Author: Bjoern A. Zeeb AuthorDate: 2023-09-14 17:57:53 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-09-14 21:20:54 +0000 LinuxKPI: 802.11: fix counting the number of supbands While the main purpose was to assign an(y) early chandef with the loop, later additions made use of it to also count supbands as well as to initialise max_rates. Due to the main goal we can exit the loop early and not properly count and initialise supbands and max_rates. Move the terminating condition into the loop and make it a continue rather than ending the loop. Fixes: d9945d7821b9b ("improve hw_scan") Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 4b9cc598740b..cb919bfd3f5b 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3760,8 +3760,7 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) * in any band so we can scale [(ext) sup rates] IE(s) accordingly. */ lhw->supbands = lhw->max_rates = 0; - for (band = 0; band < NUM_NL80211_BANDS && - hw->conf.chandef.chan == NULL; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *supband; struct linuxkpi_ieee80211_channel *channels; @@ -3772,6 +3771,10 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) lhw->supbands++; lhw->max_rates = max(lhw->max_rates, supband->n_bitrates); + /* If we have a channel, we need to keep counting supbands. */ + if (hw->conf.chandef.chan != NULL) + continue; + channels = supband->channels; for (i = 0; i < supband->n_channels; i++) {