From nobody Fri Apr 01 22:41: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 896BA1A4FF30; Fri, 1 Apr 2022 22:41: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 4KVZs42cSgz4fp9; Fri, 1 Apr 2022 22:41:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648852872; 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=40jDpSVUFbg03FKEo5c77lvRmfDAf8StzbfyenlDhdg=; b=Ew5NCKmBI/ebxuxQRJ0Asz7R7SzcH8+eSFxFc8dVVXzhHX+ZdhtJTtetsssQsn//lLgb6D /w3JurGYsKpGWwIMor7tLmyEmpX9ATFbkouaEOOhnWHdq8GVcQFd7sas9DSXv9rJAuBVy9 fvVhTUi6Edlvh171clKiktW0D29nGUxgk9KPWqywuJowA7zk0fsK+x2QX6cHa7xvFKEbmT /ltMmtfUyHDKKQvFQ4R5lIiiTDHITGnz4MF4kjbpiOA8NwX/OXgWCZKu1odTFLlyS6pldW K7bMYYh/QlEV06dJP0HV9lKMwcRYO1Kyt0LMBoBqwWSzIX+Nrxte3Xset8U1IA== 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 301F31D1A7; Fri, 1 Apr 2022 22:41: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 231MfCb8080107; Fri, 1 Apr 2022 22:41:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 231MfC0f080106; Fri, 1 Apr 2022 22:41:12 GMT (envelope-from git) Date: Fri, 1 Apr 2022 22:41:12 GMT Message-Id: <202204012241.231MfC0f080106@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: 60970a328e28 - main - LinuxKPI: 802.11: fix RSSI (and NF) 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/main X-Git-Reftype: branch X-Git-Commit: 60970a328e280b25b05f1d9a9de1ef91af573c4a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648852872; 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=40jDpSVUFbg03FKEo5c77lvRmfDAf8StzbfyenlDhdg=; b=AR3PxI3FHzjiZyLRWWiGYsrQ+VoAKIJR45q9kY99BIrClZRYdrStqwweniFyOnp1yYVjWb DxUm7/1qzDY/FZqYTICLntJE+7WvWKMazzCpJv0s6zb9kyPiAtFE6PtQl7cZnBbPzneyOs l3xsBlmzgnnEBvxlh3d0ZL26+IJu0Rh4EYIOCexKjGHod178bZijTuooMVfjPpS5kHJlPI B0xvB6PrTFpFJQWKkprhV0XiiuL9SR5CSgS2cBlVJyciNIzWHXyMw7EOVuxIZ/izsZMsZ/ xjZGaVaN2S99lXs0GgxmZ1BzFVDjXF47Pc1U0RcCeXlQFSbDbl5hhJvHv+54Jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648852872; a=rsa-sha256; cv=none; b=dAJvcJgyAMlg7/wYirAWalbgUTgAUhwR76d9LKFLLgRvlI2IZfHFXlHPFcNdIHUT5abAsO ueHJp5W+C7YaSzs+PrhR+O8uoT09Tv0E5lHy6dl+SrRQpkhbfH2v9rAvfW5eU26OYEBRXZ 7On0OHlPdWPPU2NHMu59Z2mZ9wb5fQlzhq7a/07LalgvXfWQch5d/vrPREZ7Q39C+F6iBR MM5OcfXGFk5OBWBJ2g4H70YcJkUmmodpCeAoLnt+M4UVnexe+77/6QQ+Lux5Ychy9Tj6gg Up/6q8rZ6IzKqBv633uCVZXKEixz/GHNvOipZ9c3ez8aFcvpUA/7JAzzW6Vsmw== 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=60970a328e280b25b05f1d9a9de1ef91af573c4a commit 60970a328e280b25b05f1d9a9de1ef91af573c4a Author: Bjoern A. Zeeb AuthorDate: 2022-04-01 22:31:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-04-01 22:31:23 +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 MFC after: 3 days --- 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 d69f5094765b..70f71da09a59 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! */