From nobody Wed Feb 26 19:31:35 2025 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 4Z34N8430pz5nkpD; Wed, 26 Feb 2025 19:31:36 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34N80qKQz3dVT; Wed, 26 Feb 2025 19:31:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598296; 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=uofPAcPZP+v7cuqhZfb8rKlqEQA/M5C3D42M2LC/b1M=; b=fKJ8mxJxf3REBGEyOKHG8BYiymBhleKFhLRKFKPg5YggjyF/VNWN/1SBzwYXN1egRprGlk ZZwC/C5VeB8nafr4SchmMB78Pi1jgJyQXSPxZGpzaixCsCJq+8PStIOmKscoB7W5B08Li0 znwoJaFNCdnDvbk1FjFbMh9ST7Q4v4MYbvOjtDzl1r3D7DT6ad3zU45pefiYSPgZm/k8NZ 8L7i587ecTHWOHBa/lpz9wPOg4xaAkcbqIrZGUejeJ+Yco74XUJMwUikpFgVkBY2hDz7HS QkD2FagtR3ao+NuW886IUbZh+10RQxNZicdl5o9+SpmlmV6rXtkYB/vqCy6aVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598296; a=rsa-sha256; cv=none; b=TUZU9ESWBW/A0pmiLE+WQAUUunnXCO27vraQi14bEoeIaRzaSW3KCCWxNkJuSRkVDyr2lf 8oXVN/m+PHSdjsIOV6/42NZFjmzBVBHM6C7p3qA4w4N94K+kL2LNq5uUPOx9Ki2m/4yEnL Up8pn0C/WZrX1dJ5/vkUUW1PUDSIlFmZC6uE+Po9zoqrbbcs9ECAE7KvTMRc0Kl1w6OpRH 4/C3W6rBDVzOyeARzTbl5bYaZd24sT89SCCC1sj0ujAmL2rP+K744N6F6ajKCPEH0R+VRz qm1mGa9R0FtSlmcYAlma5P00Nf0+ImucZDL9xk9pRyrA2e5IaP/F+VBMjZmJ9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598296; 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=uofPAcPZP+v7cuqhZfb8rKlqEQA/M5C3D42M2LC/b1M=; b=S2IqMivRHfe/AQLE8sVNcrwGf7CWZk+Si8KVz6p91j3p151GqlBIwi9wSQubbsYEa/KbBW yGbHYYusI0mY0GX0qQHiuydQZuRly2Pn10k3fJqQbkreoJW8QvlmCjviJa+LQOUsPlGYpI 60JcBIejpZq56XyYAIsjmdA0lDt8FzK/ttHG3SvU+7lvA859nim5ESpPNaVssiacPRaX5+ bNLu1e6QJGORR8dmrL+S/XFcBJUh8uk4eXsNU8eqS0p8WuVHfYytSB7vSTTng/EBYj/tef VxGoL4ucZouzOC6mzh9x2nsnv9cO22K/4j1eE9pcwPsccazStWJgaHQ6asLVOA== 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 4Z34N80PyWz1PTw; Wed, 26 Feb 2025 19:31:36 +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 51QJVaw8017512; Wed, 26 Feb 2025 19:31:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVZKf017509; Wed, 26 Feb 2025 19:31:35 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:35 GMT Message-Id: <202502261931.51QJVZKf017509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 706745001093 - main - sys: convert ni->ni_txrate references use to the new net80211 API 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7067450010931479f8dd97e51e4c5bf6a4d34c7e Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=7067450010931479f8dd97e51e4c5bf6a4d34c7e commit 7067450010931479f8dd97e51e4c5bf6a4d34c7e Author: Adrian Chadd AuthorDate: 2025-01-02 04:35:24 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:29:18 +0000 sys: convert ni->ni_txrate references use to the new net80211 API This just mechanically converts things. * For linuxkpi, it was just used for display. * For uath, it was just used for display, as firmware doesn't report it up. Differential Revision: https://reviews.freebsd.org/D48602 Reviewed by: bz, thj --- sys/compat/linuxkpi/common/src/linux_80211.c | 6 ++++-- sys/dev/ath/ath_rate/amrr/amrr.c | 7 +++++-- sys/dev/ath/ath_rate/onoe/onoe.c | 8 +++++--- sys/dev/ath/ath_rate/sample/sample.c | 15 ++++++++++----- sys/dev/bwi/if_bwi.c | 2 +- sys/dev/bwn/if_bwn.c | 2 +- sys/dev/ipw/if_ipw.c | 4 ++-- sys/dev/iwi/if_iwi.c | 4 ++-- sys/dev/iwm/if_iwm.c | 8 +++++--- sys/dev/iwn/if_iwn.c | 2 +- sys/dev/malo/if_malo.c | 2 +- sys/dev/mwl/if_mwl.c | 11 ++++++----- sys/dev/otus/if_otus.c | 9 ++++++--- sys/dev/ral/rt2560.c | 4 ++-- sys/dev/ral/rt2661.c | 4 ++-- sys/dev/ral/rt2860.c | 2 +- sys/dev/rtwn/if_rtwn_tx.c | 2 +- sys/dev/usb/wlan/if_mtw.c | 10 ++++++---- sys/dev/usb/wlan/if_rsu.c | 3 ++- sys/dev/usb/wlan/if_rum.c | 2 +- sys/dev/usb/wlan/if_run.c | 7 +++++-- sys/dev/usb/wlan/if_uath.c | 3 ++- sys/dev/usb/wlan/if_ural.c | 2 +- sys/dev/usb/wlan/if_zyd.c | 2 +- sys/dev/wpi/if_wpi.c | 2 +- sys/dev/wtap/if_wtap.c | 5 ++--- 26 files changed, 76 insertions(+), 52 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 894d0db39677..72227378b097 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -6925,7 +6925,8 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, #ifdef LINUXKPI_DEBUG_80211 int old_rate; - old_rate = ni->ni_vap->iv_bss->ni_txrate; + old_rate = + ieee80211_node_get_txrate_dot11rate(ni->ni_vap->iv_bss); #endif txs.pktlen = skb->len; txs.flags |= IEEE80211_RATECTL_STATUS_PKTLEN; @@ -6951,7 +6952,8 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, if (linuxkpi_debug_80211 & D80211_TRACE_TX) { printf("TX-RATE: %s: old %d new %d ridx %d, " "long_retries %d\n", __func__, - old_rate, ni->ni_vap->iv_bss->ni_txrate, + old_rate, + ieee80211_node_get_txrate_dot11rate(ni->ni_vap->iv_bss), ridx, txs.long_retries); } #endif diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c index 81bd03484de5..8f696eba23eb 100644 --- a/sys/dev/ath/ath_rate/amrr/amrr.c +++ b/sys/dev/ath/ath_rate/amrr/amrr.c @@ -245,8 +245,11 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) * lowest hardware rate. */ if (ni->ni_rates.rs_nrates > 0) { - ni->ni_txrate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; - amn->amn_tx_rix0 = sc->sc_rixmap[ni->ni_txrate]; + uint8_t dot11rate; + + dot11rate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; + amn->amn_tx_rix0 = sc->sc_rixmap[dot11rate]; + ieee80211_node_set_txrate_dot11rate(ni, dot11rate); amn->amn_tx_rate0 = rt->info[amn->amn_tx_rix0].rateCode; amn->amn_tx_rate0sp = amn->amn_tx_rate0 | rt->info[amn->amn_tx_rix0].shortPreamble; diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c index 8d86f13ef703..035d54b00b62 100644 --- a/sys/dev/ath/ath_rate/onoe/onoe.c +++ b/sys/dev/ath/ath_rate/onoe/onoe.c @@ -203,6 +203,7 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) struct ieee80211vap *vap = ni->ni_vap; const HAL_RATE_TABLE *rt = sc->sc_currates; u_int8_t rix; + uint8_t dot11rate; KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); @@ -221,8 +222,9 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) if (ni->ni_rates.rs_nrates == 0) goto done; on->on_rix = rate; - ni->ni_txrate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; - on->on_tx_rix0 = sc->sc_rixmap[ni->ni_txrate]; + dot11rate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, dot11rate); + on->on_tx_rix0 = sc->sc_rixmap[dot11rate]; on->on_tx_rate0 = rt->info[on->on_tx_rix0].rateCode; on->on_tx_rate0sp = on->on_tx_rate0 | @@ -389,7 +391,7 @@ ath_rate_ctl(void *arg, struct ieee80211_node *ni) if (nrate != on->on_rix) { IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "%s: %dM -> %dM (%d ok, %d err, %d retr)", __func__, - ni->ni_txrate / 2, + ieee80211_node_get_txrate_kbit(ni) / 1000, (rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2, on->on_tx_ok, on->on_tx_err, on->on_tx_retr); ath_rate_update(sc, ni, nrate); diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 58df9ad1c1cd..8fba3c68099f 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -855,9 +855,13 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, /* * Set the visible txrate for this node. */ - an->an_node.ni_txrate = - (rt->info[best_rix].phy == IEEE80211_T_HT) ? - MCS(best_rix) : DOT11RATE(best_rix); + if (rt->info[best_rix].phy == IEEE80211_T_HT) + ieee80211_node_set_txrate_ht_mcsrate( + &an->an_node, MCS(best_rix)); + else + ieee80211_node_set_txrate_dot11rate( + &an->an_node, + DOT11RATE(best_rix)); } rix = sn->current_rix[size_bin]; sn->packets_since_switch[size_bin]++; @@ -1409,9 +1413,10 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni) #endif /* set the visible bit-rate */ if (sn->static_rix != -1) - ni->ni_txrate = DOT11RATE(sn->static_rix); + ieee80211_node_set_txrate_dot11rate(ni, + DOT11RATE(sn->static_rix)); else - ni->ni_txrate = RATE(0); + ieee80211_node_set_txrate_dot11rate(ni, RATE(0)); #undef RATE #undef DOT11RATE } diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index f9a6b2357cc0..079dac73ea43 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -2944,7 +2944,7 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, rate = rate_fb = tp->ucastrate; } else { rix = ieee80211_ratectl_rate(ni, NULL, pkt_len); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); if (rix > 0) { rate_fb = ni->ni_rates.rs_rates[rix-1] & diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c index 0f44c3c94672..571482afda70 100644 --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -6421,7 +6421,7 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_node *ni, rate = rate_fb = tp->ucastrate; else { rix = ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); if (rix > 0) rate_fb = ni->ni_rates.rs_rates[rix - 1] & diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c index 68662f378933..01d713cdae18 100644 --- a/sys/dev/ipw/if_ipw.c +++ b/sys/dev/ipw/if_ipw.c @@ -838,8 +838,8 @@ ipw_media_status(if_t ifp, struct ifmediareq *imr) struct ipw_softc *sc = ic->ic_softc; /* read current transmission rate from adapter */ - vap->iv_bss->ni_txrate = ipw_cvtrate( - ipw_read_table1(sc, IPW_INFO_CURRENT_TX_RATE) & 0xf); + ieee80211_node_set_txrate_dot11rate(vap->iv_bss, + ipw_cvtrate(ipw_read_table1(sc, IPW_INFO_CURRENT_TX_RATE) & 0xf)); ieee80211_media_status(ifp, imr); } diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index 4d71550f512e..3a410a5cbf2c 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -927,8 +927,8 @@ iwi_media_status(if_t ifp, struct ifmediareq *imr) /* read current transmission rate from adapter */ ni = ieee80211_ref_node(vap->iv_bss); - ni->ni_txrate = - iwi_cvtrate(CSR_READ_4(sc, IWI_CSR_CURRENT_TX_RATE)); + ieee80211_node_set_txrate_dot11rate(ni, + iwi_cvtrate(CSR_READ_4(sc, IWI_CSR_CURRENT_TX_RATE))); ieee80211_free_node(ni); ieee80211_media_status(ifp, imr); } diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 248bfd056580..bfe8c3635c7c 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -3445,7 +3445,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, struct ieee80211_node *ni = &in->in_ni; struct ieee80211vap *vap = ni->ni_vap; int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK; - int new_rate, cur_rate = vap->iv_bss->ni_txrate; + int new_rate, cur_rate; boolean_t rate_matched; uint8_t tx_resp_rate; @@ -3463,6 +3463,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, le32toh(tx_resp->initial_rate), (int) le16toh(tx_resp->wireless_media_time)); + cur_rate = ieee80211_node_get_txrate_dot11rate(vap->iv_bss); tx_resp_rate = iwm_rate_from_ucode_rate(le32toh(tx_resp->initial_rate)); /* For rate control, ignore frames sent at different initial rate */ @@ -3502,7 +3503,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, ieee80211_ratectl_tx_complete(ni, txs); int rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); - new_rate = vap->iv_bss->ni_txrate; + new_rate = ieee80211_node_get_txrate_dot11rate(vap->iv_bss); if (new_rate != 0 && new_rate != cur_rate) { struct iwm_node *in = IWM_NODE(vap->iv_bss); iwm_setrates(sc, in, rix); @@ -3695,7 +3696,8 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in, } else { /* for data frames, use RS table */ IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: DATA\n", __func__); - ridx = iwm_rate2ridx(sc, ni->ni_txrate); + ridx = iwm_rate2ridx(sc, + ieee80211_node_get_txrate_dot11rate(ni)); if (ridx == -1) ridx = 0; diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index b887ebf842e1..b7c452a4f074 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -4570,7 +4570,7 @@ iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) else { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } /* diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c index 52419f377bb6..79a3213c6802 100644 --- a/sys/dev/malo/if_malo.c +++ b/sys/dev/malo/if_malo.c @@ -898,7 +898,7 @@ malo_updatetxrate(struct ieee80211_node *ni, int rix) static const int ieeerates[] = { 2, 4, 11, 22, 44, 12, 18, 24, 36, 48, 96, 108 }; if (rix < nitems(ieeerates)) - ni->ni_txrate = ieeerates[rix]; + ieee80211_node_set_txrate_dot11rate(ni, ieeerates[rix]); } static int diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c index d0d13e576d31..2570cbce525b 100644 --- a/sys/dev/mwl/if_mwl.c +++ b/sys/dev/mwl/if_mwl.c @@ -3344,6 +3344,7 @@ mwl_tx_processq(struct mwl_softc *sc, struct mwl_txq *txq) ni = bf->bf_node; if (ni != NULL) { status = le32toh(ds->Status); + int rate; if (status & EAGLE_TXD_STATUS_OK) { uint16_t Format = le16toh(ds->Format); uint8_t txant = _IEEE80211_MASKSHIFT(Format, @@ -3356,14 +3357,14 @@ mwl_tx_processq(struct mwl_softc *sc, struct mwl_txq *txq) sc->sc_stats.mst_tx_mretries++; if (txq->qnum >= MWL_WME_AC_VO) ic->ic_wme.wme_hipri_traffic++; - ni->ni_txrate = _IEEE80211_MASKSHIFT(Format, + rate = _IEEE80211_MASKSHIFT(Format, EAGLE_TXD_RATE); if ((Format & EAGLE_TXD_FORMAT_HT) == 0) { - ni->ni_txrate = mwl_cvtlegacyrix( - ni->ni_txrate); + rate = mwl_cvtlegacyrix(rate); } else - ni->ni_txrate |= IEEE80211_RATE_MCS; - sc->sc_stats.mst_tx_rate = ni->ni_txrate; + rate |= IEEE80211_RATE_MCS; + sc->sc_stats.mst_tx_rate = rate; + ieee80211_node_set_txrate_dot11rate(ni, rate); } else { if (status & EAGLE_TXD_STATUS_FAILED_LINK_ERROR) sc->sc_stats.mst_tx_linkerror++; diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c index a620a400bfd6..5919e75a59cf 100644 --- a/sys/dev/otus/if_otus.c +++ b/sys/dev/otus/if_otus.c @@ -2281,7 +2281,8 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node *ni, struct mbuf *m, rate = otus_rate_to_hw_rate(sc, tp->ucastrate); else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = otus_rate_to_hw_rate(sc, ni->ni_txrate); + rate = otus_rate_to_hw_rate(sc, + ieee80211_node_get_txrate_dot11rate(ni)); } phyctl = 0; @@ -2346,9 +2347,11 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node *ni, struct mbuf *m, data->m = m; OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, - "%s: tx: m=%p; data=%p; len=%d mac=0x%04x phy=0x%08x rate=0x%02x, ni_txrate=%d\n", + "%s: tx: m=%p; data=%p; len=%d mac=0x%04x phy=0x%08x " + "rate=0x%02x, dot11rate=%d\n", __func__, m, data, le16toh(head->len), macctl, phyctl, - (int) rate, (int) ni->ni_txrate); + (int) rate, + (int) ieee80211_node_get_txrate_dot11rate(ni)); /* Submit transfer */ STAILQ_INSERT_TAIL(&sc->sc_tx_pending[OTUS_BULK_TX], data, next); diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index aaae1245a9a1..09b01ea55be9 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -1740,7 +1740,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, rate = tp->ucastrate; } else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { @@ -1821,7 +1821,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, /* remember link conditions for rate adaptation algorithm */ if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { - data->rix = ni->ni_txrate; + data->rix = ieee80211_node_get_txrate_dot11rate(ni); /* XXX probably need last rssi value and not avg */ data->rssi = ic->ic_node_getrssi(ni); } else diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index 4912e1106fa6..38cd99d899ed 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -1431,7 +1431,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0, rate = tp->ucastrate; } else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } rate &= IEEE80211_RATE_VAL; @@ -1515,7 +1515,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0, /* remember link conditions for rate adaptation algorithm */ if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { - data->rix = ni->ni_txrate; + data->rix = ieee80211_node_get_txrate_dot11rate(ni); /* XXX probably need last rssi value and not avg */ data->rssi = ic->ic_node_getrssi(ni); } else diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c index e928de084bcb..1449df683a93 100644 --- a/sys/dev/ral/rt2860.c +++ b/sys/dev/ral/rt2860.c @@ -1493,7 +1493,7 @@ rt2860_tx(struct rt2860_softc *sc, struct mbuf *m, struct ieee80211_node *ni) rate = tp->ucastrate; } else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } rate &= IEEE80211_RATE_VAL; diff --git a/sys/dev/rtwn/if_rtwn_tx.c b/sys/dev/rtwn/if_rtwn_tx.c index c59d1de1dea8..f355bc589143 100644 --- a/sys/dev/rtwn/if_rtwn_tx.c +++ b/sys/dev/rtwn/if_rtwn_tx.c @@ -143,7 +143,7 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } else { if (ni->ni_flags & IEEE80211_NODE_HT) rate = IEEE80211_RATE_MCS | 0x4; /* MCS4 */ diff --git a/sys/dev/usb/wlan/if_mtw.c b/sys/dev/usb/wlan/if_mtw.c index 51398134ff9d..b42ed336d18e 100644 --- a/sys/dev/usb/wlan/if_mtw.c +++ b/sys/dev/usb/wlan/if_mtw.c @@ -2155,7 +2155,7 @@ mtw_iter_func(void *arg, struct ieee80211_node *ni) uint32_t sta[3]; uint16_t(*wstat)[3]; int error, ridx; - + uint8_t txrate = 0; /* Check for special case */ if (sc->rvp_cnt <= 1 && vap->iv_opmode == IEEE80211_M_STA && @@ -2208,11 +2208,13 @@ mtw_iter_func(void *arg, struct ieee80211_node *ni) ieee80211_ratectl_tx_update(vap, txs); ieee80211_ratectl_rate(ni, NULL, 0); + txrate = ieee80211_node_get_txrate_dot11rate(ni); + /* XXX TODO: methodize with MCS rates */ for (ridx = 0; ridx < MTW_RIDX_MAX; ridx++) { MTW_DPRINTF(sc, MTW_DEBUG_RATE, "ni_txrate=0x%x\n", - ni->ni_txrate); - if (rt2860_rates[ridx].rate == ni->ni_txrate) { + txrate); + if (rt2860_rates[ridx].rate == txrate) { break; } } @@ -2221,7 +2223,7 @@ fail: MTW_UNLOCK(sc); MTW_DPRINTF(sc, MTW_DEBUG_RATE, "rate=%d, ridx=%d\n", - ni->ni_txrate, rn->amrr_ridx); + txrate, rn->amrr_ridx); } static void diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index c967435250ee..997a739562f6 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -1500,7 +1500,8 @@ rsu_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ni = ieee80211_ref_node(vap->iv_bss); rs = &ni->ni_rates; /* Indicate highest supported rate. */ - ni->ni_txrate = rs->rs_rates[rs->rs_nrates - 1]; + ieee80211_node_set_txrate_dot11rate(ni, + rs->rs_rates[rs->rs_nrates - 1]); (void) rsu_set_fw_power_state(sc, RSU_PWR_SLEEP); ieee80211_free_node(ni); startcal = 1; diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c index fc83409543ec..48674d84ffe3 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -1646,7 +1646,7 @@ rum_tx_data(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) rate = tp->ucastrate; else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index e709ceff8849..81f4d172241f 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -2685,6 +2685,7 @@ run_iter_func(void *arg, struct ieee80211_node *ni) union run_stats sta[2]; uint16_t (*wstat)[3]; int error, ridx; + uint8_t dot11rate; RUN_LOCK(sc); @@ -2737,15 +2738,17 @@ run_iter_func(void *arg, struct ieee80211_node *ni) ieee80211_ratectl_tx_update(vap, txs); ieee80211_ratectl_rate(ni, NULL, 0); /* XXX TODO: methodize with MCS rates */ + dot11rate = ieee80211_node_get_txrate_dot11rate(ni); for (ridx = 0; ridx < RT2860_RIDX_MAX; ridx++) - if (rt2860_rates[ridx].rate == ni->ni_txrate) + if (rt2860_rates[ridx].rate == dot11rate) break; rn->amrr_ridx = ridx; fail: RUN_UNLOCK(sc); - RUN_DPRINTF(sc, RUN_DEBUG_RATE, "rate=%d, ridx=%d\n", ni->ni_txrate, rn->amrr_ridx); + RUN_DPRINTF(sc, RUN_DEBUG_RATE, "rate=0x%02x, ridx=%d\n", + ieee80211_node_get_txrate_dot11rate(ni), rn->amrr_ridx); } static void diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c index 10e3b50eaeb3..e4493ba50a30 100644 --- a/sys/dev/usb/wlan/if_uath.c +++ b/sys/dev/usb/wlan/if_uath.c @@ -2058,7 +2058,8 @@ uath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) * Tx rate is controlled by firmware, report the maximum * negotiated rate in ifconfig output. */ - ni->ni_txrate = ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates-1]; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates-1]); if (uath_write_associd(sc) != 0) { device_printf(sc->sc_dev, diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index 6e01592da44f..c47b8cbeb3ae 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -1227,7 +1227,7 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) rate = tp->ucastrate; else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index 76e7d4312040..1815dc04cd09 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -2460,7 +2460,7 @@ zyd_tx_start(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) rate = tp->ucastrate; else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } } diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 11b8a749090d..471700ca9f5c 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -2821,7 +2821,7 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni) else { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } /* Encrypt the frame if need be. */ diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c index f9e0c2a7e5c4..3aa3831e72c2 100644 --- a/sys/dev/wtap/if_wtap.c +++ b/sys/dev/wtap/if_wtap.c @@ -401,7 +401,7 @@ wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], /* TODO this is a hack to force it to choose the rate we want */ ni = ieee80211_ref_node(vap->iv_bss); - ni->ni_txrate = 130; + ieee80211_node_set_txrate_ht_mcsrate(ni, 2); ieee80211_free_node(ni); return vap; } @@ -617,8 +617,7 @@ wtap_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) M_NOWAIT|M_ZERO); if (ni == NULL) return (NULL); - - ni->ni_txrate = 130; + ieee80211_node_set_txrate_ht_mcsrate(ni, 2); return ni; }