Skip to content

Commit 06527b2

Browse files
Bjoern A. ZeebBjoern A. Zeeb
authored andcommitted
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: ca38948, 2c8b0d6 MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D52064
1 parent 0490757 commit 06527b2

File tree

16 files changed

+83
-75
lines changed

16 files changed

+83
-75
lines changed

sys/compat/linuxkpi/common/include/linux/ieee80211.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,14 @@ enum ieee80211_sta_state {
408408
IEEE80211_STA_AUTHORIZED = 4, /* 802.1x */
409409
};
410410

411+
enum ieee80211_sta_rx_bandwidth {
412+
IEEE80211_STA_RX_BW_20 = 0,
413+
IEEE80211_STA_RX_BW_40,
414+
IEEE80211_STA_RX_BW_80,
415+
IEEE80211_STA_RX_BW_160,
416+
IEEE80211_STA_RX_BW_320,
417+
};
418+
411419
enum ieee80211_tx_info_flags {
412420
/* XXX TODO .. right shift numbers - not sure where that came from? */
413421
IEEE80211_TX_CTL_AMPDU = BIT(0),

sys/compat/linuxkpi/common/include/net/mac80211.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ struct ieee80211_link_sta {
737737
struct ieee80211_he_6ghz_capa he_6ghz_capa;
738738
struct ieee80211_sta_eht_cap eht_cap;
739739
uint8_t rx_nss;
740-
enum ieee80211_sta_rx_bw bandwidth;
740+
enum ieee80211_sta_rx_bandwidth bandwidth;
741741
enum ieee80211_smps_mode smps_mode;
742742
struct ieee80211_sta_agg agg;
743743
struct ieee80211_sta_txpwr txpwr;

sys/compat/linuxkpi/common/src/linux_80211.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ lkpi_80211_dump_stas(SYSCTL_HANDLER_ARGS)
401401
return (0);
402402
}
403403

404-
static enum ieee80211_sta_rx_bw
404+
static enum ieee80211_sta_rx_bandwidth
405405
lkpi_cw_to_rx_bw(enum nl80211_chan_width cw)
406406
{
407407
switch (cw) {
@@ -425,7 +425,7 @@ lkpi_cw_to_rx_bw(enum nl80211_chan_width cw)
425425
}
426426

427427
static enum nl80211_chan_width
428-
lkpi_rx_bw_to_cw(enum ieee80211_sta_rx_bw rx_bw)
428+
lkpi_rx_bw_to_cw(enum ieee80211_sta_rx_bandwidth rx_bw)
429429
{
430430
switch (rx_bw) {
431431
case IEEE80211_STA_RX_BW_20:
@@ -446,7 +446,7 @@ lkpi_sync_chanctx_cw_from_rx_bw(struct ieee80211_hw *hw,
446446
struct ieee80211_vif *vif, struct ieee80211_sta *sta)
447447
{
448448
struct ieee80211_chanctx_conf *chanctx_conf;
449-
enum ieee80211_sta_rx_bw old_bw;
449+
enum ieee80211_sta_rx_bandwidth old_bw;
450450
uint32_t changed;
451451

452452
chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf,
@@ -551,7 +551,7 @@ static void
551551
lkpi_sta_sync_vht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
552552
struct ieee80211_node *ni)
553553
{
554-
enum ieee80211_sta_rx_bw bw;
554+
enum ieee80211_sta_rx_bandwidth bw;
555555
uint32_t width;
556556
int rx_nss;
557557
uint16_t rx_mcs_map;

sys/dev/ath/ath_rate/sample/sample.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ ath_rate_sample_find_min_pktlength(struct ath_softc *sc,
179179
const struct txschedule *sched = &sn->sched[rix0];
180180
int max_pkt_length = 65530; // ATH_AGGR_MAXSIZE
181181
// Note: this may not be true in all cases; need to check?
182-
int is_ht40 = (an->an_node.ni_chw == IEEE80211_STA_RX_BW_40);
182+
int is_ht40 = (an->an_node.ni_chw == NET80211_STA_RX_BW_40);
183183
// Note: not great, but good enough..
184184
int idx = is_ht40 ? MCS_HT40 : MCS_HT20;
185185

@@ -979,7 +979,7 @@ update_stats(struct ath_softc *sc, struct ath_node *an,
979979
const int size_bin = size_to_bin(frame_size);
980980
const int size = bin_to_size(size_bin);
981981
int tt;
982-
int is_ht40 = (an->an_node.ni_chw == IEEE80211_STA_RX_BW_40);
982+
int is_ht40 = (an->an_node.ni_chw == NET80211_STA_RX_BW_40);
983983
int pct;
984984

985985
if (!IS_RATE_DEFINED(sn, rix0))
@@ -1365,7 +1365,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
13651365
continue;
13661366
printf(" %d %s/%d", dot11rate(rt, rix), dot11rate_label(rt, rix),
13671367
calc_usecs_unicast_packet(sc, 1600, rix, 0,0,
1368-
(ni->ni_chw == IEEE80211_STA_RX_BW_40)));
1368+
(ni->ni_chw == NET80211_STA_RX_BW_40)));
13691369
}
13701370
printf("\n");
13711371
}
@@ -1396,7 +1396,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
13961396

13971397
sn->stats[y][rix].perfect_tx_time =
13981398
calc_usecs_unicast_packet(sc, size, rix, 0, 0,
1399-
(ni->ni_chw == IEEE80211_STA_RX_BW_40));
1399+
(ni->ni_chw == NET80211_STA_RX_BW_40));
14001400
sn->stats[y][rix].average_tx_time =
14011401
sn->stats[y][rix].perfect_tx_time;
14021402
}

sys/dev/ath/if_ath_tx_ht.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
283283
if (IS_HT_RATE(rate)) {
284284
rc[i].flags |= ATH_RC_HT_FLAG;
285285

286-
if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
286+
if (ni->ni_chw == NET80211_STA_RX_BW_40)
287287
rc[i].flags |= ATH_RC_CW40_FLAG;
288288

289289
/*
@@ -295,13 +295,13 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
295295
* and doesn't return the fractional part, so
296296
* we are always "out" by some amount.
297297
*/
298-
if (ni->ni_chw == IEEE80211_STA_RX_BW_40 &&
298+
if (ni->ni_chw == NET80211_STA_RX_BW_40 &&
299299
ieee80211_ht_check_tx_shortgi_40(ni) &&
300300
(bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
301301
rc[i].flags |= ATH_RC_SGI_FLAG;
302302
}
303303

304-
if (ni->ni_chw == IEEE80211_STA_RX_BW_20 &&
304+
if (ni->ni_chw == NET80211_STA_RX_BW_20 &&
305305
ieee80211_ht_check_tx_shortgi_20(ni) &&
306306
(bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) {
307307
rc[i].flags |= ATH_RC_SGI_FLAG;

sys/dev/mwl/if_mwl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4017,7 +4017,7 @@ mkpeerinfo(MWL_HAL_PEERINFO *pi, const struct ieee80211_node *ni)
40174017
pi->HTCapabilitiesInfo &= ~IEEE80211_HTCAP_SHORTGI40;
40184018
if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) == 0)
40194019
pi->HTCapabilitiesInfo &= ~IEEE80211_HTCAP_SHORTGI20;
4020-
if (ni->ni_chw != IEEE80211_STA_RX_BW_40)
4020+
if (ni->ni_chw != NET80211_STA_RX_BW_40)
40214021
pi->HTCapabilitiesInfo &= ~IEEE80211_HTCAP_CHWIDTH40;
40224022
}
40234023
return pi;

sys/dev/rtwn/rtl8812a/r12a_tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ r12a_tx_set_vht_bw(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni)
101101

102102
prim_chan = r12a_get_primary_channel(sc, ni->ni_chan);
103103

104-
if (ieee80211_vht_check_tx_bw(ni, IEEE80211_STA_RX_BW_80)) {
104+
if (ieee80211_vht_check_tx_bw(ni, NET80211_STA_RX_BW_80)) {
105105
txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_BW,
106106
R12A_TXDW5_DATA_BW80));
107107
txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_PRIM_CHAN,
108108
prim_chan));
109-
} else if (ieee80211_vht_check_tx_bw(ni, IEEE80211_STA_RX_BW_40)) {
109+
} else if (ieee80211_vht_check_tx_bw(ni, NET80211_STA_RX_BW_40)) {
110110
txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_BW,
111111
R12A_TXDW5_DATA_BW40));
112112
txd->txdw5 |= htole32(SM(R12A_TXDW5_DATA_PRIM_CHAN,

sys/net80211/ieee80211_ddb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ _db_show_sta(const struct ieee80211_node *ni)
296296
ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan);
297297
db_printf("\thtopmode 0x%x htstbc 0x%x chw %d (%s)\n",
298298
ni->ni_htopmode, ni->ni_htstbc,
299-
ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw));
299+
ni->ni_chw, net80211_ni_chw_to_str(ni->ni_chw));
300300

