From nobody Sun Jan 16 23:20:58 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 5DF251967AA3; Sun, 16 Jan 2022 23:21:00 +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 4JcWHZ6k5tz3mYK; Sun, 16 Jan 2022 23:20:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642375260; 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=R1qd6XFbrYJeZvkGEIqZqsibtPyGO2h54KCAsnrFU2o=; b=S0LEscT45/RntOa4k04aD4xQquDVtQwvBaVmMk6Ev4LWtuxNwloL0+OZsSS/U1Wi+cDkVh 8Du3BmQSNotWe9lTpOvspmbRXz63npo8CdKClctx4hqMDjHe/Pb+/hZalxETqtFJ29jZlF +31j/Wf38FqKSXZJrlkLyq32/L5UYJ57Tfccq1wFvNyHtkHJSS17sdu9oXuMDcxw/wnC3Z NtQcKFMsAO2FX9MqqN2KB69zpoJr/eVNLaITTbkMQZtSRtQqKh+0SF5VdeDQhC9O+Akcq+ uie4FnjAPERPmOMcqPCxYHJ0YFoo7GhEDLksFnZdEypysVYvrQZ/TzpZrI8R5g== 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 4EEE923052; Sun, 16 Jan 2022 23:20:58 +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 20GNKw2q052791; Sun, 16 Jan 2022 23:20:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20GNKwCh052787; Sun, 16 Jan 2022 23:20:58 GMT (envelope-from git) Date: Sun, 16 Jan 2022 23:20:58 GMT Message-Id: <202201162320.20GNKwCh052787@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: b7277a762c9c - stable/13 - LinuxKPI: 802.11 handle IEEE80211_CONF_IDLE better 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: b7277a762c9c7723dd715920ca970679f27b048b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642375260; 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=R1qd6XFbrYJeZvkGEIqZqsibtPyGO2h54KCAsnrFU2o=; b=rJXG5mTyZ/neKfGPEaYnS7FG6yECe76vOQV2E7XmH1XVUnP7Cxc9J8wcFPUty/rtGqpScP QZ1a8+nSEA2QgOqccTdMddIS5gzqNAdFWq7vDepXWVshrQi7x30xuBlUyOZLPsOn6KEny2 T0nQZpLs8ql44uX0f9dqvkLJ514CEKoI+L5fX0E49Zd1SjZ+55CKhuUkYRC9yg4bID9JQo CUpy2tlvkC4CtSra6k5703KG8oOR6i3vCwfSZwJqMu9lEziJfeE+to5WSefwaFn2aBADb3 VK14Tij1zr0BtEHffqf7nRquOoHxQjV0EvGCVtRsgRke89p0L9BVojSBrQ4TxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642375260; a=rsa-sha256; cv=none; b=oN3sbobPI0w0bebBjxHsQRH5DackUR8klWjgkTN9csIHcWtpj+R1k51xdHmviH9UDx/JRr yCrAXIUoC+qQnGSTPAa6ZooGmtCUuOrntClUNCXlyZE9qXyOoeSxrJR8s+WZMyxxbMxcoY FtNna/CXR9qtjTBqmOC0NGpXr2A6djbqNfxTvZd7vakxa6LC5+JmQEQN2s6WUq/SvEzwQb 3qM2uslObP3j/8tgufIwqAbDwT94kB/t8iuaxsBJKgnQboVhP+dGkAH6wEK8wjqCIJnrsu B9akZVhGtGM1VPK0MIkqkgiSTRUPcKtfBTaXbPX67VMo7ge4qNegQn87OEZICA== 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=b7277a762c9c7723dd715920ca970679f27b048b commit b7277a762c9c7723dd715920ca970679f27b048b Author: Bjoern A. Zeeb AuthorDate: 2022-01-09 00:59:50 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-01-16 22:39:10 +0000 LinuxKPI: 802.11 handle IEEE80211_CONF_IDLE better We never initialized hw->conf.flags for IEEE80211_CONF_IDLE but on set_channel we would clear it and announce a change. This lead to a problem that drivers may do some work every time which was not needed and may lead to unexpected behaviour (for no better driver code). Properly initialize conf.flags with IEEE80211_CONF_IDLE. Factor out the toggling into a function and clear IDLE while sw scanning and when associated and set again when scan ends or we are bouncing out of assoc. (cherry picked from commit 086be6a80979f76124972273d62106583e35c83c) --- sys/compat/linuxkpi/common/src/linux_80211.c | 40 +++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 5df10458f3de..8515152d66a6 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2020-2021 The FreeBSD Foundation - * Copyright (c) 2020-2021 Bjoern A. Zeeb + * Copyright (c) 2020-2022 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -584,6 +584,26 @@ lkpi_stop_hw_scan(struct lkpi_hw *lhw, struct ieee80211_vif *vif) __func__, error, lhw, vif); } +static void +lkpi_hw_conf_idle(struct ieee80211_hw *hw, bool new) +{ + struct lkpi_hw *lhw; + int error; + bool old; + + old = hw->conf.flags & IEEE80211_CONF_IDLE; + if (old == new) + return; + + hw->conf.flags ^= IEEE80211_CONF_IDLE; + error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_IDLE); + if (error != 0 && error != EOPNOTSUPP) { + lhw = HW_TO_LHW(hw); + ic_printf(lhw->ic, "ERROR: %s: config %#0x returned %d\n", + __func__, IEEE80211_CONF_CHANGE_IDLE, error); + } +} + static void lkpi_disassoc(struct ieee80211_sta *sta, struct ieee80211_vif *vif, struct lkpi_hw *lhw) @@ -604,6 +624,8 @@ lkpi_disassoc(struct ieee80211_sta *sta, struct ieee80211_vif *vif, hw = LHW_TO_HW(lhw); lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed); + + lkpi_hw_conf_idle(hw, true); } } @@ -1244,6 +1266,8 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int lsta->in_mgd = false; } + lkpi_hw_conf_idle(hw, false); + /* * And then: * - (more packets)? @@ -1858,6 +1882,10 @@ lkpi_ic_scan_start(struct ieee80211com *ic) lvif = VAP_TO_LVIF(vap); vif = LVIF_TO_VIF(lvif); + + if (vap->iv_state == IEEE80211_S_SCAN) + lkpi_hw_conf_idle(hw, false); + lkpi_80211_mo_sw_scan_start(hw, vif, vif->addr); /* net80211::scan_start() handled PS for us. */ IMPROVE(); @@ -1993,6 +2021,9 @@ lkpi_ic_scan_end(struct ieee80211com *ic) lkpi_80211_mo_sw_scan_complete(hw, vif); /* Send PS to stop buffering if n80211 does not for us? */ + + if (vap->iv_state == IEEE80211_S_SCAN) + lkpi_hw_conf_idle(hw, true); } } @@ -2057,12 +2088,6 @@ lkpi_ic_set_channel(struct ieee80211com *ic) hw = LHW_TO_HW(lhw); hw->conf.chandef = chandef; - hw->conf.flags &= ~IEEE80211_CONF_IDLE; - error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_IDLE); - if (error != 0 && error != EOPNOTSUPP) - ic_printf(ic, "ERROR: %s: config %#0x returned %d\n", - __func__, IEEE80211_CONF_CHANGE_IDLE, error); - 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", @@ -2696,6 +2721,7 @@ linuxkpi_ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops) */ hw = LHW_TO_HW(lhw); hw->wiphy = wiphy; + hw->conf.flags |= IEEE80211_CONF_IDLE; hw->priv = (void *)(lhw + 1); /* BSD Specific. */