From nobody Sun Mar 27 20:14:12 2022 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 DAF3E1A53F65; Sun, 27 Mar 2022 20:14:12 +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 4KRRqm5crLz4nvw; Sun, 27 Mar 2022 20:14:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412052; 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=FwtZsDvaM8IKG40h3hMprTolyUjHD80V6QyTaKqsOQU=; b=aks+x9Wj3Bm9G/ajFG49K2lyY/pd70jLrfTDrhJTMmQvomtne2CRSbWlo4gWHgerAfcu98 hXz3pd1/nKXKNW+llhptjnNc3FmNhlW8WU5lJsDu2Wa3NPPj0CXS/kqD/j0/cMs7b8LV4z sTHpB0Q1NdJTy0VteJ6wliqA2sj7elu7im0uz7UHMKxgLJlNXI7tbCBYtEhLcaKpfOJeqI ILREc+xyuCuuIafz4WK9jTOnyblVxx/oCqdF88vzGhHg4Jq0xMk6EV1I7NSimiW/Yr0FJn XMszj9AWcvU75BVf/n+nbxS4HxJOu/s7m4omSVthOx3jKv0jTiD6I+ANxbcNZA== 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 9F9AB1BE4A; Sun, 27 Mar 2022 20:14:12 +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 22RKEChi037395; Sun, 27 Mar 2022 20:14:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22RKECie037394; Sun, 27 Mar 2022 20:14:12 GMT (envelope-from git) Date: Sun, 27 Mar 2022 20:14:12 GMT Message-Id: <202203272014.22RKECie037394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: beaed0d4b5d0 - stable/13 - LinuxKPI: 802.11: make lkpi_ic_set_channel() unconditional 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/stable/13 X-Git-Reftype: branch X-Git-Commit: beaed0d4b5d0f901f78fc196f4b86d426a589792 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412052; 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=FwtZsDvaM8IKG40h3hMprTolyUjHD80V6QyTaKqsOQU=; b=FwPQyUzkLtwFoWBpHbvnsYv1mxJQetmBR2qKkf2YGRaHKpOOVkfsokQ5a0B5TL4fr/nqru 8mXQV2nxbFV3BUIpbkeMfEUfu3Yab+IwP1A0FnkyBA/c7xKlD5/zDe5hSzHu2eGEPaC0pO V1OxVrmOSUSMwamkdp6iMURj+Zn+uf3qIG72pAlEmHwqqbnzthgXEMfqWAd0BWi71y4RHK LEnCuAgFNN93/nX3Girsuf2NAGXZ8bwDm4riAQ/X75094IAdA0HVrdRjKezdJpe1poD8Ur IE7LcZmVUPfLkWD9hf9GmzUR7FE+metjadnbuzdea5m7fjZ8I4vARrVt/xfvug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412052; a=rsa-sha256; cv=none; b=faMcQszjF3GER4X3B6oClKoMGtKuwfjViQjjCvamvbw0KGaaxxEt5zmVy5LSFXrVc0p4Bc YbFSl9zen7Vx9PZEnTGnvszklmaWy+7jdf4FLCGnGT7f5gBYdCdXC8+dPxHGq5hK2mnRiq WMhFIGAJbJdknHZ3UQZjm7xVhBf2+wBpdyT0FIiJNFgV0elypqR0fIULLclmFY5s1TCC43 3hpaye5O87VkI1kdI3FE1O1x0l4pzPX8xsvpGAqVUrun4cdEVnbQHG0bNtQXoPraSLefuW WLi1SM5e19TW5BqqYpRo3bz5k6Uxc6kUUGtrp3B+8W+/sJXzhuI6uMnlKrzapg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=beaed0d4b5d0f901f78fc196f4b86d426a589792 commit beaed0d4b5d0f901f78fc196f4b86d426a589792 Author: Bjoern A. Zeeb AuthorDate: 2022-03-24 16:51:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 18:12:23 +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 (cherry picked from commit b2cf3c2125bf6f34cb01296e7eda93f73bc4b715) --- 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); } }