From nobody Thu Mar 24 17:03:25 2022 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 502A61A2FC55; Thu, 24 Mar 2022 17:03:26 +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 4KPWl20rkmz3CLL; Thu, 24 Mar 2022 17:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648141406; 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=8LcRpzcJ+ns5ZUKv2yI01DnB7Wex7bIhGAbYTbFroi8=; b=bTOyxliN8u7wBT8VzCBle1rQLyTgajJVUxffZDQ06e17Y1pwyn+dImrFI978cqgNCwWx27 JoIBSZeoZpBYbNtNQqwoMou4ehzpSjndIQKSF5aHXvYXtpWg7zBQnVsgLxg61J7KaErgXt 13IGbKmbPuvRIRfVMHyZsfCWyIqO53tc5hoDIV5DR6T8XYIMNpPezbPmrxy1UU3Evmy03r vfTrDt35NvyWQgSU9ObPxADeGDaGhlTJN1Ci8s5e8145CtofEGmsXvG2dQkBXGMNB6s9+z u4sPrQHhYxyVTjrtMqtPrWEwF2LVsT6CrFn9DK+lkICtNfTQswNYSuVFzdFKQQ== 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 BA2851BF22; Thu, 24 Mar 2022 17:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22OH3Pjh045584; Thu, 24 Mar 2022 17:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22OH3P52045583; Thu, 24 Mar 2022 17:03:25 GMT (envelope-from git) Date: Thu, 24 Mar 2022 17:03:25 GMT Message-Id: <202203241703.22OH3P52045583@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: b2cf3c2125bf - main - LinuxKPI: 802.11: make lkpi_ic_set_channel() unconditional 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: b2cf3c2125bf6f34cb01296e7eda93f73bc4b715 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648141406; 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=8LcRpzcJ+ns5ZUKv2yI01DnB7Wex7bIhGAbYTbFroi8=; b=mlVLqUG58nD0Mww2wJlrbTMusnD6c6SZi9xUmOe3rsgy9dIFdzQ6DD3hgrSQi/5/13MAbs V4lDiRlsLQLCytvBdpEYC9rHdg50Buh+VuZgAkGt3vNPiXnc9EH5j6fPaPCrHNb7k/43R/ GltjQL0X+z7uX9RZkvbRYwL9ly2LiR/tC8zFPA2P5FoMNyDVK8ahcIy0lBjQANkvQQRr/B UESDqXeTML2PRlFIIySCLFNckZ+wYi34PyshLs2c3ZIHU3BpWALrXExR1co5qCtT9U1O2h U1RAc8BV6T0wcfGDmMO3kwI70pPlVsz83xE9NVXZPKjaeWoQQGiCvmGxgsE7YQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648141406; a=rsa-sha256; cv=none; b=VVy1+nFYInpg0a4Dvqo7hRxqMOLyrJKfoLXqufjLkI1NOcwzqsdhUvQ7NCQVIURGMcMTIn sS5FRGizPQ8nBKSa072E7jvpElPjYxAOGYZfpymKB9/wND63a1pv6rhwwN+MhMQ2eeejvK hKwM8UiJ0PMXSxTU8NHtd9CunXO8ZLM5Kjzv404GWb6K4Ge5eNE+I6kYtjPIdVrBgqxj22 NJvDyBT6GgVGakMrJk2MiCUQdRvA2+XgK9QTPv/gC9lhB16GUKtlc1YgqjC7wNONTk+71L 2Imw9p68qGxWPWeMqOxwZgEV7UeANPbXeQDG5iIYLuEEGS9lvTP2Ti0bf233FQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b2cf3c2125bf6f34cb01296e7eda93f73bc4b715 commit b2cf3c2125bf6f34cb01296e7eda93f73bc4b715 Author: Bjoern A. Zeeb AuthorDate: 2022-03-24 16:51:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-24 17:02:44 +0000 LinuxKPI: 802.11: make lkpi_ic_set_channel() unconditional For (*config)() based drivers not using chanctx we need to use ic_set_channel() to switch channels. So far this was disabled based on scanning flags (as swscan is one of the initial use cases for this function). Now make it only dependent on (*config)() for the moment to save us the work if (*config)() is not supported. For iwlwifi (*config)() is a NOP so no functional changes there but for other drivers such as rtw88 this will allow us to scan and set the channel (which helps to receive on channels other than 1). Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 103 ++++++++++++--------------- 1 file changed, 44 insertions(+), 59 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index e9e75488882a..fe4157212106 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2606,76 +2606,61 @@ lkpi_ic_set_channel(struct ieee80211com *ic) { struct lkpi_hw *lhw; struct ieee80211_hw *hw; + struct ieee80211_channel *c; + struct linuxkpi_ieee80211_channel *chan; int error; lhw = ic->ic_softc; -#ifdef __no_longer__ - /* For now only be concerned if scanning. */ - if ((lhw->scan_flags & LKPI_SCAN_RUNNING) == 0) { - IMPROVE(); + + /* If we do not support (*config)() save us the work. */ + if (lhw->ops->config == NULL) + return; + + c = ic->ic_curchan; + if (c == NULL || c == IEEE80211_CHAN_ANYC) { + ic_printf(ic, "%s: c %p ops->config %p\n", __func__, + c, lhw->ops->config); return; } -#endif - if (ic->ic_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) { - /* - * AP scanning is taken care of by firmware, so only switch - * channels in monitor mode (maybe, maybe not; to be - * investigated at the right time). - */ - if (ic->ic_opmode == IEEE80211_M_MONITOR) { - UNIMPLEMENTED; - } - } else { - struct ieee80211_channel *c = ic->ic_curchan; - struct linuxkpi_ieee80211_channel *chan; + chan = lkpi_find_lkpi80211_chan(lhw, c); + if (chan == NULL) { + ic_printf(ic, "%s: c %p chan %p\n", __func__, + c, chan); + return; + } - if (c == NULL || c == IEEE80211_CHAN_ANYC || - lhw->ops->config == NULL) { - ic_printf(ic, "%s: c %p ops->config %p\n", __func__, - c, lhw->ops->config); - return; - } + /* XXX max power for scanning? */ + IMPROVE(); - chan = lkpi_find_lkpi80211_chan(lhw, c); - if (chan == NULL) { - ic_printf(ic, "%s: c %p chan %p\n", __func__, - c, chan); - return; - } + hw = LHW_TO_HW(lhw); + cfg80211_chandef_create(&hw->conf.chandef, chan, + NL80211_CHAN_NO_HT); - /* XXX max power for scanning? */ + error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_CHANNEL); + if (error != 0 && error != EOPNOTSUPP) { + ic_printf(ic, "ERROR: %s: config %#0x returned %d\n", + __func__, IEEE80211_CONF_CHANGE_CHANNEL, error); + /* XXX should we unroll to the previous chandef? */ IMPROVE(); + } else { + /* Update radiotap channels as well. */ + lhw->rtap_tx.wt_chan_freq = htole16(c->ic_freq); + lhw->rtap_tx.wt_chan_flags = htole16(c->ic_flags); + lhw->rtap_rx.wr_chan_freq = htole16(c->ic_freq); + lhw->rtap_rx.wr_chan_flags = htole16(c->ic_flags); + } - hw = LHW_TO_HW(lhw); - cfg80211_chandef_create(&hw->conf.chandef, chan, - NL80211_CHAN_NO_HT); - - error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_CHANNEL); - if (error != 0 && error != EOPNOTSUPP) { - ic_printf(ic, "ERROR: %s: config %#0x returned %d\n", - __func__, IEEE80211_CONF_CHANGE_CHANNEL, error); - /* XXX should we unroll to the previous chandef? */ - IMPROVE(); - } else { - /* Update radiotap channels as well. */ - lhw->rtap_tx.wt_chan_freq = htole16(c->ic_freq); - lhw->rtap_tx.wt_chan_flags = htole16(c->ic_flags); - lhw->rtap_rx.wr_chan_freq = htole16(c->ic_freq); - lhw->rtap_rx.wr_chan_flags = htole16(c->ic_flags); - } - - /* Currently PS is hard coded off! Not sure it belongs here. */ - IMPROVE(); - if (ieee80211_hw_check(hw, SUPPORTS_PS) && - (hw->conf.flags & IEEE80211_CONF_PS) != 0) { - hw->conf.flags &= ~IEEE80211_CONF_PS; - error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_PS); - if (error != 0 && error != EOPNOTSUPP) - ic_printf(ic, "ERROR: %s: config %#0x returned " - "%d\n", __func__, IEEE80211_CONF_CHANGE_PS, - error); - } + /* Currently PS is hard coded off! Not sure it belongs here. */ + IMPROVE(); + if (ieee80211_hw_check(hw, SUPPORTS_PS) && + (hw->conf.flags & IEEE80211_CONF_PS) != 0) { + hw->conf.flags &= ~IEEE80211_CONF_PS; + error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_PS); + if (error != 0 && error != EOPNOTSUPP) + ic_printf(ic, "ERROR: %s: config %#0x returned " + "%d\n", __func__, IEEE80211_CONF_CHANGE_PS, + error); } }