From nobody Wed Sep 21 14:01:26 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 4MXg7V5YV1z4cYG3; Wed, 21 Sep 2022 14:01: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 4MXg7V4H36z49kX; Wed, 21 Sep 2022 14:01:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663768886; 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=yoJP00PIzldCtsqLi1v1V31AQCAGiTMihZs/bm6NMRc=; b=bkyqD8HYN1KuKNVyaJkidNYdrZLLexGUmIHpO4VQH/K+6b8xG09XwZanLw6CoGmaPj5zzy TilW8w8RiNRXhvvYBUDxZGUcEeN9X2BID0hEsisEUxfb8cOwphPpMOmLRRy520WdiFNlhv IzdOcA4CFUymCdfAL9IB4YbarNJjQkm2d4llQ8Gz90IyyiOXU6qELxtpZ1AhLNdU/8AgfH 8v/gLMZS5n5r8oQp7NEaHPjxXHkeEzmOBS9fJMruQ3esbR1qWdRvKYQ2JsreNVkL3J0CRa XWoFTXFe3mNoJl/ojWgWLXvHsfPQwIRDAm0Bxwm5+5/CnqlmSCM20UH1x38dXw== 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 4MXg7V3NStz14qW; Wed, 21 Sep 2022 14:01:26 +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 28LE1Qxh000150; Wed, 21 Sep 2022 14:01:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28LE1QMI000149; Wed, 21 Sep 2022 14:01:26 GMT (envelope-from git) Date: Wed, 21 Sep 2022 14:01:26 GMT Message-Id: <202209211401.28LE1QMI000149@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: 8823ef8117e0 - stable/13 - LinuxKPI: 80211: implement (*get_antenna) and set ic_[rt]xstream 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: 8823ef8117e0a21d0d0f6368b554939541fb7a86 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663768886; 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=yoJP00PIzldCtsqLi1v1V31AQCAGiTMihZs/bm6NMRc=; b=F3q8IIFR7Pyu/aGG+ONVC2cNMzmV25oNlwq0xwIQbW9n2YF9rcyAFtvEuweYnEvRHCBjNL cn/Ftn2OE0Xz2AGpicEzV3+Rd83swgVQhGYUQku+X60OlPKUt138gBJbgvP/7BE8AewGXD 8HXksxwnbG37J0gFTqbtCJeLQIf4U+n0fmI3gw9boG6XkS/Zfbh+xtLPH+uE0DzU+MjriL ZZZKWKIFNPavczJDH/JJxnte9jend5Xk4gJYOVAtn6IngCdPibGTxDqAJxbvHxBitfcjg8 MpQjd5ER8Bng0MYT7h66SVjxIOE03112vXGTaCfTjohezOOrhMiBHeDdxVbYgA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663768886; a=rsa-sha256; cv=none; b=jy5cC8DGkd6cajUxnQlN2BtQO2IK0bXagrXVCJyfKPRqaOxfVvPNpQNzEbQ5qa3SZVaLAt HEAle8WAbAksm9lwT/uZZuZ1IYANitzq0oT1YAh970IIMFbYf6HGnzOR/luagR2pdJPHN1 3jXV3PUCwgFJTSmp+DDx+nZ1oNmZqt8zV1Hdw3l6FxgZLHpY3gX6uiMMG42JfSoI8CBHcy mI55wUUB5Otl0U+SXBqdsiIaSz6HFqrh/p34KN4/+jjjKj6PwngeWKRXi+6yXPH9Dv7WTj 0zzT9LO0KJJXsGNS9LRr/vvsYn3na9oP7729VobgNiIW3zGWqCw25HUhjAv+bg== 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=8823ef8117e0a21d0d0f6368b554939541fb7a86 commit 8823ef8117e0a21d0d0f6368b554939541fb7a86 Author: Bjoern A. Zeeb AuthorDate: 2022-09-03 23:11:05 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-21 11:46:46 +0000 LinuxKPI: 80211: implement (*get_antenna) and set ic_[rt]xstream Implement the mac80211 (*get_antenna) call and after checking any antenna information present query the current configuration on startup (both informations should be identical at this point in theory). Both the wiphy variables and function call report a bitmask not a count. Count the bits for net80211 for as long as we get away with just a number in ic_[rt]xstream. Sponsored by: The FreeBSD Foundation (cherry picked from commit 527687a9e30aef2e5e0c0c5b5e64e6059f1a37a4) --- sys/compat/linuxkpi/common/src/linux_80211.c | 17 +++++++++++++++++ sys/compat/linuxkpi/common/src/linux_80211.h | 1 + sys/compat/linuxkpi/common/src/linux_80211_macops.c | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 9095890c3dbc..b23b2b3f774b 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -3495,6 +3496,22 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) ic->ic_htcaps |= IEEE80211_HTCAP_TXSTBC; #endif + /* + * The wiphy variables report bitmasks of avail antennas. + * (*get_antenna) get the current bitmask sets which can be + * altered by (*set_antenna) for some drivers. + * XXX-BZ will the count alone do us much good long-term in net80211? + */ + if (hw->wiphy->available_antennas_rx || + hw->wiphy->available_antennas_tx) { + uint32_t rxs, txs; + + if (lkpi_80211_mo_get_antenna(hw, &txs, &rxs) == 0) { + ic->ic_rxstream = bitcount32(rxs); + ic->ic_txstream = bitcount32(txs); + } + } + ic->ic_cryptocaps = 0; #ifdef LKPI_80211_HW_CRYPTO if (hw->wiphy->n_cipher_suites > 0) { diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index 3c107f76de32..c6958cf834e3 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -197,6 +197,7 @@ struct lkpi_wiphy { int lkpi_80211_mo_start(struct ieee80211_hw *); void lkpi_80211_mo_stop(struct ieee80211_hw *); +int lkpi_80211_mo_get_antenna(struct ieee80211_hw *, u32 *, u32 *); int lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *, uint32_t); int lkpi_80211_mo_set_rts_threshold(struct ieee80211_hw *, uint32_t); int lkpi_80211_mo_add_interface(struct ieee80211_hw *, struct ieee80211_vif *); diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c index b3e01780e1ce..12cffc11481e 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c +++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c @@ -77,6 +77,24 @@ lkpi_80211_mo_stop(struct ieee80211_hw *hw) lhw->sc_flags &= ~LKPI_MAC80211_DRV_STARTED; } +int +lkpi_80211_mo_get_antenna(struct ieee80211_hw *hw, u32 *txs, u32 *rxs) +{ + struct lkpi_hw *lhw; + int error; + + lhw = HW_TO_LHW(hw); + if (lhw->ops->get_antenna == NULL) { + error = EOPNOTSUPP; + goto out; + } + + error = lhw->ops->get_antenna(hw, txs, rxs); + +out: + return (error); +} + int lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *hw, uint32_t frag_th) {