git: 06527b2818f2 - main - net80211 / LinuxKPI: 802.11: revert / redo enum ieee80211_sta_rx_bw

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sat, 30 Aug 2025 12:14:35 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=06527b2818f2748fa6eedc2fd418379ef7f99bd9

commit 06527b2818f2748fa6eedc2fd418379ef7f99bd9
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-08-14 01:28:29 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-08-30 07:38:22 +0000

    net80211 / LinuxKPI: 802.11: revert / redo enum ieee80211_sta_rx_bw
    
    The initial thought of migrating the LinuxKPI 802.11 enum into net80211
    for shared use did not work out well.  Currently in the need for yet
    another adjustment, I decided to undo/de-couple net80211 and
    LinuxKPI 802.11 again.
    
    The enum name now gets used in LinuxKPI based wifi drivers and it
    turns out it is spelt differntly than what I used initially.
    This creates a conflict.
    
    net80211 still in the need to be able to express BW_320 in an uint8_t
    will likely be fine with the current solution as well.  Rename the
    enum and prefixes in net80211 to "net80211" instead of "ieee80211".
    Apart from the names/prefix we leave the values the same.
    
    In LinuxKPI add the enum with the expected name and use it there
    throughout to make modern versions of LinuxKPI based wifi drivers
    compile.
    
    Sponsored by:   The FreeBSD Foundation
    Fixes:          ca389486a9599, 2c8b0d6205f6f
    MFC after:      3 days
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D52064
---
 .../linuxkpi/common/include/linux/ieee80211.h      |  8 +++++
 sys/compat/linuxkpi/common/include/net/mac80211.h  |  2 +-
 sys/compat/linuxkpi/common/src/linux_80211.c       |  8 ++---
 sys/dev/ath/ath_rate/sample/sample.c               |  8 ++---
 sys/dev/ath/if_ath_tx_ht.c                         |  6 ++--
 sys/dev/mwl/if_mwl.c                               |  2 +-
 sys/dev/rtwn/rtl8812a/r12a_tx.c                    |  4 +--
 sys/net80211/ieee80211_ddb.c                       |  2 +-
 sys/net80211/ieee80211_ht.c                        | 16 +++++-----
 sys/net80211/ieee80211_node.c                      |  4 +--
 sys/net80211/ieee80211_node.h                      | 34 +++++++++++-----------
 sys/net80211/ieee80211_phy.c                       | 30 +++++++++----------
 sys/net80211/ieee80211_phy.h                       |  8 ++---
 sys/net80211/ieee80211_sta.c                       |  2 +-
 sys/net80211/ieee80211_vht.c                       | 20 ++++++-------
 sys/net80211/ieee80211_vht.h                       |  4 +--
 16 files changed, 83 insertions(+), 75 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index 33850359869f..17041bb03ce8 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -408,6 +408,14 @@ enum ieee80211_sta_state {
 	IEEE80211_STA_AUTHORIZED	= 4,	/* 802.1x */
 };
 
