From nobody Tue Apr 5 15:39:54 2022 X-Original-To: dev-commits-src-branches@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 BADB91A9E20B; Tue, 5 Apr 2022 15:39:55 +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 4KXsK71PDVz4rdJ; Tue, 5 Apr 2022 15:39:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649173195; 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=IWO1gnqhB7vnkgczF/MnaEu/xDf+Pq1x7GIkISneXuU=; b=EYoFUm662HcXmYlURUUppRvS+NTmEMXsMusakvw8+eRb9FMjo+4et0QFHjo2f667Vq8lmv XWanTdFROXXDCbDzaLHghUNxbV1jQwZ1ZOhtTF+e7OffnFipnNO8r4I5qCRloQ+pZvu/7w k8rHMNhd8xpCFPS7ATCQphs4CAXF7V0Zn54WGbFlwyMuup3dkTJSs0RI1Rwnt+DPEkLcuY 5PAgIaTW4z0YDPJZV2rtAVSgJrtVGvDrGL69TDzMoAeyu2P5idC6nAX1yrc3mZdrnNnzGI 3OrbY5PLBVECbayf/G0p6O7gswq+O0SAoJddqTikIRj8C7ON40idFDK9X265Qw== 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 D79ED10B2; Tue, 5 Apr 2022 15:39:54 +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 235Fdsio001423; Tue, 5 Apr 2022 15:39:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 235FdsQA001422; Tue, 5 Apr 2022 15:39:54 GMT (envelope-from git) Date: Tue, 5 Apr 2022 15:39:54 GMT Message-Id: <202204051539.235FdsQA001422@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: 7b9d8e33bc4e - stable/13 - LinuxKPI: 802.11: fix RSSI (and NF) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 7b9d8e33bc4ee0b8cc22ab28a1f09a062e103bd5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649173195; 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=IWO1gnqhB7vnkgczF/MnaEu/xDf+Pq1x7GIkISneXuU=; b=ClAyXndLG80Y4YQfgZ5WcF8t3gkgkKNxndCEsJds2bA2nBtmDvVc12GvIu9qE9pvzNvbl9 JQjMeB1YWK14ZarOAj7Yk8OMnUc+isPoxUXkOEp21V1qRgEH313WV6rUiu+ixz8qwE+EE5 ycEA1CziYxnBloGs/MPEKA3iIM2KXz0n8qQs7LHA/z4dKrw3hFdoKkGzpm23J/pqDfn3AP 8h7peN3gbmXCA2plvpw/vC4FO8GALGoX+B5ZT25X7nmyj0+ZMlxdMpIc8aQh/BQlr9w+Lo VUkzWLdE79hmZC+C4TAEZZxr9/47PnGJRHnHaRl1SnWIKwopb1q6Fft+4lDqcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649173195; a=rsa-sha256; cv=none; b=tP6ES8N6Bq5hITHHO92U4dZJg3HJ2bF9KZ22abeB0fZj0T95EGjmSlxgwqPEem7xGRFSOq Uqt1Ac7/t8Gtr9VSuHKqh6w9K19+NTIesIKlaJGc6Wlnfg3I4CvsxTN2QFke9kG1FiYJVi FnV0R2cYu7WIWkAPv/CkJA53KXElFwMqoKKuIiwWCWpFZr4yEkqin58jck8BP5aiwZUjKo nfSuC+84wnoe9bjtru45QFRbme7RgE3XjO0MUr5fmN5rjl5mSmlSbOKgQfBy0GRUlFExZZ 4QUIAys9t3XRmi/Out9q9Y/fOFunhXGyif2XTvV02mPoaVbjrg7Iz8qAPI2w9w== 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=7b9d8e33bc4ee0b8cc22ab28a1f09a062e103bd5 commit 7b9d8e33bc4ee0b8cc22ab28a1f09a062e103bd5 Author: Bjoern A. Zeeb AuthorDate: 2022-04-01 22:31:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-04-05 14:47:13 +0000 LinuxKPI: 802.11: fix RSSI (and NF) As in 4a22cd6c4e5f4fc4a38aa7400742d4005c5ae3de nf and rss should be signed and not unsigned. Change the types in the header and while here change a magic number to a define as done elsewhere (value does not change). When calculating c_rssi we need to make it relative so subtract nf. And while here improve the debug output. This will hopefully fix ifconfig wlanN list scan S:N output which tools use to chose a BSSID and help net80211 internal calculations. Sponsored by: The FreeBSD Foundation (cherry picked from commit 60970a328e280b25b05f1d9a9de1ef91af573c4a) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 4 ++-- sys/compat/linuxkpi/common/src/linux_80211.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 4e3342837ddc..49088cdea0eb 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -509,8 +509,8 @@ struct ieee80211_rx_status { uint8_t ampdu_reference; uint8_t band; uint8_t chains; - uint8_t chain_signal[4]; - uint8_t signal; + int8_t chain_signal[IEEE80211_MAX_CHAINS]; + int8_t signal; uint8_t enc_flags; uint8_t he_dcm; uint8_t he_gi; diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 13ad2908c021..72bbb1ff1382 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3696,7 +3696,7 @@ linuxkpi_ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, /* Implement a dump_rxcb() !!! */ if (linuxkpi_debug_80211 & D80211_TRACE_RX) printf("TRACE %s: RXCB: %ju %ju %u, %#0x, %u, %#0x, %#0x, " - "%u band %u, %u %u %u %u, %u, %#x %#x %#x %#x %u %u %u\n", + "%u band %u, %u { %d %d %d %d }, %d, %#x %#x %#x %#x %u %u %u\n", __func__, (uintmax_t)rx_status->boottime_ns, (uintmax_t)rx_status->mactime, @@ -3711,6 +3711,7 @@ linuxkpi_ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, rx_status->chain_signal[0], rx_status->chain_signal[1], rx_status->chain_signal[2], + rx_status->chain_signal[3], rx_status->signal, rx_status->enc_flags, rx_status->he_dcm, @@ -3724,12 +3725,14 @@ no_trace_beacons: memset(&rx_stats, 0, sizeof(rx_stats)); rx_stats.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI; + /* XXX-BZ correct hardcoded rssi and noise floor, how? survey? */ + rx_stats.c_nf = -96; if (ieee80211_hw_check(hw, SIGNAL_DBM) && !(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) rx_stats.c_rssi = rx_status->signal; else - rx_stats.c_rssi = 0; /* XXX */ - rx_stats.c_nf = -96; /* XXX */ + rx_stats.c_rssi = 0; + rx_stats.c_rssi -= rx_stats.c_nf; rx_stats.r_flags |= IEEE80211_R_BAND; rx_stats.c_band = lkpi_nl80211_band_to_net80211_band(rx_status->band); @@ -3737,7 +3740,6 @@ no_trace_beacons: rx_stats.c_freq = rx_status->freq; rx_stats.c_ieee = ieee80211_mhz2ieee(rx_stats.c_freq, rx_stats.c_band); - /* XXX-BZ correct hardcoded rssi and noise floor. */ /* XXX (*sta_statistics)() to get to some of that? */ /* XXX-BZ dump the FreeBSD version of rx_stats as well! */