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 @@ -517,8 +517,12 @@ 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); +void ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni, + uint8_t nss, uint8_t mcs); uint16_t ieee80211_node_get_txrate_mbit(struct ieee80211_node *); #endif /* _NET80211_IEEE80211_NODE_H_ */ 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 @@ -3185,6 +3185,24 @@ memcpy(txr, &ni->ni_txrate, sizeof(struct ieee80211_node_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) +{ + + ni->ni_txrate = *txr; +} + /** * @brief set the dot11rate / ratecode representing the current transmit rate * @@ -3224,6 +3242,25 @@ 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) +{ + + ni->ni_txrate.type = IEEE80211_NODE_TXRATE_VHT; + ni->ni_txrate.mcs = mcs; + ni->ni_txrate.nss = nss; + ni->ni_txrate.dot11rate = 0; +} /* * Fetch the rate in the net80211 units of 1/2 mbit/sec.