@@ -901,7 +901,12 @@ struct ieee80211_tx_info {
u8 use_cts_prot:1;
u8 short_preamble:1;
u8 skip_table:1;
- /* 2 bytes free */
+
+ /* txpower field refers to the first
+ * entry of rates only (if present).
+ */
+ s8 txpower;
+ /* 1 byte free */
};
/* only needed before rate control */
unsigned long jiffies;
@@ -1733,13 +1738,14 @@ enum ieee80211_sta_rx_bandwidth {
* struct ieee80211_sta_rates - station rate selection table
*
* @rcu_head: RCU head used for freeing the table on update
- * @rate: transmit rates/flags to be used by default.
+ * @rate: transmit rates/power/flags to be used by default.
* Overriding entries per-packet is possible by using cb tx control.
*/
struct ieee80211_sta_rates {
struct rcu_head rcu_head;
struct {
s8 idx;
+ s8 txpower;
u8 count;
u8 count_cts;
u8 count_rts;
@@ -899,6 +899,8 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
info->control.rates[i].count = 0;
}
+ info->control.txpower = sdata->vif.bss_conf.txpower;
+
if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
return;
@@ -52,6 +52,7 @@
#include <linux/ieee80211.h>
#include <linux/slab.h>
#include <net/mac80211.h>
+#include "sta_info.h"
#include "rate.h"
#include "rc80211_minstrel.h"
@@ -125,12 +126,20 @@ static void
minstrel_update_rates(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
{
struct ieee80211_sta_rates *ratetbl;
+ struct sta_info *sta;
+ s8 txpower;
int i = 0;
+ sta = container_of(mi->sta, struct sta_info, sta);
+ txpower = sta->sdata->vif.bss_conf.txpower;
+
ratetbl = kzalloc(sizeof(*ratetbl), GFP_ATOMIC);
if (!ratetbl)
return;
+ for (i = 0; i < ARRAY_SIZE(ratetbl->rate); i++)
+ ratetbl->rate[i].txpower = txpower;
+
/* Start with max_tp_rate */
minstrel_set_rate(mi, ratetbl, i++, mi->max_tp_rate[0]);
@@ -921,12 +921,20 @@ static void
minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
{
struct ieee80211_sta_rates *rates;
+ struct sta_info *sta;
+ s8 txpower;
int i = 0;
+ sta = container_of(mi->sta, struct sta_info, sta);
+ txpower = sta->sdata->vif.bss_conf.txpower;
+
rates = kzalloc(sizeof(*rates), GFP_ATOMIC);
if (!rates)
return;
+ for (i = 0; i < ARRAY_SIZE(rates->rate); i++)
+ rates->rate[i].txpower = txpower;
+
/* Start with max_tp_rate[0] */
minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[0]);