+enum ieee80211_sta_rx_bandwidth {
+	IEEE80211_STA_RX_BW_20		= 0,
+	IEEE80211_STA_RX_BW_40,
+	IEEE80211_STA_RX_BW_80,
+	IEEE80211_STA_RX_BW_160,
+	IEEE80211_STA_RX_BW_320,
+};
+
 enum ieee80211_tx_info_flags {
 	/* XXX TODO .. right shift numbers - not sure where that came from? */
 	IEEE80211_TX_CTL_AMPDU			= BIT(0),
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 0106e6648bd4..8de03410c6b6 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -737,7 +737,7 @@ struct ieee80211_link_sta {
 	struct ieee80211_he_6ghz_capa		he_6ghz_capa;
 	struct ieee80211_sta_eht_cap		eht_cap;
 	uint8_t					rx_nss;
-	enum ieee80211_sta_rx_bw		bandwidth;
+	enum ieee80211_sta_rx_bandwidth		bandwidth;
 	enum ieee80211_smps_mode		smps_mode;
 	struct ieee80211_sta_agg		agg;
 	struct ieee80211_sta_txpwr		txpwr;
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 3f850653bc7c..87390145a296 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -401,7 +401,7 @@ lkpi_80211_dump_stas(SYSCTL_HANDLER_ARGS)
 	return (0);
 }
 
-static enum ieee80211_sta_rx_bw
+static enum ieee80211_sta_rx_bandwidth
 lkpi_cw_to_rx_bw(enum nl80211_chan_width cw)
 {
 	switch (cw) {
@@ -425,7 +425,7 @@ lkpi_cw_to_rx_bw(enum nl80211_chan_width cw)
 }
 
 static enum nl80211_chan_width
-lkpi_rx_bw_to_cw(enum ieee80211_sta_rx_bw rx_bw)
+lkpi_rx_bw_to_cw(enum ieee80211_sta_rx_bandwidth rx_bw)
 {
 	switch (rx_bw) {
 	case IEEE80211_STA_RX_BW_20:
@@ -446,7 +446,7 @@ lkpi_sync_chanctx_cw_from_rx_bw(struct ieee80211_hw *hw,
     struct ieee80211_vif *vif, struct ieee80211_sta *sta)
 {
 	struct ieee80211_chanctx_conf *chanctx_conf;
-	enum ieee80211_sta_rx_bw old_bw;
+	enum ieee80211_sta_rx_bandwidth old_bw;
 	uint32_t changed;
 
 	chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf,
@@ -551,7 +551,7 @@ static void
 lkpi_sta_sync_vht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
     struct ieee80211_node *ni)
 {
-	enum ieee80211_sta_rx_bw bw;
+	enum ieee80211_sta_rx_bandwidth bw;
 	uint32_t width;
 	int rx_nss;
 	uint16_t rx_mcs_map;
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c
index 291d1ec64ed7..79bf08678249 100644
--- a/sys/dev/ath/ath_rate/sample/sample.c
+++ b/sys/dev/ath/ath_rate/sample/sample.c
@@ -179,7 +179,7 @@ ath_rate_sample_find_min_pktlength(struct ath_softc *sc,
 	const struct txschedule *sched = &sn->sched[rix0];
 	int max_pkt_length = 65530; // ATH_AGGR_MAXSIZE
 	// Note: this may not be true in all cases; need to check?
-	int is_ht40 = (an->an_node.ni_chw == IEEE80211_STA_RX_BW_40);
+	int is_ht40 = (an->an_node.ni_chw == NET80211_STA_RX_BW_40);
 	// Note: not great, but good enough..
 	int idx = is_ht40 ? MCS_HT40 : MCS_HT20;
 
@@ -979,7 +979,7 @@ update_stats(struct ath_softc *sc, struct ath_node *an,
 	const int size_bin = size_to_bin(frame_size);
 	const int size = bin_to_size(size_bin);
 	int tt;
-	int is_ht40 = (an->an_node.ni_chw == IEEE80211_STA_RX_BW_40);
+	int is_ht40 = (an->an_node.ni_chw == NET80211_STA_RX_BW_40);
 	int pct;
 
 	if (!IS_RATE_DEFINED(sn, rix0))
@@ -1365,7 +1365,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
 				continue;
 			printf(" %d %s/%d", dot11rate(rt, rix), dot11rate_label(rt, rix),
 			    calc_usecs_unicast_packet(sc, 1600, rix, 0,0,
-			        (ni->ni_chw == IEEE80211_STA_RX_BW_40)));
+			        (ni->ni_chw == NET80211_STA_RX_BW_40)));
 		}
 		printf("\n");
 	}
@@ -1396,7 +1396,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
 			
 			sn->stats[y][rix].perfect_tx_time =
 			    calc_usecs_unicast_packet(sc, size, rix, 0, 0,
-			    (ni->ni_chw == IEEE80211_STA_RX_BW_40));
+			    (ni->ni_chw == NET80211_STA_RX_BW_40));
 			sn->stats[y][rix].average_tx_time =
 			    sn->stats[y][rix].perfect_tx_time;
 		}
diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c
index e7ee029fecf0..f42058bacb0d 100644
--- a/sys/dev/ath/if_ath_tx_ht.c
+++ b/sys/dev/ath/if_ath_tx_ht.c
@@ -283,7 +283,7 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
 		if (IS_HT_RATE(rate)) {
 			rc[i].flags |= ATH_RC_HT_FLAG;
 
-			if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
+			if (ni->ni_chw == NET80211_STA_RX_BW_40)
 				rc[i].flags |= ATH_RC_CW40_FLAG;
 
 			/*
@@ -295,13 +295,13 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
 			 * and doesn't return the fractional part, so
 			 * we are always "out" by some amount.
 			 */
-			if (ni->ni_chw == IEEE80211_STA_RX_BW_40 &&
+			if (ni->ni_chw == NET80211_STA_RX_BW_40 &&
 			    ieee80211_ht_check_tx_shortgi_40(ni) &&
 			    (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
 				rc[i].flags |= ATH_RC_SGI_FLAG;
 			}
 
-			if (ni->ni_chw == IEEE80211_STA_RX_BW_20 &&
+			if (ni->ni_chw == NET80211_STA_RX_BW_20 &&
 			    ieee80211_ht_check_tx_shortgi_20(ni) &&
 			    (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
 				rc[i].flags |= ATH_RC_SGI_FLAG;
diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c
index 0e2eb0b2d8fe..c885968dfe15 100644
--- a/sys/dev/mwl/if_mwl.c
+++ b/sys/dev/mwl/if_mwl.c
@@ -4017,7 +4017,7 @@ mkpeerinfo(MWL_HAL_PEERINFO *pi, const struct ieee80211_node *ni)
 			pi->HTCapabilitiesInfo &= ~IEEE80211_HTCAP_SHORTGI40;
 		if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) == 0)
 			pi->HTCapabilitiesInfo &= ~IEEE80211_HTCAP_SHORTGI20;
-		if (ni->ni_chw != IEEE80211_STA_RX_BW_40)
+		if (ni->ni_chw != NET80211_STA_RX_BW_40)
 			pi->HTCapabilitiesInfo &= ~IEEE80211_HTCAP_CHWIDTH40;
 	}
 	return pi;
diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c
index acb238316559..0ca1ebd37757 100644
--- a/sys/dev/rtwn/rtl8812a/r12a_tx.c
+++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c
@@ -101,12 +101,12 @@ r12a_tx_set_vht_bw(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni)
 
 	prim_chan = r12a_get_primary_channel(sc, ni->ni_chan);
 
-	if (ieee80211_vht_check_tx_bw(ni, IEEE80211_STA_RX_BW_80)) {
+	if (ieee80211_vht_check_tx_bw(ni, NET80211_STA_RX_BW_80)) {
 		txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_BW,
 		    R12A_TXDW5_DATA_BW80));
 		txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_PRIM_CHAN,
 		    prim_chan));
-	} else if (ieee80211_vht_check_tx_bw(ni, IEEE80211_STA_RX_BW_40)) {
+	} else if (ieee80211_vht_check_tx_bw(ni, NET80211_STA_RX_BW_40)) {
 		txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_BW,
 		    R12A_TXDW5_DATA_BW40));
 		txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_PRIM_CHAN,
diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c
index d96d7988a864..1dd8e38b9896 100644
--- a/sys/net80211/ieee80211_ddb.c
+++ b/sys/net80211/ieee80211_ddb.c
@@ -296,7 +296,7 @@ _db_show_sta(const struct ieee80211_node *ni)
 		ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan);
 	db_printf("\thtopmode 0x%x htstbc 0x%x chw %d (%s)\n",
 		ni->ni_htopmode, ni->ni_htstbc,
-		ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw));
+		ni->ni_chw, net80211_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 c28f124648a1..018927a6dad4 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -1476,7 +1476,7 @@ ieee80211_ht_wds_init(struct ieee80211_node *ni)
 		ni->ni_htcap |= IEEE80211_HTCAP_SHORTGI20;
 	if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
 		ni->ni_htcap |= IEEE80211_HTCAP_CHWIDTH40;
-		ni->ni_chw = IEEE80211_STA_RX_BW_40;
+		ni->ni_chw = NET80211_STA_RX_BW_40;
 		if (IEEE80211_IS_CHAN_HT40U(ni->ni_chan))
 			ni->ni_ht2ndchan = IEEE80211_HTINFO_2NDCHAN_ABOVE;
 		else if (IEEE80211_IS_CHAN_HT40D(ni->ni_chan))
