aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-04-22 10:14:41 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-04-22 10:16:41 -0400
commit0d528d85c519b755b6f4e1bafa3a39984370e1c1 (patch)
tree5afbdbf16e1ae3d4bf698cf4031032cca220f4b0 /include/net/mac80211.h
parent5de17984898c5758fc6ebe08eccea9f4b6548914 (diff)
mac80211: improve the rate control API
Allow rate control modules to pass a rate selection table to mac80211 and the driver. This allows drivers to fetch the most recent rate selection from the sta pointer for already buffered frames. This allows rate control to respond faster to sudden link changes and it is also a step towards adding minstrel_ht support to drivers like iwlwifi. When a driver sets IEEE80211_HW_SUPPORTS_RC_TABLE, mac80211 will not fill info->control.rates with rates from the rate table (to preserve explicit overrides by the rate control module). The driver then explicitly calls ieee80211_get_tx_rates to merge overrides from info->control.rates with defaults from the sta rate table. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b77d57a070e5..04c2d4670dc6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -563,6 +563,9 @@ enum mac80211_rate_control_flags {
563/* maximum number of rate stages */ 563/* maximum number of rate stages */
564#define IEEE80211_TX_MAX_RATES 4 564#define IEEE80211_TX_MAX_RATES 4
565 565
566/* maximum number of rate table entries */
567#define IEEE80211_TX_RATE_TABLE_SIZE 4
568
566/** 569/**
567 * struct ieee80211_tx_rate - rate selection/status 570 * struct ieee80211_tx_rate - rate selection/status
568 * 571 *
@@ -659,6 +662,8 @@ struct ieee80211_tx_info {
659 s8 rts_cts_rate_idx; 662 s8 rts_cts_rate_idx;
660 u8 use_rts:1; 663 u8 use_rts:1;
661 u8 use_cts_prot:1; 664 u8 use_cts_prot:1;
665 u8 short_preamble:1;
666 u8 skip_table:1;
662 /* 2 bytes free */ 667 /* 2 bytes free */
663 }; 668 };
664 /* only needed before rate control */ 669 /* only needed before rate control */
@@ -680,6 +685,8 @@ struct ieee80211_tx_info {
680 struct { 685 struct {
681 struct ieee80211_tx_rate driver_rates[ 686 struct ieee80211_tx_rate driver_rates[
682 IEEE80211_TX_MAX_RATES]; 687 IEEE80211_TX_MAX_RATES];
688 u8 pad[4];
689
683 void *rate_driver_data[ 690 void *rate_driver_data[
684 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; 691 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
685 }; 692 };
@@ -1225,6 +1232,24 @@ enum ieee80211_sta_rx_bandwidth {
1225}; 1232};
1226 1233
1227/** 1234/**
1235 * struct ieee80211_sta_rates - station rate selection table
1236 *
1237 * @rcu_head: RCU head used for freeing the table on update
1238 * @rates: transmit rates/flags to be used by default.
1239 * Overriding entries per-packet is possible by using cb tx control.
1240 */
1241struct ieee80211_sta_rates {
1242 struct rcu_head rcu_head;
1243 struct {
1244 s8 idx;
1245 u8 count;
1246 u8 count_cts;
1247 u8 count_rts;
1248 u16 flags;
1249 } rate[IEEE80211_TX_RATE_TABLE_SIZE];
1250};
1251
1252/**
1228 * struct ieee80211_sta - station table entry 1253 * struct ieee80211_sta - station table entry
1229 * 1254 *
1230 * A station table entry represents a station we are possibly 1255 * A station table entry represents a station we are possibly
@@ -1251,6 +1276,7 @@ enum ieee80211_sta_rx_bandwidth {
1251 * notifications and capabilities. The value is only valid after 1276 * notifications and capabilities. The value is only valid after
1252 * the station moves to associated state. 1277 * the station moves to associated state.
1253 * @smps_mode: current SMPS mode (off, static or dynamic) 1278 * @smps_mode: current SMPS mode (off, static or dynamic)
1279 * @tx_rates: rate control selection table
1254 */ 1280 */
1255struct ieee80211_sta { 1281struct ieee80211_sta {
1256 u32 supp_rates[IEEE80211_NUM_BANDS]; 1282 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1264,6 +1290,7 @@ struct ieee80211_sta {
1264 u8 rx_nss; 1290 u8 rx_nss;
1265 enum ieee80211_sta_rx_bandwidth bandwidth; 1291 enum ieee80211_sta_rx_bandwidth bandwidth;
1266 enum ieee80211_smps_mode smps_mode; 1292 enum ieee80211_smps_mode smps_mode;
1293 struct ieee80211_sta_rates __rcu *rates;
1267 1294
1268 /* must be last */ 1295 /* must be last */
1269 u8 drv_priv[0] __aligned(sizeof(void *)); 1296 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1419,6 +1446,9 @@ struct ieee80211_tx_control {
1419 * for different virtual interfaces. See the doc section on HW queue 1446 * for different virtual interfaces. See the doc section on HW queue
1420 * control for more details. 1447 * control for more details.
1421 * 1448 *
1449 * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
1450 * selection table provided by the rate control algorithm.
1451 *
1422 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any 1452 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1423 * P2P Interface. This will be honoured even if more than one interface 1453 * P2P Interface. This will be honoured even if more than one interface
1424 * is supported. 1454 * is supported.
@@ -1451,6 +1481,7 @@ enum ieee80211_hw_flags {
1451 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1481 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1452 IEEE80211_HW_AP_LINK_PS = 1<<22, 1482 IEEE80211_HW_AP_LINK_PS = 1<<22,
1453 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1483 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1484 IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24,
1454 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1485 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1455 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1486 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1456}; 1487};
@@ -3137,6 +3168,25 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
3137 u8 tid, bool buffered); 3168 u8 tid, bool buffered);
3138 3169
3139/** 3170/**
3171 * ieee80211_get_tx_rates - get the selected transmit rates for a packet
3172 *
3173 * Call this function in a driver with per-packet rate selection support
3174 * to combine the rate info in the packet tx info with the most recent
3175 * rate selection table for the station entry.
3176 *
3177 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3178 * @sta: the receiver station to which this packet is sent.
3179 * @skb: the frame to be transmitted.
3180 * @dest: buffer for extracted rate/retry information
3181 * @max_rates: maximum number of rates to fetch
3182 */
3183void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
3184 struct ieee80211_sta *sta,
3185 struct sk_buff *skb,
3186 struct ieee80211_tx_rate *dest,
3187 int max_rates);
3188
3189/**
3140 * ieee80211_tx_status - transmit status callback 3190 * ieee80211_tx_status - transmit status callback
3141 * 3191 *
3142 * Call this function for all transmitted frames after they have been 3192 * Call this function for all transmitted frames after they have been
@@ -4212,6 +4262,22 @@ bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
4212 return false; 4262 return false;
4213} 4263}
4214 4264
4265/**
4266 * rate_control_set_rates - pass the sta rate selection to mac80211/driver
4267 *
4268 * When not doing a rate control probe to test rates, rate control should pass
4269 * its rate selection to mac80211. If the driver supports receiving a station
4270 * rate table, it will use it to ensure that frames are always sent based on
4271 * the most recent rate control module decision.
4272 *
4273 * @hw: pointer as obtained from ieee80211_alloc_hw()
4274 * @pubsta: &struct ieee80211_sta pointer to the target destination.
4275 * @rates: new tx rate set to be used for this station.
4276 */
4277int rate_control_set_rates(struct ieee80211_hw *hw,
4278 struct ieee80211_sta *pubsta,
4279 struct ieee80211_sta_rates *rates);
4280
4215int ieee80211_rate_control_register(struct rate_control_ops *ops); 4281int ieee80211_rate_control_register(struct rate_control_ops *ops);
4216void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 4282void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
4217 4283