The branch main has been updated by adrian:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1086f7bab303cc61b3dce1ae51cb008675ad758a

commit 1086f7bab303cc61b3dce1ae51cb008675ad758a
Author:     Adrian Chadd <adr...@freebsd.org>
AuthorDate: 2025-01-13 05:50:34 +0000
Commit:     Adrian Chadd <adr...@freebsd.org>
CommitDate: 2025-02-26 19:30:51 +0000

    net80211: add node VHT transmit rate helper functions
    
    * add a node VHT transmit function, which configures the parameters
      accordingly.
    
    * add a node VHT transmit function which just copies in another
      ieee80211_node_txrate struct.
    
    Differential Revision:  https://reviews.freebsd.org/D48609
    Reviewed by:    bz
---
 sys/net80211/ieee80211_node.c | 40 ++++++++++++++++++++++++++++++++++++++++
 sys/net80211/ieee80211_node.h |  4 ++++
 2 files changed, 44 insertions(+)

diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 5a239bbd30f6..bc0358feb7a8 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -3188,6 +3188,26 @@ ieee80211_node_get_txrate(struct ieee80211_node *ni,
        *txr = ni->ni_txrate;
 }
 
+/**
+ * @brief Set the txrate representing the current transmit rate
+ *
+ * This is the API call for drivers and rate control APIs to set
+ * rates.  It will copy a struct ieee80211_node_txrate with the
+ * current rate configuration to use.
+ *
+ * @param ni           the ieee80211_node to return the transmit rate for
+ * @param txrate       the struct ieee80211_node_txrate to copy to the node
+ */
+void
+ieee80211_node_set_txrate(struct ieee80211_node *ni,
+    const struct ieee80211_node_txrate *txr)
+{
+       MPASS(ni != NULL);
+       MPASS(txr != NULL);
+
+       ni->ni_txrate = *txr;
+}
+
 /**
  * @brief set the dot11rate / ratecode representing the current transmit rate
  *
@@ -3240,6 +3260,26 @@ ieee80211_node_set_txrate_ht_mcsrate(struct 
ieee80211_node *ni,
        ni->ni_txrate.dot11rate = IEEE80211_RATE_MCS | mcs;
 }
 
+/**
+ * @brief set the rate to the given VHT transmission rate.
+ *
+ * This sets the current transmit rate to the given VHT NSS/MCS.
+ *
+ * @param ni           the ieee80211_node to set the transmit rate for
+ * @param nss          the number of spatial streams
+ * @param mcs          the MCS rate to select
+ */
+void
+ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni,
+    uint8_t nss, uint8_t mcs)
+{
+       MPASS(ni != NULL);
+
+       ni->ni_txrate.type = IEEE80211_NODE_TXRATE_VHT;
+       ni->ni_txrate.mcs = mcs;
+       ni->ni_txrate.nss = nss;
+       ni->ni_txrate.dot11rate = 0;
+}
 
 /*
  * @brief Fetch the transmit rate for the given node in kbit/s.
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index 969d8e563fa9..ae5f72a070b6 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -521,8 +521,12 @@ void       ieee80211_getsignal(struct ieee80211vap *, 
int8_t *, int8_t *);
 uint8_t        ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *);
 void   ieee80211_node_get_txrate(struct ieee80211_node *,
                struct ieee80211_node_txrate *);
+void   ieee80211_node_set_txrate(struct ieee80211_node *,
+           const struct ieee80211_node_txrate *);
 void   ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *, uint8_t);
 void   ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *, uint8_t);
 uint32_t       ieee80211_node_get_txrate_kbit(struct ieee80211_node *);
+void   ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni,
+           uint8_t nss, uint8_t mcs);
 
 #endif /* _NET80211_IEEE80211_NODE_H_ */

Reply via email to