From nobody Tue Jan 07 19:34:06 2025 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 4YSLp633Zmz5jqKk; Tue, 07 Jan 2025 19:34:06 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YSLp62K6jz4vqC; Tue, 7 Jan 2025 19:34:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736278446; 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=98oLMjtYB82oTwp0FC+URbTgxyQtCRxg41eqr3eem78=; b=gVgh2hQav1zUHZjQS/Vf9hyuesIcTYCwNATQqboUNeBCW65gd7NMLJTME0MsS2ISY881OQ 0o7ThEpvDko6LDnox3aLHx2e2dxn6xZOFMW1w4OpsjlG4grS0nph995BxCz9/scYb0PRdM GgkreICZC/c3KRLOM6oJbjPDsyYFMSWRMhzTfKrqtkwFgvYvlAPyZ8iAbyJpPgUGVZYBWD 4UOe3tsxCRKh8ISVNls3kz8ND6doWATrukyqG7zTSbFzja6MIUOcIkgVMyboICkeFJHOqB k7++s2UirghjyO8wbzyk4xSB4Fkout1cLaaNQgw9zy/KexK02naDkWeLuakNiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736278446; 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=98oLMjtYB82oTwp0FC+URbTgxyQtCRxg41eqr3eem78=; b=DD6UTgwv7OziSCYuMLOI72/AgYOjl3FnIJSAzq2M9gGjWcRjBFFY8QR1UdJBQkSydIsMO0 5yu7h0Y/GqfLKLyn11iDAyHzoIuuIF7vKh8aEtPtDXnky4EP84eTq1BJf1EPYSJgWnVoUy Q/rVsluwK7DKO5RcS00rDSvm4AKLz7a0MUFxHp8XNJl17k9sQ1DhM+Lfkj0Y8WkEPdE0kK 516UhRUnHB/KF2lNAXZ+9by0GZF7HuhC7nw8ZfKCP8lORj9XiZrz8V/optCW56Vfg9avve ogY2VJYVbhaIt8Yps+MsaUmV9QqGPdf/s24jz2T5/uxh/JpVBONwPff9Ys6GJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736278446; a=rsa-sha256; cv=none; b=nEBbkQyCUIv6IsRCkbUMSJ2V8wK83gTtsxhhDnPw9SC+9NperL08lKoXdZ8p/oXXG6SqeG s2sTyOW437C7zgigN9dUIjdnY4RKCSC4xSS1cnqn2SX4HAmt+SQYuuxIC80nrcNAV1KcM6 RFup2GkeVNKR3amN+vIs0j5mPQuhwAmlCIsYKZE2XwoP+8RFuiO2KKw3CP2QNycCWLH6dG nrwX6x40EOCzjYvpZgcjQqkQvck92GGWwVZCf0eH+GyAhesSro9EhTdb2fXhXBL5dR8w5g xCP6mRyh9UXAx80muAaPzsAkOqi4ndq90has44fMd9rqyjykpJ0xm3zE7yocTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YSLp61kwnz8Fp; Tue, 07 Jan 2025 19:34:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 507JY6Hq079386; Tue, 7 Jan 2025 19:34:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 507JY6js079383; Tue, 7 Jan 2025 19:34:06 GMT (envelope-from git) Date: Tue, 7 Jan 2025 19:34:06 GMT Message-Id: <202501071934.507JY6js079383@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: 2c8b0d6205f6 - main - net80211 / LinuxKPI 802.11: correct enum ieee80211_sta_rx_bw 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: 2c8b0d6205f6f98855773e3a82640b50abb2f2f6 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2c8b0d6205f6f98855773e3a82640b50abb2f2f6 commit 2c8b0d6205f6f98855773e3a82640b50abb2f2f6 Author: Bjoern A. Zeeb AuthorDate: 2024-12-29 08:07:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-01-07 19:32:44 +0000 net80211 / LinuxKPI 802.11: correct enum ieee80211_sta_rx_bw When moving the enum from LinuxKPI to net80211 it got adjusted to be used in net80211 style in order to use it with a print_mask (%b). Turns out that change broke assumptions given the minimum value of BW_20 no longer was 0. Adjust it back to a plain enum starting at 0 and use an inline function to convert to value names. Pointy hat to: bz Fixes: ca389486a9599768e0ba69dca13c208020623083 MFC after: 3 days Sponsored by: The FreeBSD Foundation Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D48375 --- sys/net80211/ieee80211_ddb.c | 4 ++-- sys/net80211/ieee80211_ht.c | 4 ++-- sys/net80211/ieee80211_node.c | 4 ++-- sys/net80211/ieee80211_node.h | 26 +++++++++++++++++++------- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c index 0050038457c7..05b370eafa38 100644 --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -294,9 +294,9 @@ _db_show_sta(const struct ieee80211_node *ni) db_printf("\thtcap %b htparam 0x%x htctlchan %u ht2ndchan %u\n", ni->ni_htcap, IEEE80211_HTCAP_BITS, ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan); - db_printf("\thtopmode 0x%x htstbc 0x%x chw %b\n", + db_printf("\thtopmode 0x%x htstbc 0x%x chw %d (%s)\n", ni->ni_htopmode, ni->ni_htstbc, - ni->ni_chw, IEEE80211_NI_CHW_BITS); + ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw)); /* XXX ampdu state */ for (i = 0; i < WME_NUM_TID; i++) diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index 2ec5ffb1a2af..9e047244cc3b 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -2604,8 +2604,8 @@ ht_recv_action_ht_txchwidth(struct ieee80211_node *ni, IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "%s: HT txchwidth, width %b%s", - __func__, chw, IEEE80211_NI_CHW_BITS, ni->ni_chw != chw ? "*" : ""); + "%s: HT txchwidth, width %d%s (%s)", __func__, + chw, ni->ni_chw != chw ? "*" : "", ieee80211_ni_chw_to_str(chw)); if (chw != ni->ni_chw) { /* XXX does this need to change the ht40 station count? */ ni->ni_chw = chw; diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index d2a4558970f9..17ddc8533e41 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -2672,9 +2672,9 @@ ieee80211_dump_node(struct ieee80211_node_table *nt __unused, printf("\thtcap %x htparam %x htctlchan %u ht2ndchan %u\n", ni->ni_htcap, ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan); - printf("\thtopmode %x htstbc %x htchw %b\n", + printf("\thtopmode %x htstbc %x htchw %d (%s)\n", ni->ni_htopmode, ni->ni_htstbc, - ni->ni_chw, IEEE80211_NI_CHW_BITS); + ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw)); printf("\tvhtcap %x freq1 %d freq2 %d vhtbasicmcs %x\n", ni->ni_vhtcap, (int) ni->ni_vht_chan1, (int) ni->ni_vht_chan2, (int) ni->ni_vht_basicmcs); diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 1f36ceb368b9..0039c743544c 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -115,17 +115,29 @@ enum ieee80211_mesh_mlstate { * flags. This allows us to keep the uint8_t slot for ni_chw in * struct ieee80211_node and means we do not have to sync to the value for * LinuxKPI. + * + * NB: BW_20 needs to 0 and values need to be sorted! Cannot make it + * bitfield-alike for use with %b. */ enum ieee80211_sta_rx_bw { - IEEE80211_STA_RX_BW_20 = 0x01, - IEEE80211_STA_RX_BW_40 = 0x02, - IEEE80211_STA_RX_BW_80 = 0x04, - IEEE80211_STA_RX_BW_160 = 0x08, - IEEE80211_STA_RX_BW_320 = 0x10, + IEEE80211_STA_RX_BW_20 = 0x00, + IEEE80211_STA_RX_BW_40, + IEEE80211_STA_RX_BW_80, + IEEE80211_STA_RX_BW_160, + IEEE80211_STA_RX_BW_320, } __packed; -#define IEEE80211_NI_CHW_BITS \ - "\20\1BW_20\2BW_40\3BW_80\4BW_160\5BW_320" +static inline const char * +ieee80211_ni_chw_to_str(enum ieee80211_sta_rx_bw bw) +{ + switch (bw) { + case IEEE80211_STA_RX_BW_20: return ("BW_20"); + case IEEE80211_STA_RX_BW_40: return ("BW_40"); + case IEEE80211_STA_RX_BW_80: return ("BW_80"); + case IEEE80211_STA_RX_BW_160: return ("BW_160"); + case IEEE80211_STA_RX_BW_320: return ("BW_320"); + } +} /* * Node specific information. Note that drivers are expected