aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2025-01-13 05:50:34 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2025-02-26 19:30:51 +0000
commit1086f7bab303cc61b3dce1ae51cb008675ad758a (patch)
tree09f0e163460f60198a1e51ca7710c19805aea4f7 /sys
parent1568caaf572125b883aa6d0ed7f87b87ab0c9d45 (diff)
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
Diffstat (limited to 'sys')
-rw-r--r--sys/net80211/ieee80211_node.c40
-rw-r--r--sys/net80211/ieee80211_node.h4
2 files changed, 44 insertions, 0 deletions
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
@@ -3189,6 +3189,26 @@ ieee80211_node_get_txrate(struct ieee80211_node *ni,
}
/**
+ * @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
*
* This is the API call for legacy / 802.11n drivers and rate control APIs
@@ -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_ */