@@ -1484,7 +1484,7 @@ ieee80211_ht_wds_init(struct ieee80211_node *ni)
 		if (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40)
 			ni->ni_htcap |= IEEE80211_HTCAP_SHORTGI40;
 	} else {
-		ni->ni_chw = IEEE80211_STA_RX_BW_20;
+		ni->ni_chw = NET80211_STA_RX_BW_20;
 		ni->ni_ht2ndchan = IEEE80211_HTINFO_2NDCHAN_NONE;
 	}
 	ni->ni_htctlchan = ni->ni_chan->ic_ieee;
@@ -1580,7 +1580,7 @@ ieee80211_ht_node_join(struct ieee80211_node *ni)
 
 	if (ni->ni_flags & IEEE80211_NODE_HT) {
 		vap->iv_ht_sta_assoc++;
-		if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
+		if (ni->ni_chw == NET80211_STA_RX_BW_40)
 			vap->iv_ht40_sta_assoc++;
 	}
 	htinfo_update(vap);
@@ -1598,7 +1598,7 @@ ieee80211_ht_node_leave(struct ieee80211_node *ni)
 
 	if (ni->ni_flags & IEEE80211_NODE_HT) {
 		vap->iv_ht_sta_assoc--;
-		if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
+		if (ni->ni_chw == NET80211_STA_RX_BW_40)
 			vap->iv_ht40_sta_assoc--;
 	}
 	htinfo_update(vap);
@@ -1827,7 +1827,7 @@ htinfo_update_chw(struct ieee80211_node *ni, int htflags, int vhtflags)
 done:
 	/* update node's (11n) tx channel width */
 	ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan) ?
-	    IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
+	    NET80211_STA_RX_BW_40 : NET80211_STA_RX_BW_20;
 	return (ret);
 }
 
@@ -2689,11 +2689,11 @@ ht_recv_action_ht_txchwidth(struct ieee80211_node *ni,
 	 * here.
 	 */
 	chw = (frm[2] == IEEE80211_A_HT_TXCHWIDTH_2040) ?
-	    IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
+	    NET80211_STA_RX_BW_40 : NET80211_STA_RX_BW_20;
 
 	IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
 	    "%s: HT txchwidth, width %d%s (%s)", __func__,
-	    chw, ni->ni_chw != chw ? "*" : "", ieee80211_ni_chw_to_str(chw));
+	    chw, ni->ni_chw != chw ? "*" : "", net80211_ni_chw_to_str(chw));
 	if (chw != ni->ni_chw) {
 		/* XXX does this need to change the ht40 station count? */
 		ni->ni_chw = chw;
@@ -3832,5 +3832,5 @@ ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni)
 
 	return (IEEE80211_IS_CHAN_HT40(bss_chan) &&
 	    IEEE80211_IS_CHAN_HT40(ni->ni_chan) &&
-	    (ni->ni_chw == IEEE80211_STA_RX_BW_40));
+	    (ni->ni_chw == NET80211_STA_RX_BW_40));
 }
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index a201d1b278f0..49ba00299fee 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -2673,7 +2673,7 @@ ieee80211_dump_node(struct ieee80211_node_table *nt __unused,
 		ni->ni_htctlchan, ni->ni_ht2ndchan);
 	net80211_printf("\thtopmode %x htstbc %x htchw %d (%s)\n",
 		ni->ni_htopmode, ni->ni_htstbc,
-		ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw));
+		ni->ni_chw, net80211_ni_chw_to_str(ni->ni_chw));
 	net80211_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);
@@ -2831,7 +2831,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp)
 	    ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "",
 	    /* XXX update for VHT string */
 	    ni->ni_flags & IEEE80211_NODE_HT ?
