aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h195
1 files changed, 145 insertions, 50 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c06104476973..466859b285e1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -73,6 +73,21 @@
73 */ 73 */
74 74
75/** 75/**
76 * DOC: mac80211 workqueue
77 *
78 * mac80211 provides its own workqueue for drivers and internal mac80211 use.
79 * The workqueue is a single threaded workqueue and can only be accessed by
80 * helpers for sanity checking. Drivers must ensure all work added onto the
81 * mac80211 workqueue should be cancelled on the driver stop() callback.
82 *
83 * mac80211 will flushed the workqueue upon interface removal and during
84 * suspend.
85 *
86 * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
87 *
88 */
89
90/**
76 * enum ieee80211_max_queues - maximum number of queues 91 * enum ieee80211_max_queues - maximum number of queues
77 * 92 *
78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 93 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -224,7 +239,14 @@ struct ieee80211_bss_conf {
224 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 239 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
225 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211. 240 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
226 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 241 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
227 * because the destination STA was in powersave mode. 242 * because the destination STA was in powersave mode. Note that to
243 * avoid race conditions, the filter must be set by the hardware or
244 * firmware upon receiving a frame that indicates that the station
245 * went to sleep (must be done on device to filter frames already on
246 * the queue) and may only be unset after mac80211 gives the OK for
247 * that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
248 * since only then is it guaranteed that no more frames are in the
249 * hardware queue.
228 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 250 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
229 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status 251 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
230 * is for the whole aggregation. 252 * is for the whole aggregation.
@@ -241,6 +263,15 @@ struct ieee80211_bss_conf {
241 * it can be sent out. 263 * it can be sent out.
242 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, 264 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
243 * used to indicate that a frame was already retried due to PS 265 * used to indicate that a frame was already retried due to PS
266 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
267 * used to indicate frame should not be encrypted
268 * @IEEE80211_TX_CTL_PSPOLL_RESPONSE: (internal?)
269 * This frame is a response to a PS-poll frame and should be sent
270 * although the station is in powersave mode.
271 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
272 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full.
244 */ 275 */
245enum mac80211_tx_control_flags { 276enum mac80211_tx_control_flags {
246 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -259,6 +290,9 @@ enum mac80211_tx_control_flags {
259 IEEE80211_TX_INTFL_RCALGO = BIT(13), 290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
260 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
261 IEEE80211_TX_INTFL_RETRIED = BIT(15), 292 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
262}; 296};
263 297
264/** 298/**
@@ -316,6 +350,21 @@ enum mac80211_rate_control_flags {
316 * 350 *
317 * When used for transmit status reporting, the driver should 351 * When used for transmit status reporting, the driver should
318 * always report the rate along with the flags it used. 352 * always report the rate along with the flags it used.
353 *
354 * &struct ieee80211_tx_info contains an array of these structs
355 * in the control information, and it will be filled by the rate
356 * control algorithm according to what should be sent. For example,
357 * if this array contains, in the format { <idx>, <count> } the
358 * information
359 * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
360 * then this means that the frame should be transmitted
361 * up to twice at rate 3, up to twice at rate 2, and up to four
362 * times at rate 1 if it doesn't get acknowledged. Say it gets
363 * acknowledged by the peer after the fifth attempt, the status
364 * information should then contain
365 * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
366 * since it was transmitted twice at rate 3, twice at rate 2
367 * and once at rate 1 after which we received an acknowledgement.
319 */ 368 */
320struct ieee80211_tx_rate { 369struct ieee80211_tx_rate {
321 s8 idx; 370 s8 idx;
@@ -397,6 +446,11 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
397 return (struct ieee80211_tx_info *)skb->cb; 446 return (struct ieee80211_tx_info *)skb->cb;
398} 447}
399 448
449static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
450{
451 return (struct ieee80211_rx_status *)skb->cb;
452}
453
400/** 454/**
401 * ieee80211_tx_info_clear_status - clear TX status 455 * ieee80211_tx_info_clear_status - clear TX status
402 * 456 *
@@ -478,7 +532,7 @@ enum mac80211_rx_flags {
478 * 532 *
479 * The low-level driver should provide this information (the subset 533 * The low-level driver should provide this information (the subset
480 * supported by hardware) to the 802.11 code with each received 534 * supported by hardware) to the 802.11 code with each received
481 * frame. 535 * frame, in the skb's control buffer (cb).
482 * 536 *
483 * @mactime: value in microseconds of the 64-bit Time Synchronization Function 537 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
484 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. 538 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
@@ -529,7 +583,6 @@ enum ieee80211_conf_flags {
529/** 583/**
530 * enum ieee80211_conf_changed - denotes which configuration changed 584 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 585 *
532 * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 587 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
@@ -539,7 +592,6 @@ enum ieee80211_conf_flags {
539 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 592 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
540 */ 593 */
541enum ieee80211_conf_changed { 594enum ieee80211_conf_changed {
542 _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 596 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
545 IEEE80211_CONF_CHANGE_PS = BIT(4), 597 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -549,14 +601,6 @@ enum ieee80211_conf_changed {
549 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 601 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
550}; 602};
551 603
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
554{
555 return _IEEE80211_CONF_CHANGE_RADIO_ENABLED;
556}
557#define IEEE80211_CONF_CHANGE_RADIO_ENABLED \
558 __IEEE80211_CONF_CHANGE_RADIO_ENABLED()
559
560/** 604/**
561 * struct ieee80211_conf - configuration of the device 605 * struct ieee80211_conf - configuration of the device
562 * 606 *
@@ -564,9 +608,6 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
564 * 608 *
565 * @flags: configuration flags defined above 609 * @flags: configuration flags defined above
566 * 610 *
567 * @radio_enabled: when zero, driver is required to switch off the radio.
568 * @beacon_int: DEPRECATED, DO NOT USE
569 *
570 * @listen_interval: listen interval in units of beacon interval 611 * @listen_interval: listen interval in units of beacon interval
571 * @max_sleep_period: the maximum number of beacon intervals to sleep for 612 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this 613 * before checking the beacon for a TIM bit (managed mode only); this
@@ -590,13 +631,11 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
590 * number of transmissions not the number of retries 631 * number of transmissions not the number of retries
591 */ 632 */
592struct ieee80211_conf { 633struct ieee80211_conf {
593 int __deprecated beacon_int;
594 u32 flags; 634 u32 flags;
595 int power_level, dynamic_ps_timeout; 635 int power_level, dynamic_ps_timeout;
596 int max_sleep_period; 636 int max_sleep_period;
597 637
598 u16 listen_interval; 638 u16 listen_interval;
599 bool __deprecated radio_enabled;
600 639
601 u8 long_frame_max_tx_count, short_frame_max_tx_count; 640 u8 long_frame_max_tx_count, short_frame_max_tx_count;
602 641
@@ -901,12 +940,6 @@ enum ieee80211_hw_flags {
901 * 940 *
902 * @conf: &struct ieee80211_conf, device configuration, don't use. 941 * @conf: &struct ieee80211_conf, device configuration, don't use.
903 * 942 *
904 * @workqueue: single threaded workqueue available for driver use,
905 * allocated by mac80211 on registration and flushed when an
906 * interface is removed.
907 * NOTICE: All work performed on this workqueue must not
908 * acquire the RTNL lock.
909 *
910 * @priv: pointer to private area that was allocated for driver use 943 * @priv: pointer to private area that was allocated for driver use
911 * along with this structure. 944 * along with this structure.
912 * 945 *
@@ -942,7 +975,6 @@ enum ieee80211_hw_flags {
942struct ieee80211_hw { 975struct ieee80211_hw {
943 struct ieee80211_conf conf; 976 struct ieee80211_conf conf;
944 struct wiphy *wiphy; 977 struct wiphy *wiphy;
945 struct workqueue_struct *workqueue;
946 const char *rate_control_algorithm; 978 const char *rate_control_algorithm;
947 void *priv; 979 void *priv;
948 u32 flags; 980 u32 flags;
@@ -1172,10 +1204,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1172 * the driver's configure_filter() function which frames should be 1204 * the driver's configure_filter() function which frames should be
1173 * passed to mac80211 and which should be filtered out. 1205 * passed to mac80211 and which should be filtered out.
1174 * 1206 *
1175 * The configure_filter() callback is invoked with the parameters 1207 * Before configure_filter() is invoked, the prepare_multicast()
1176 * @mc_count and @mc_list for the combined multicast address list 1208 * callback is invoked with the parameters @mc_count and @mc_list
1177 * of all virtual interfaces, @changed_flags telling which flags 1209 * for the combined multicast address list of all virtual interfaces.
1178 * were changed and @total_flags with the new flag states. 1210 * It's use is optional, and it returns a u64 that is passed to
1211 * configure_filter(). Additionally, configure_filter() has the
1212 * arguments @changed_flags telling which flags were changed and
1213 * @total_flags with the new flag states.
1179 * 1214 *
1180 * If your device has no multicast address filters your driver will 1215 * If your device has no multicast address filters your driver will
1181 * need to check both the %FIF_ALLMULTI flag and the @mc_count 1216 * need to check both the %FIF_ALLMULTI flag and the @mc_count
@@ -1224,10 +1259,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1224 * mac80211 needs to do and the amount of CPU wakeups, so you should 1259 * mac80211 needs to do and the amount of CPU wakeups, so you should
1225 * honour this flag if possible. 1260 * honour this flag if possible.
1226 * 1261 *
1227 * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then 1262 * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS
1228 * only those addressed to this station 1263 * is not set then only those addressed to this station.
1229 * 1264 *
1230 * @FIF_OTHER_BSS: pass frames destined to other BSSes 1265 * @FIF_OTHER_BSS: pass frames destined to other BSSes
1266 *
1267 * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
1268 * those addressed to this station.
1231 */ 1269 */
1232enum ieee80211_filter_flags { 1270enum ieee80211_filter_flags {
1233 FIF_PROMISC_IN_BSS = 1<<0, 1271 FIF_PROMISC_IN_BSS = 1<<0,
@@ -1237,6 +1275,7 @@ enum ieee80211_filter_flags {
1237 FIF_BCN_PRBRESP_PROMISC = 1<<4, 1275 FIF_BCN_PRBRESP_PROMISC = 1<<4,
1238 FIF_CONTROL = 1<<5, 1276 FIF_CONTROL = 1<<5,
1239 FIF_OTHER_BSS = 1<<6, 1277 FIF_OTHER_BSS = 1<<6,
1278 FIF_PSPOLL = 1<<7,
1240}; 1279};
1241 1280
1242/** 1281/**
@@ -1289,7 +1328,8 @@ enum ieee80211_ampdu_mlme_action {
1289 * is disabled. This should turn off the hardware (at least 1328 * is disabled. This should turn off the hardware (at least
1290 * it must turn off frame reception.) 1329 * it must turn off frame reception.)
1291 * May be called right after add_interface if that rejects 1330 * May be called right after add_interface if that rejects
1292 * an interface. 1331 * an interface. If you added any work onto the mac80211 workqueue
1332 * you should ensure to cancel it on this callback.
1293 * Must be implemented. 1333 * Must be implemented.
1294 * 1334 *
1295 * @add_interface: Called when a netdevice attached to the hardware is 1335 * @add_interface: Called when a netdevice attached to the hardware is
@@ -1323,9 +1363,13 @@ enum ieee80211_ampdu_mlme_action {
1323 * for association indication. The @changed parameter indicates which 1363 * for association indication. The @changed parameter indicates which
1324 * of the bss parameters has changed when a call is made. 1364 * of the bss parameters has changed when a call is made.
1325 * 1365 *
1366 * @prepare_multicast: Prepare for multicast filter configuration.
1367 * This callback is optional, and its return value is passed
1368 * to configure_filter(). This callback must be atomic.
1369 *
1326 * @configure_filter: Configure the device's RX filter. 1370 * @configure_filter: Configure the device's RX filter.
1327 * See the section "Frame filtering" for more information. 1371 * See the section "Frame filtering" for more information.
1328 * This callback must be implemented and atomic. 1372 * This callback must be implemented.
1329 * 1373 *
1330 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1374 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1331 * must be set or cleared for a given STA. Must be atomic. 1375 * must be set or cleared for a given STA. Must be atomic.
@@ -1411,6 +1455,8 @@ enum ieee80211_ampdu_mlme_action {
1411 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1455 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1412 * need to set wiphy->rfkill_poll to %true before registration, 1456 * need to set wiphy->rfkill_poll to %true before registration,
1413 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1457 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1458 *
1459 * @testmode_cmd: Implement a cfg80211 test mode command.
1414 */ 1460 */
1415struct ieee80211_ops { 1461struct ieee80211_ops {
1416 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1462 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1425,10 +1471,12 @@ struct ieee80211_ops {
1425 struct ieee80211_vif *vif, 1471 struct ieee80211_vif *vif,
1426 struct ieee80211_bss_conf *info, 1472 struct ieee80211_bss_conf *info,
1427 u32 changed); 1473 u32 changed);
1474 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1475 int mc_count, struct dev_addr_list *mc_list);
1428 void (*configure_filter)(struct ieee80211_hw *hw, 1476 void (*configure_filter)(struct ieee80211_hw *hw,
1429 unsigned int changed_flags, 1477 unsigned int changed_flags,
1430 unsigned int *total_flags, 1478 unsigned int *total_flags,
1431 int mc_count, struct dev_addr_list *mc_list); 1479 u64 multicast);
1432 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1480 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1433 bool set); 1481 bool set);
1434 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1482 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
@@ -1461,6 +1509,9 @@ struct ieee80211_ops {
1461 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1509 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1462 1510
1463 void (*rfkill_poll)(struct ieee80211_hw *hw); 1511 void (*rfkill_poll)(struct ieee80211_hw *hw);
1512#ifdef CONFIG_NL80211_TESTMODE
1513 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1514#endif
1464}; 1515};
1465 1516
1466/** 1517/**
@@ -1606,10 +1657,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
1606 */ 1657 */
1607void ieee80211_restart_hw(struct ieee80211_hw *hw); 1658void ieee80211_restart_hw(struct ieee80211_hw *hw);
1608 1659
1609/* trick to avoid symbol clashes with the ieee80211 subsystem */
1610void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1611 struct ieee80211_rx_status *status);
1612
1613/** 1660/**
1614 * ieee80211_rx - receive frame 1661 * ieee80211_rx - receive frame
1615 * 1662 *
@@ -1624,14 +1671,8 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1624 * 1671 *
1625 * @hw: the hardware this frame came in on 1672 * @hw: the hardware this frame came in on
1626 * @skb: the buffer to receive, owned by mac80211 after this call 1673 * @skb: the buffer to receive, owned by mac80211 after this call
1627 * @status: status of this frame; the status pointer need not be valid
1628 * after this function returns
1629 */ 1674 */
1630static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1675void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
1631 struct ieee80211_rx_status *status)
1632{
1633 __ieee80211_rx(hw, skb, status);
1634}
1635 1676
1636/** 1677/**
1637 * ieee80211_rx_irqsafe - receive frame 1678 * ieee80211_rx_irqsafe - receive frame
@@ -1644,13 +1685,8 @@ static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1644 * 1685 *
1645 * @hw: the hardware this frame came in on 1686 * @hw: the hardware this frame came in on
1646 * @skb: the buffer to receive, owned by mac80211 after this call 1687 * @skb: the buffer to receive, owned by mac80211 after this call
1647 * @status: status of this frame; the status pointer need not be valid
1648 * after this function returns and is not freed by mac80211,
1649 * it is recommended that it points to a stack area
1650 */ 1688 */
1651void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, 1689void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
1652 struct sk_buff *skb,
1653 struct ieee80211_rx_status *status);
1654 1690
1655/** 1691/**
1656 * ieee80211_tx_status - transmit status callback 1692 * ieee80211_tx_status - transmit status callback
@@ -1917,6 +1953,31 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1917 void *data); 1953 void *data);
1918 1954
1919/** 1955/**
1956 * ieee80211_queue_work - add work onto the mac80211 workqueue
1957 *
1958 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
1959 * This helper ensures drivers are not queueing work when they should not be.
1960 *
1961 * @hw: the hardware struct for the interface we are adding work for
1962 * @work: the work we want to add onto the mac80211 workqueue
1963 */
1964void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
1965
1966/**
1967 * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
1968 *
1969 * Drivers and mac80211 use this to queue delayed work onto the mac80211
1970 * workqueue.
1971 *
1972 * @hw: the hardware struct for the interface we are adding work for
1973 * @dwork: delayable work to queue onto the mac80211 workqueue
1974 * @delay: number of jiffies to wait before queueing
1975 */
1976void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
1977 struct delayed_work *dwork,
1978 unsigned long delay);
1979
1980/**
1920 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 1981 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1921 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1982 * @hw: pointer as obtained from ieee80211_alloc_hw().
1922 * @ra: receiver address of the BA session recipient 1983 * @ra: receiver address of the BA session recipient
@@ -2090,6 +2151,29 @@ static inline int rate_supported(struct ieee80211_sta *sta,
2090 return (sta == NULL || sta->supp_rates[band] & BIT(index)); 2151 return (sta == NULL || sta->supp_rates[band] & BIT(index));
2091} 2152}
2092 2153
2154/**
2155 * rate_control_send_low - helper for drivers for management/no-ack frames
2156 *
2157 * Rate control algorithms that agree to use the lowest rate to
2158 * send management frames and NO_ACK data with the respective hw
2159 * retries should use this in the beginning of their mac80211 get_rate
2160 * callback. If true is returned the rate control can simply return.
2161 * If false is returned we guarantee that sta and sta and priv_sta is
2162 * not null.
2163 *
2164 * Rate control algorithms wishing to do more intelligent selection of
2165 * rate for multicast/broadcast frames may choose to not use this.
2166 *
2167 * @sta: &struct ieee80211_sta pointer to the target destination. Note
2168 * that this may be null.
2169 * @priv_sta: private rate control structure. This may be null.
2170 * @txrc: rate control information we sholud populate for mac80211.
2171 */
2172bool rate_control_send_low(struct ieee80211_sta *sta,
2173 void *priv_sta,
2174 struct ieee80211_tx_rate_control *txrc);
2175
2176
2093static inline s8 2177static inline s8
2094rate_lowest_index(struct ieee80211_supported_band *sband, 2178rate_lowest_index(struct ieee80211_supported_band *sband,
2095 struct ieee80211_sta *sta) 2179 struct ieee80211_sta *sta)
@@ -2106,6 +2190,17 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
2106 return 0; 2190 return 0;
2107} 2191}
2108 2192
2193static inline
2194bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
2195 struct ieee80211_sta *sta)
2196{
2197 unsigned int i;
2198
2199 for (i = 0; i < sband->n_bitrates; i++)
2200 if (rate_supported(sta, sband->band, i))
2201 return true;
2202 return false;
2203}
2109 2204
2110int ieee80211_rate_control_register(struct rate_control_ops *ops); 2205int ieee80211_rate_control_register(struct rate_control_ops *ops);
2111void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2206void ieee80211_rate_control_unregister(struct rate_control_ops *ops);