From nobody Sat Sep 03 23:16:55 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 4MKrJm0yRTz4brWH; Sat, 3 Sep 2022 23:16:56 +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 4MKrJm0MWmz4LPl; Sat, 3 Sep 2022 23:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662247016; 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=aFoXRJ938IkurhhYwfdwXTrrhQ/B2b5v+O26XX1SZK8=; b=Q09HoyPcREbaMmPX+QyVBqe65kDJyGk9lT4qkRdXj8UJBYyNwKaCa9N8GISP0NJTmVFeNj ZatUmkcsC5XlxEOSKNqvGrVhwSdlOly+HpMXJrDnGkmwP4MUmTKTd7DMEQBAUGF5irp3jZ Xc0uiBkX/jiulXSxO1uka7uK7hFbAmjHjWOJ7LSVJA1F3o0PVkrNRs49B1w7g1JOwshMKn LUGMeE+fNZhZ+YCCtpgWjKhoYND9oHZDyoiRHcGl6WABbznW3zpK8IYedCQ1r/v/Y3dDwH Wt4Y1oeltxg/dDMWasKDVhWp3WzKyacYJVuPeX5SJTqf2OQEgkagfNou/+ekUg== 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 4MKrJl6VrMzJJV; Sat, 3 Sep 2022 23:16:55 +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 283NGtoZ033045; Sat, 3 Sep 2022 23:16:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 283NGtEL033044; Sat, 3 Sep 2022 23:16:55 GMT (envelope-from git) Date: Sat, 3 Sep 2022 23:16:55 GMT Message-Id: <202209032316.283NGtEL033044@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: 527687a9e30a - main - LinuxKPI: 80211: implement (*get_antenna) and set ic_[rt]xstream 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: 527687a9e30aef2e5e0c0c5b5e64e6059f1a37a4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662247016; 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=aFoXRJ938IkurhhYwfdwXTrrhQ/B2b5v+O26XX1SZK8=; b=CmdOe4fjIo6ERw7OQwNIeqHPLiCVPM/k+8IL7YLX7hVFSepWpzfI79svR1xetftRV3yZiS k/8a2tk0wR9L2gIe1oeQxdPsxfz81jnWselRyc3do+fuHoLil/hlKc8j8hOj6kKCjSdpq6 4VIU2gNQpoABoCdi/OAAFl+HoLhRaWaLmKny6oVpUivPykDsyMG+k1IERUPtdVN0LX/zu8 jlBZm7St7N7vb3v3z5xs7Y2F2LG8E1PTaKhhhek23Xmy9+3MbQ9LhW6gbYVf2qOmtKh5Gq Qaq11BKCsKa7oJh1S/7ALRPhM+t5PV81kuEILEIlfF+t1ltR1tF72aK+cAwpVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662247016; a=rsa-sha256; cv=none; b=nuuCNRv7KlIKjxXyKW1As0P1QqdJ8+jKR1Ramv9Ba3HMn5M28xzL6v+zY96behyCKA/kTz jywgYjVr3vfEyr3FE5qPbid9u7pdy6ZEsWlUsyhchzyJu/sps8rAwA+G8ZWPzrh55ynJco yfzQqNl+/AWqDEoe/8VnOWhWUAgAJGwgz2fJb4dBYFvNwZtRFD+dZOGPScBoynaJMCdYen toosJwIcCfr7/BdvC8UqtH2ThtMedbsH6jwude2PF9nxAo5ntCZxeIu8Xn6coYUsTOL86n szBOSWFQPC6A4p+bGuZUEelgN3Q/kSRxWuQD+ZEGzK1oVG1nAGwyNNVR7drezA== 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=527687a9e30aef2e5e0c0c5b5e64e6059f1a37a4 commit 527687a9e30aef2e5e0c0c5b5e64e6059f1a37a4 Author: Bjoern A. Zeeb AuthorDate: 2022-09-03 23:11:05 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-03 23:11:05 +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 MFC after: 4 days --- 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 6408f57c20c3..b4d9997897f8 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) {