301301
/* XXX ampdu state */
302302
for (i = 0; i < WME_NUM_TID; i++)

sys/net80211/ieee80211_ht.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,15 +1476,15 @@ ieee80211_ht_wds_init(struct ieee80211_node *ni)
14761476
ni->ni_htcap |= IEEE80211_HTCAP_SHORTGI20;
14771477
if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
14781478
ni->ni_htcap |= IEEE80211_HTCAP_CHWIDTH40;
1479-
ni->ni_chw = IEEE80211_STA_RX_BW_40;
1479+
ni->ni_chw = NET80211_STA_RX_BW_40;
14801480
if (IEEE80211_IS_CHAN_HT40U(ni->ni_chan))
14811481
ni->ni_ht2ndchan = IEEE80211_HTINFO_2NDCHAN_ABOVE;
14821482
else if (IEEE80211_IS_CHAN_HT40D(ni->ni_chan))
14831483
ni->ni_ht2ndchan = IEEE80211_HTINFO_2NDCHAN_BELOW;
14841484
if (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40)
14851485
ni->ni_htcap |= IEEE80211_HTCAP_SHORTGI40;
14861486
} else {
1487-
ni->ni_chw = IEEE80211_STA_RX_BW_20;
1487+
ni->ni_chw = NET80211_STA_RX_BW_20;
14881488
ni->ni_ht2ndchan = IEEE80211_HTINFO_2NDCHAN_NONE;
14891489
}
14901490
ni->ni_htctlchan = ni->ni_chan->ic_ieee;
@@ -1580,7 +1580,7 @@ ieee80211_ht_node_join(struct ieee80211_node *ni)
15801580