-		(ni->ni_chw == IEEE80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "",
+		(ni->ni_chw == NET80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "",
 	    ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "",
 	    ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "",
 	    ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" :
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index ef25fa0d7fdd..f1246dd12419 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -109,33 +109,33 @@ enum ieee80211_mesh_mlstate {
 	"\20\1IDLE\2OPENSNT\2OPENRCV\3CONFIRMRCV\4ESTABLISHED\5HOLDING"
 
 /*
- * This structure is shared with LinuxKPI 802.11 code describing up-to
- * which channel width the station can receive.
+ * This enum was shared with the LinuxKPI enum ieee80211_sta_rx_bandwidth
+ * describing up-to which channel width the station can receive.
  * Rather than using hardcoded MHz values for the channel width use an enum with
  * 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.
+ * struct ieee80211_node it means we do not have to sync to the value for
+ * LinuxKPI (just the names).
  *
  * 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		= 0x00,
-	IEEE80211_STA_RX_BW_40,
-	IEEE80211_STA_RX_BW_80,
-	IEEE80211_STA_RX_BW_160,
-	IEEE80211_STA_RX_BW_320,
+enum net80211_sta_rx_bw {
+	NET80211_STA_RX_BW_20		= 0x00,
+	NET80211_STA_RX_BW_40,
+	NET80211_STA_RX_BW_80,
+	NET80211_STA_RX_BW_160,
+	NET80211_STA_RX_BW_320,
 } __packed;
 
 static inline const char *
-ieee80211_ni_chw_to_str(enum ieee80211_sta_rx_bw bw)
+net80211_ni_chw_to_str(enum net80211_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");
+	case NET80211_STA_RX_BW_20:	return ("BW_20");
+	case NET80211_STA_RX_BW_40:	return ("BW_40");
+	case NET80211_STA_RX_BW_80:	return ("BW_80");
+	case NET80211_STA_RX_BW_160:	return ("BW_160");
+	case NET80211_STA_RX_BW_320:	return ("BW_320");
 	}
 }
 
@@ -285,7 +285,7 @@ struct ieee80211_node {
 	uint8_t			ni_ht2ndchan;	/* HT 2nd channel */
 	uint8_t			ni_htopmode;	/* HT operating mode */
 	uint8_t			ni_htstbc;	/* HT */
-	enum ieee80211_sta_rx_bw ni_chw;	/* negotiated channel width */
+	enum net80211_sta_rx_bw ni_chw;	/* negotiated channel width */
 	struct ieee80211_htrateset ni_htrates;	/* negotiated ht rate set */
 	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID];
 	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c
index eb96d74a2bd9..7f53c717152b 100644
--- a/sys/net80211/ieee80211_phy.c
+++ b/sys/net80211/ieee80211_phy.c
@@ -658,26 +658,26 @@ static uint16_t ieee80211_vht_mcs_allowed_list_160[] = {
  *
  * See 802.11-2020 21.5 (Parameters for VHT-MCSs) for more details.
  *
- * @param bw	channel bandwidth, via enum ieee80211_sta_rx_bw
+ * @param bw	channel bandwidth, via enum net80211_sta_rx_bw
  * @param nss	number of spatial streams, 1..8
  * @returns	bitmask of valid MCS rates from 0..9
  */
 uint16_t
-ieee80211_phy_vht_get_mcs_mask(enum ieee80211_sta_rx_bw bw, uint8_t nss)
+ieee80211_phy_vht_get_mcs_mask(enum net80211_sta_rx_bw bw, uint8_t nss)
 {
 	if (nss == 0 || nss > 8)
 		return (0);
 
 	switch (bw) {
-	case IEEE80211_STA_RX_BW_20:
+	case NET80211_STA_RX_BW_20:
 		return (ieee80211_vht_mcs_allowed_list_20[nss - 1]);
-	case IEEE80211_STA_RX_BW_40:
+	case NET80211_STA_RX_BW_40:
 		return (ieee80211_vht_mcs_allowed_list_40[nss - 1]);
-	case IEEE80211_STA_RX_BW_80:
+	case NET80211_STA_RX_BW_80:
 		return (ieee80211_vht_mcs_allowed_list_80[nss - 1]);
-	case IEEE80211_STA_RX_BW_160:
+	case NET80211_STA_RX_BW_160:
 		return (ieee80211_vht_mcs_allowed_list_160[nss - 1]);
-	case IEEE80211_STA_RX_BW_320:
+	case NET80211_STA_RX_BW_320:
 		/* invalid for VHT */
 		return (0);
 	}
@@ -689,14 +689,14 @@ ieee80211_phy_vht_get_mcs_mask(enum ieee80211_sta_rx_bw bw, uint8_t nss)
  *
  * See 802.11-2020 21.5 (Parameters for VHT-MCSs) for more details.
  *
- * @param bw	channel bandwidth, via enum ieee80211_sta_rx_bw
+ * @param bw	channel bandwidth, via enum net80211_sta_rx_bw
  * @param nss	number of spatial streams, 1..8
  * @param mcs	MCS rate, 0..9
  * @retval true		if the NSS / MCS / bandwidth combination is valid
  * @retval false	if the NSS / MCS / bandwidth combination is not valid
  */
 bool
-ieee80211_phy_vht_validate_mcs(enum ieee80211_sta_rx_bw bw, uint8_t nss,
+ieee80211_phy_vht_validate_mcs(enum net80211_sta_rx_bw bw, uint8_t nss,
     uint8_t mcs)
 {
 	uint16_t mask;
@@ -737,7 +737,7 @@ static struct mcs_entry mcs_entries[] = {
 /**
  * @brief Calculate the bitrate of the given VHT MCS rate.
  *
- * @param bw		Channel bandwidth (enum ieee80211_sta_rx_bw)
+ * @param bw		Channel bandwidth (enum net80211_sta_rx_bw)
  * @param nss		Number of spatial streams, 1..8
  * @param mcs		MCS, 0..9
  * @param is_shortgi	True if short guard-interval (400nS)
@@ -746,7 +746,7 @@ static struct mcs_entry mcs_entries[] = {
  * @returns		The bitrate in kbit/sec.
  */
 uint32_t
-ieee80211_phy_vht_get_mcs_kbit(enum ieee80211_sta_rx_bw bw,
+ieee80211_phy_vht_get_mcs_kbit(enum net80211_sta_rx_bw bw,
     uint8_t nss, uint8_t mcs, bool is_shortgi)
 {
 	uint32_t sym_len, n_carriers;
@@ -773,16 +773,16 @@ ieee80211_phy_vht_get_mcs_kbit(enum ieee80211_sta_rx_bw bw,
 	 * See 802.11-2020 Table 21-5 (Timing-related constraints.)
 	 */
 	switch (bw) {
-	case IEEE80211_STA_RX_BW_20:
+	case NET80211_STA_RX_BW_20:
 		n_carriers = 52;
 		break;
-	case IEEE80211_STA_RX_BW_40:
+	case NET80211_STA_RX_BW_40:
 		n_carriers = 108;
 		break;
-	case IEEE80211_STA_RX_BW_80:
+	case NET80211_STA_RX_BW_80:
 		n_carriers = 234;
 		break;
-	case IEEE80211_STA_RX_BW_160:
+	case NET80211_STA_RX_BW_160:
 		n_carriers = 468;
 		break;
 	default:
diff --git a/sys/net80211/ieee80211_phy.h b/sys/net80211/ieee80211_phy.h
index 749b082e34e9..391c8bfc5010 100644
--- a/sys/net80211/ieee80211_phy.h
+++ b/sys/net80211/ieee80211_phy.h
@@ -221,13 +221,13 @@ uint32_t	ieee80211_compute_duration_ht(uint32_t frameLen,
 			uint16_t rate, int streams, int isht40,
 			int isShortGI);
 
-enum ieee80211_sta_rx_bw;
+enum net80211_sta_rx_bw;
 
-uint16_t	ieee80211_phy_vht_get_mcs_mask(enum ieee80211_sta_rx_bw,
+uint16_t	ieee80211_phy_vht_get_mcs_mask(enum net80211_sta_rx_bw,
 		    uint8_t);
-bool		ieee80211_phy_vht_validate_mcs(enum ieee80211_sta_rx_bw,
+bool		ieee80211_phy_vht_validate_mcs(enum net80211_sta_rx_bw,
 		    uint8_t, uint8_t);
-uint32_t	ieee80211_phy_vht_get_mcs_kbit(enum ieee80211_sta_rx_bw,
+uint32_t	ieee80211_phy_vht_get_mcs_kbit(enum net80211_sta_rx_bw,
 		    uint8_t, uint8_t, bool);
 
 #endif	/* _KERNEL */
diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
index 463a8b16773b..19e5ffe9a367 100644
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -1934,7 +1934,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
 		    vap->iv_flags&IEEE80211_F_USEPROT ? ", protection" : "",
 		    ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "",
 		    ni->ni_flags & IEEE80211_NODE_HT ?
-			(ni->ni_chw == IEEE80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "",
+			(ni->ni_chw == NET80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "",
 		    ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "",
 		    ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "",
 		    ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" :
diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c
index de0b691d4d2a..10a5fc7f08ab 100644
--- a/sys/net80211/ieee80211_vht.c
+++ b/sys/net80211/ieee80211_vht.c
@@ -974,7 +974,7 @@ ieee80211_vht_check_tx_vht40(const struct ieee80211_node *ni)
 
 	return (IEEE80211_IS_CHAN_VHT40(bss_chan) &&
 	    IEEE80211_IS_CHAN_VHT40(ni->ni_chan) &&
-	    (ni->ni_chw == IEEE80211_STA_RX_BW_40));
+	    (ni->ni_chw == NET80211_STA_RX_BW_40));
 }
 
 /*
@@ -1003,7 +1003,7 @@ ieee80211_vht_check_tx_vht80(const struct ieee80211_node *ni)
 	 */
 	return (IEEE80211_IS_CHAN_VHT80(bss_chan) &&
 	    IEEE80211_IS_CHAN_VHT80(ni->ni_chan) &&
-	    (ni->ni_chw != IEEE80211_STA_RX_BW_20));
+	    (ni->ni_chw != NET80211_STA_RX_BW_20));
 }
 
 /*
@@ -1030,7 +1030,7 @@ ieee80211_vht_check_tx_vht160(const struct ieee80211_node *ni)
 	 * If a HT TX width action frame sets it to 20MHz
 	 * then reject doing 160MHz.
 	 */
-	if (ni->ni_chw == IEEE80211_STA_RX_BW_20)
+	if (ni->ni_chw == NET80211_STA_RX_BW_20)
 		return (false);
 
 	if (IEEE80211_IS_CHAN_VHT160(bss_chan) &&
@@ -1062,19 +1062,19 @@ ieee80211_vht_check_tx_vht160(const struct ieee80211_node *ni)
  */
 bool
 ieee80211_vht_check_tx_bw(const struct ieee80211_node *ni,
-    enum ieee80211_sta_rx_bw bw)
+    enum net80211_sta_rx_bw bw)
 {
 
 	switch (bw) {
-	case IEEE80211_STA_RX_BW_20:
+	case NET80211_STA_RX_BW_20:
 		return (ieee80211_vht_check_tx_vht(ni));
-	case IEEE80211_STA_RX_BW_40:
+	case NET80211_STA_RX_BW_40:
 		return (ieee80211_vht_check_tx_vht40(ni));
-	case IEEE80211_STA_RX_BW_80:
+	case NET80211_STA_RX_BW_80:
 		return (ieee80211_vht_check_tx_vht80(ni));
-	case IEEE80211_STA_RX_BW_160:
+	case NET80211_STA_RX_BW_160:
 		return (ieee80211_vht_check_tx_vht160(ni));
-	case IEEE80211_STA_RX_BW_320:
+	case NET80211_STA_RX_BW_320:
 		return (false);
 	default:
 		return (false);
@@ -1096,7 +1096,7 @@ ieee80211_vht_check_tx_bw(const struct ieee80211_node *ni,
  */
 bool
 ieee80211_vht_node_check_tx_valid_mcs(const struct ieee80211_node *ni,
-    enum ieee80211_sta_rx_bw bw, uint8_t nss, uint8_t mcs)
+    enum net80211_sta_rx_bw bw, uint8_t nss, uint8_t mcs)
 {
 	uint8_t mc;
 
diff --git a/sys/net80211/ieee80211_vht.h b/sys/net80211/ieee80211_vht.h
index a1529df4a85b..b9b19fbc6008 100644
--- a/sys/net80211/ieee80211_vht.h
+++ b/sys/net80211/ieee80211_vht.h
@@ -65,8 +65,8 @@ void	ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni,
 
 bool	ieee80211_vht_check_tx_vht(const struct ieee80211_node *);
 bool	ieee80211_vht_check_tx_bw(const struct ieee80211_node *,
-	    enum ieee80211_sta_rx_bw);
+	    enum net80211_sta_rx_bw);
 bool	ieee80211_vht_node_check_tx_valid_mcs(const struct ieee80211_node *,
-	    enum ieee80211_sta_rx_bw bw, uint8_t, uint8_t);
+	    enum net80211_sta_rx_bw bw, uint8_t, uint8_t);
 
 #endif	/* _NET80211_IEEE80211_VHT_H_ */