diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -294,9 +294,9 @@ 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 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -2604,8 +2604,8 @@ 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.h b/sys/net80211/ieee80211_node.h --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -115,17 +115,29 @@ * 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 diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -2672,9 +2672,9 @@ 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);