15811581
if (ni->ni_flags & IEEE80211_NODE_HT) {
15821582
vap->iv_ht_sta_assoc++;
1583-
if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
1583+
if (ni->ni_chw == NET80211_STA_RX_BW_40)
15841584
vap->iv_ht40_sta_assoc++;
15851585
}
15861586
htinfo_update(vap);
@@ -1598,7 +1598,7 @@ ieee80211_ht_node_leave(struct ieee80211_node *ni)
15981598

15991599
if (ni->ni_flags & IEEE80211_NODE_HT) {
16001600
vap->iv_ht_sta_assoc--;
1601-
if (ni->ni_chw == IEEE80211_STA_RX_BW_40)
1601+
if (ni->ni_chw == NET80211_STA_RX_BW_40)
16021602
vap->iv_ht40_sta_assoc--;
16031603
}
16041604
htinfo_update(vap);
@@ -1827,7 +1827,7 @@ htinfo_update_chw(struct ieee80211_node *ni, int htflags, int vhtflags)
18271827
done:
18281828
/* update node's (11n) tx channel width */
18291829
ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan) ?
1830-
IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
1830+
NET80211_STA_RX_BW_40 : NET80211_STA_RX_BW_20;
18311831
return (ret);
18321832
}
18331833

@@ -2689,11 +2689,11 @@ ht_recv_action_ht_txchwidth(struct ieee80211_node *ni,
26892689
* here.
26902690
*/
26912691
chw = (frm[2] == IEEE80211_A_HT_TXCHWIDTH_2040) ?
2692-
IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
2692+
NET80211_STA_RX_BW_40 : NET80211_STA_RX_BW_20;
26932693

26942694
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
26952695
"%s: HT txchwidth, width %d%s (%s)", __func__,
2696-
chw, ni->ni_chw != chw ? "*" : "", ieee80211_ni_chw_to_str(chw));
2696+
chw, ni->ni_chw != chw ? "*" : "", net80211_ni_chw_to_str(chw));
26972697
if (chw != ni->ni_chw) {
26982698
/* XXX does this need to change the ht40 station count? */
26992699
ni->ni_chw = chw;
@@ -3832,5 +3832,5 @@ ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni)
38323832

38333833
return (IEEE80211_IS_CHAN_HT40(bss_chan) &&
38343834
IEEE80211_IS_CHAN_HT40(ni->ni_chan) &&
3835-
(ni->ni_chw == IEEE80211_STA_RX_BW_40));
3835+
(ni->ni_chw == NET80211_STA_RX_BW_40));
38363836
}

sys/net80211/ieee80211_node.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2673,7 +2673,7 @@ ieee80211_dump_node(struct ieee80211_node_table *nt __unused,
26732673
ni->ni_htctlchan, ni->ni_ht2ndchan);
26742674
net80211_printf("\thtopmode %x htstbc %x htchw %d (%s)\n",
26752675
ni->ni_htopmode, ni->ni_htstbc,
2676-
ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw));
2676+
ni->ni_chw, net80211_ni_chw_to_str(ni->ni_chw));
26772677
net80211_printf("\tvhtcap %x freq1 %d freq2 %d vhtbasicmcs %x\n",
26782678
ni->ni_vhtcap, (int) ni->ni_vht_chan1, (int) ni->ni_vht_chan2,
26792679
(int) ni->ni_vht_basicmcs);
@@ -2831,7 +2831,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp)
28312831
ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "",
28322832
/* XXX update for VHT string */
28332833
ni->ni_flags & IEEE80211_NODE_HT ?
2834-
(ni->ni_chw == IEEE80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "",
2834+
(ni->ni_chw == NET80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "",
28352835
ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "",
28362836
ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "",
28372837
ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" :

0 commit comments

Comments
 (0)