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.h242
1 files changed, 187 insertions, 55 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ff137fd7714f..d861197f83c7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -158,13 +158,17 @@ struct ieee80211_low_level_stats {
158 * also implies a change in the AID. 158 * also implies a change in the AID.
159 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed 159 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
160 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed 160 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
161 * @BSS_CHANGED_ERP_SLOT: slot timing changed
161 * @BSS_CHANGED_HT: 802.11n parameters changed 162 * @BSS_CHANGED_HT: 802.11n parameters changed
163 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
162 */ 164 */
163enum ieee80211_bss_change { 165enum ieee80211_bss_change {
164 BSS_CHANGED_ASSOC = 1<<0, 166 BSS_CHANGED_ASSOC = 1<<0,
165 BSS_CHANGED_ERP_CTS_PROT = 1<<1, 167 BSS_CHANGED_ERP_CTS_PROT = 1<<1,
166 BSS_CHANGED_ERP_PREAMBLE = 1<<2, 168 BSS_CHANGED_ERP_PREAMBLE = 1<<2,
169 BSS_CHANGED_ERP_SLOT = 1<<3,
167 BSS_CHANGED_HT = 1<<4, 170 BSS_CHANGED_HT = 1<<4,
171 BSS_CHANGED_BASIC_RATES = 1<<5,
168}; 172};
169 173
170/** 174/**
@@ -177,6 +181,7 @@ enum ieee80211_bss_change {
177 * @aid: association ID number, valid only when @assoc is true 181 * @aid: association ID number, valid only when @assoc is true
178 * @use_cts_prot: use CTS protection 182 * @use_cts_prot: use CTS protection
179 * @use_short_preamble: use 802.11b short preamble 183 * @use_short_preamble: use 802.11b short preamble
184 * @use_short_slot: use short slot time (only relevant for ERP)
180 * @dtim_period: num of beacons before the next DTIM, for PSM 185 * @dtim_period: num of beacons before the next DTIM, for PSM
181 * @timestamp: beacon timestamp 186 * @timestamp: beacon timestamp
182 * @beacon_int: beacon interval 187 * @beacon_int: beacon interval
@@ -184,6 +189,9 @@ enum ieee80211_bss_change {
184 * @assoc_ht: association in HT mode 189 * @assoc_ht: association in HT mode
185 * @ht_conf: ht capabilities 190 * @ht_conf: ht capabilities
186 * @ht_bss_conf: ht extended capabilities 191 * @ht_bss_conf: ht extended capabilities
192 * @basic_rates: bitmap of basic rates, each bit stands for an
193 * index into the rate table configured by the driver in
194 * the current band.
187 */ 195 */
188struct ieee80211_bss_conf { 196struct ieee80211_bss_conf {
189 /* association related data */ 197 /* association related data */
@@ -192,10 +200,12 @@ struct ieee80211_bss_conf {
192 /* erp related data */ 200 /* erp related data */
193 bool use_cts_prot; 201 bool use_cts_prot;
194 bool use_short_preamble; 202 bool use_short_preamble;
203 bool use_short_slot;
195 u8 dtim_period; 204 u8 dtim_period;
196 u16 beacon_int; 205 u16 beacon_int;
197 u16 assoc_capability; 206 u16 assoc_capability;
198 u64 timestamp; 207 u64 timestamp;
208 u64 basic_rates;
199 /* ht related data */ 209 /* ht related data */
200 bool assoc_ht; 210 bool assoc_ht;
201 struct ieee80211_ht_info *ht_conf; 211 struct ieee80211_ht_info *ht_conf;
@@ -282,6 +292,20 @@ enum mac80211_tx_control_flags {
282#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \ 292#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
283 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)) 293 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
284 294
295/* maximum number of alternate rate retry stages */
296#define IEEE80211_TX_MAX_ALTRATE 3
297
298/**
299 * struct ieee80211_tx_altrate - alternate rate selection/status
300 *
301 * @rate_idx: rate index to attempt to send with
302 * @limit: number of retries before fallback
303 */
304struct ieee80211_tx_altrate {
305 s8 rate_idx;
306 u8 limit;
307};
308
285/** 309/**
286 * struct ieee80211_tx_info - skb transmit information 310 * struct ieee80211_tx_info - skb transmit information
287 * 311 *
@@ -290,6 +314,9 @@ enum mac80211_tx_control_flags {
290 * (2) driver internal use (if applicable) 314 * (2) driver internal use (if applicable)
291 * (3) TX status information - driver tells mac80211 what happened 315 * (3) TX status information - driver tells mac80211 what happened
292 * 316 *
317 * The TX control's sta pointer is only valid during the ->tx call,
318 * it may be NULL.
319 *
293 * @flags: transmit info flags, defined above 320 * @flags: transmit info flags, defined above
294 * @band: TBD 321 * @band: TBD
295 * @tx_rate_idx: TBD 322 * @tx_rate_idx: TBD
@@ -317,18 +344,19 @@ struct ieee80211_tx_info {
317 344
318 union { 345 union {
319 struct { 346 struct {
347 /* NB: vif can be NULL for injected frames */
320 struct ieee80211_vif *vif; 348 struct ieee80211_vif *vif;
321 struct ieee80211_key_conf *hw_key; 349 struct ieee80211_key_conf *hw_key;
350 struct ieee80211_sta *sta;
322 unsigned long jiffies; 351 unsigned long jiffies;
323 u16 aid; 352 s8 rts_cts_rate_idx;
324 s8 rts_cts_rate_idx, alt_retry_rate_idx;
325 u8 retry_limit; 353 u8 retry_limit;
326 u8 icv_len; 354 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE];
327 u8 iv_len;
328 } control; 355 } control;
329 struct { 356 struct {
330 u64 ampdu_ack_map; 357 u64 ampdu_ack_map;
331 int ack_signal; 358 int ack_signal;
359 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1];
332 u8 retry_count; 360 u8 retry_count;
333 bool excessive_retries; 361 bool excessive_retries;
334 u8 ampdu_ack_len; 362 u8 ampdu_ack_len;
@@ -363,6 +391,7 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
363 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) 391 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field)
364 * is valid. This is useful in monitor mode and necessary for beacon frames 392 * is valid. This is useful in monitor mode and necessary for beacon frames
365 * to enable IBSS merging. 393 * to enable IBSS merging.
394 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
366 */ 395 */
367enum mac80211_rx_flags { 396enum mac80211_rx_flags {
368 RX_FLAG_MMIC_ERROR = 1<<0, 397 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -373,6 +402,7 @@ enum mac80211_rx_flags {
373 RX_FLAG_FAILED_FCS_CRC = 1<<5, 402 RX_FLAG_FAILED_FCS_CRC = 1<<5,
374 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 403 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
375 RX_FLAG_TSFT = 1<<7, 404 RX_FLAG_TSFT = 1<<7,
405 RX_FLAG_SHORTPRE = 1<<8
376}; 406};
377 407
378/** 408/**
@@ -418,6 +448,11 @@ struct ieee80211_rx_status {
418 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 448 * @IEEE80211_CONF_PS: Enable 802.11 power save mode
419 */ 449 */
420enum ieee80211_conf_flags { 450enum ieee80211_conf_flags {
451 /*
452 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers
453 * have been converted to use bss_info_changed() for slot time
454 * configuration
455 */
421 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), 456 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0),
422 IEEE80211_CONF_RADIOTAP = (1<<1), 457 IEEE80211_CONF_RADIOTAP = (1<<1),
423 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), 458 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2),
@@ -461,33 +496,6 @@ struct ieee80211_conf {
461}; 496};
462 497
463/** 498/**
464 * enum ieee80211_if_types - types of 802.11 network interfaces
465 *
466 * @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used
467 * by mac80211 itself
468 * @IEEE80211_IF_TYPE_AP: interface in AP mode.
469 * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
470 * daemon. Drivers should never see this type.
471 * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
472 * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
473 * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
474 * @IEEE80211_IF_TYPE_WDS: interface in WDS mode.
475 * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers
476 * will never see this type.
477 * @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point
478 */
479enum ieee80211_if_types {
480 IEEE80211_IF_TYPE_INVALID,
481 IEEE80211_IF_TYPE_AP,
482 IEEE80211_IF_TYPE_STA,
483 IEEE80211_IF_TYPE_IBSS,
484 IEEE80211_IF_TYPE_MESH_POINT,
485 IEEE80211_IF_TYPE_MNTR,
486 IEEE80211_IF_TYPE_WDS,
487 IEEE80211_IF_TYPE_VLAN,
488};
489
490/**
491 * struct ieee80211_vif - per-interface data 499 * struct ieee80211_vif - per-interface data
492 * 500 *
493 * Data in this structure is continually present for driver 501 * Data in this structure is continually present for driver
@@ -498,7 +506,7 @@ enum ieee80211_if_types {
498 * sizeof(void *). 506 * sizeof(void *).
499 */ 507 */
500struct ieee80211_vif { 508struct ieee80211_vif {
501 enum ieee80211_if_types type; 509 enum nl80211_iftype type;
502 /* must be last */ 510 /* must be last */
503 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 511 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
504}; 512};
@@ -506,7 +514,7 @@ struct ieee80211_vif {
506static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) 514static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
507{ 515{
508#ifdef CONFIG_MAC80211_MESH 516#ifdef CONFIG_MAC80211_MESH
509 return vif->type == IEEE80211_IF_TYPE_MESH_POINT; 517 return vif->type == NL80211_IFTYPE_MESH_POINT;
510#endif 518#endif
511 return false; 519 return false;
512} 520}
@@ -517,7 +525,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
517 * @vif: pointer to a driver-use per-interface structure. The pointer 525 * @vif: pointer to a driver-use per-interface structure. The pointer
518 * itself is also used for various functions including 526 * itself is also used for various functions including
519 * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). 527 * ieee80211_beacon_get() and ieee80211_get_buffered_bc().
520 * @type: one of &enum ieee80211_if_types constants. Determines the type of 528 * @type: one of &enum nl80211_iftype constants. Determines the type of
521 * added/removed interface. 529 * added/removed interface.
522 * @mac_addr: pointer to MAC address of the interface. This pointer is valid 530 * @mac_addr: pointer to MAC address of the interface. This pointer is valid
523 * until the interface is removed (i.e. it cannot be used after 531 * until the interface is removed (i.e. it cannot be used after
@@ -533,7 +541,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
533 * in pure monitor mode. 541 * in pure monitor mode.
534 */ 542 */
535struct ieee80211_if_init_conf { 543struct ieee80211_if_init_conf {
536 enum ieee80211_if_types type; 544 enum nl80211_iftype type;
537 struct ieee80211_vif *vif; 545 struct ieee80211_vif *vif;
538 void *mac_addr; 546 void *mac_addr;
539}; 547};
@@ -637,10 +645,13 @@ enum ieee80211_key_flags {
637 * - Temporal Encryption Key (128 bits) 645 * - Temporal Encryption Key (128 bits)
638 * - Temporal Authenticator Tx MIC Key (64 bits) 646 * - Temporal Authenticator Tx MIC Key (64 bits)
639 * - Temporal Authenticator Rx MIC Key (64 bits) 647 * - Temporal Authenticator Rx MIC Key (64 bits)
640 * 648 * @icv_len: FIXME
649 * @iv_len: FIXME
641 */ 650 */
642struct ieee80211_key_conf { 651struct ieee80211_key_conf {
643 enum ieee80211_key_alg alg; 652 enum ieee80211_key_alg alg;
653 u8 icv_len;
654 u8 iv_len;
644 u8 hw_key_idx; 655 u8 hw_key_idx;
645 u8 flags; 656 u8 flags;
646 s8 keyidx; 657 s8 keyidx;
@@ -662,6 +673,33 @@ enum set_key_cmd {
662}; 673};
663 674
664/** 675/**
676 * struct ieee80211_sta - station table entry
677 *
678 * A station table entry represents a station we are possibly
679 * communicating with. Since stations are RCU-managed in
680 * mac80211, any ieee80211_sta pointer you get access to must
681 * either be protected by rcu_read_lock() explicitly or implicitly,
682 * or you must take good care to not use such a pointer after a
683 * call to your sta_notify callback that removed it.
684 *
685 * @addr: MAC address
686 * @aid: AID we assigned to the station if we're an AP
687 * @supp_rates: Bitmap of supported rates (per band)
688 * @ht_info: HT capabilities of this STA
689 * @drv_priv: data area for driver use, will always be aligned to
690 * sizeof(void *), size is determined in hw information.
691 */
692struct ieee80211_sta {
693 u64 supp_rates[IEEE80211_NUM_BANDS];
694 u8 addr[ETH_ALEN];
695 u16 aid;
696 struct ieee80211_ht_info ht_info;
697
698 /* must be last */
699 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
700};
701
702/**
665 * enum sta_notify_cmd - sta notify command 703 * enum sta_notify_cmd - sta notify command
666 * 704 *
667 * Used with the sta_notify() callback in &struct ieee80211_ops, this 705 * Used with the sta_notify() callback in &struct ieee80211_ops, this
@@ -805,6 +843,11 @@ enum ieee80211_hw_flags {
805 * 843 *
806 * @vif_data_size: size (in bytes) of the drv_priv data area 844 * @vif_data_size: size (in bytes) of the drv_priv data area
807 * within &struct ieee80211_vif. 845 * within &struct ieee80211_vif.
846 * @sta_data_size: size (in bytes) of the drv_priv data area
847 * within &struct ieee80211_sta.
848 *
849 * @max_altrates: maximum number of alternate rate retry stages
850 * @max_altrate_tries: maximum number of tries for each stage
808 */ 851 */
809struct ieee80211_hw { 852struct ieee80211_hw {
810 struct ieee80211_conf conf; 853 struct ieee80211_conf conf;
@@ -816,12 +859,17 @@ struct ieee80211_hw {
816 unsigned int extra_tx_headroom; 859 unsigned int extra_tx_headroom;
817 int channel_change_time; 860 int channel_change_time;
818 int vif_data_size; 861 int vif_data_size;
862 int sta_data_size;
819 u16 queues; 863 u16 queues;
820 u16 ampdu_queues; 864 u16 ampdu_queues;
821 u16 max_listen_interval; 865 u16 max_listen_interval;
822 s8 max_signal; 866 s8 max_signal;
867 u8 max_altrates;
868 u8 max_altrate_tries;
823}; 869};
824 870
871struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
872
825/** 873/**
826 * SET_IEEE80211_DEV - set device for 802.11 hardware 874 * SET_IEEE80211_DEV - set device for 802.11 hardware
827 * 875 *
@@ -874,11 +922,11 @@ ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
874 922
875static inline struct ieee80211_rate * 923static inline struct ieee80211_rate *
876ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 924ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
877 const struct ieee80211_tx_info *c) 925 const struct ieee80211_tx_info *c, int idx)
878{ 926{
879 if (c->control.alt_retry_rate_idx < 0) 927 if (c->control.retries[idx].rate_idx < 0)
880 return NULL; 928 return NULL;
881 return &hw->wiphy->bands[c->band]->bitrates[c->control.alt_retry_rate_idx]; 929 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx];
882} 930}
883 931
884/** 932/**
@@ -1097,7 +1145,7 @@ enum ieee80211_ampdu_mlme_action {
1097 * This callback must be implemented and atomic. 1145 * This callback must be implemented and atomic.
1098 * 1146 *
1099 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1147 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1100 * must be set or cleared for a given AID. Must be atomic. 1148 * must be set or cleared for a given STA. Must be atomic.
1101 * 1149 *
1102 * @set_key: See the section "Hardware crypto acceleration" 1150 * @set_key: See the section "Hardware crypto acceleration"
1103 * This callback can sleep, and is only called between add_interface 1151 * This callback can sleep, and is only called between add_interface
@@ -1111,7 +1159,9 @@ enum ieee80211_ampdu_mlme_action {
1111 * @hw_scan: Ask the hardware to service the scan request, no need to start 1159 * @hw_scan: Ask the hardware to service the scan request, no need to start
1112 * the scan state machine in stack. The scan must honour the channel 1160 * the scan state machine in stack. The scan must honour the channel
1113 * configuration done by the regulatory agent in the wiphy's registered 1161 * configuration done by the regulatory agent in the wiphy's registered
1114 * bands. 1162 * bands. When the scan finishes, ieee80211_scan_completed() must be
1163 * called; note that it also must be called when the scan cannot finish
1164 * because the hardware is turned off! Anything else is a bug!
1115 * 1165 *
1116 * @get_stats: return low-level statistics 1166 * @get_stats: return low-level statistics
1117 * 1167 *
@@ -1131,7 +1181,7 @@ enum ieee80211_ampdu_mlme_action {
1131 * of assocaited station or AP. 1181 * of assocaited station or AP.
1132 * 1182 *
1133 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1183 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1134 * bursting) for a hardware TX queue. Must be atomic. 1184 * bursting) for a hardware TX queue.
1135 * 1185 *
1136 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1186 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1137 * to get number of currently queued packets (queue length), maximum queue 1187 * to get number of currently queued packets (queue length), maximum queue
@@ -1181,7 +1231,8 @@ struct ieee80211_ops {
1181 unsigned int changed_flags, 1231 unsigned int changed_flags,
1182 unsigned int *total_flags, 1232 unsigned int *total_flags,
1183 int mc_count, struct dev_addr_list *mc_list); 1233 int mc_count, struct dev_addr_list *mc_list);
1184 int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); 1234 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1235 bool set);
1185 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1236 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1186 const u8 *local_address, const u8 *address, 1237 const u8 *local_address, const u8 *address,
1187 struct ieee80211_key_conf *key); 1238 struct ieee80211_key_conf *key);
@@ -1198,7 +1249,7 @@ struct ieee80211_ops {
1198 int (*set_retry_limit)(struct ieee80211_hw *hw, 1249 int (*set_retry_limit)(struct ieee80211_hw *hw,
1199 u32 short_retry, u32 long_retr); 1250 u32 short_retry, u32 long_retr);
1200 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1251 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1201 enum sta_notify_cmd, const u8 *addr); 1252 enum sta_notify_cmd, struct ieee80211_sta *sta);
1202 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1253 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1203 const struct ieee80211_tx_queue_params *params); 1254 const struct ieee80211_tx_queue_params *params);
1204 int (*get_tx_stats)(struct ieee80211_hw *hw, 1255 int (*get_tx_stats)(struct ieee80211_hw *hw,
@@ -1208,7 +1259,7 @@ struct ieee80211_ops {
1208 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1259 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1209 int (*ampdu_action)(struct ieee80211_hw *hw, 1260 int (*ampdu_action)(struct ieee80211_hw *hw,
1210 enum ieee80211_ampdu_mlme_action action, 1261 enum ieee80211_ampdu_mlme_action action,
1211 const u8 *addr, u16 tid, u16 *ssn); 1262 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1212}; 1263};
1213 1264
1214/** 1265/**
@@ -1557,16 +1608,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1557unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1608unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1558 1609
1559/** 1610/**
1560 * ieee80211_get_hdrlen - get header length from frame control
1561 *
1562 * This function returns the 802.11 header length in bytes (not including
1563 * encryption headers.)
1564 *
1565 * @fc: the frame control field (in CPU endianness)
1566 */
1567int ieee80211_get_hdrlen(u16 fc);
1568
1569/**
1570 * ieee80211_hdrlen - get header length in bytes from frame control 1611 * ieee80211_hdrlen - get header length in bytes from frame control
1571 * @fc: frame control field in little-endian format 1612 * @fc: frame control field in little-endian format
1572 */ 1613 */
@@ -1608,6 +1649,16 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
1608void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); 1649void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
1609 1650
1610/** 1651/**
1652 * ieee80211_queue_stopped - test status of the queue
1653 * @hw: pointer as obtained from ieee80211_alloc_hw().
1654 * @queue: queue number (counted from zero).
1655 *
1656 * Drivers should use this function instead of netif_stop_queue.
1657 */
1658
1659int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
1660
1661/**
1611 * ieee80211_stop_queues - stop all queues 1662 * ieee80211_stop_queues - stop all queues
1612 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1663 * @hw: pointer as obtained from ieee80211_alloc_hw().
1613 * 1664 *
@@ -1758,4 +1809,85 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1758 */ 1809 */
1759void ieee80211_notify_mac(struct ieee80211_hw *hw, 1810void ieee80211_notify_mac(struct ieee80211_hw *hw,
1760 enum ieee80211_notification_types notif_type); 1811 enum ieee80211_notification_types notif_type);
1812
1813/**
1814 * ieee80211_find_sta - find a station
1815 *
1816 * @hw: pointer as obtained from ieee80211_alloc_hw()
1817 * @addr: station's address
1818 *
1819 * This function must be called under RCU lock and the
1820 * resulting pointer is only valid under RCU lock as well.
1821 */
1822struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1823 const u8 *addr);
1824
1825
1826/* Rate control API */
1827/**
1828 * struct rate_selection - rate information for/from rate control algorithms
1829 *
1830 * @rate_idx: selected transmission rate index
1831 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used
1832 * @probe_idx: rate for probing (or -1)
1833 * @max_rate_idx: maximum rate index that can be used, this is
1834 * input to the algorithm and will be enforced
1835 */
1836struct rate_selection {
1837 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx;
1838};
1839
1840struct rate_control_ops {
1841 struct module *module;
1842 const char *name;
1843 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
1844 void (*clear)(void *priv);
1845 void (*free)(void *priv);
1846
1847 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1848 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1849 struct ieee80211_sta *sta, void *priv_sta);
1850 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1851 void *priv_sta);
1852
1853 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1854 struct ieee80211_sta *sta, void *priv_sta,
1855 struct sk_buff *skb);
1856 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband,
1857 struct ieee80211_sta *sta, void *priv_sta,
1858 struct sk_buff *skb,
1859 struct rate_selection *sel);
1860
1861 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1862 struct dentry *dir);
1863 void (*remove_sta_debugfs)(void *priv, void *priv_sta);
1864};
1865
1866static inline int rate_supported(struct ieee80211_sta *sta,
1867 enum ieee80211_band band,
1868 int index)
1869{
1870 return (sta == NULL || sta->supp_rates[band] & BIT(index));
1871}
1872
1873static inline s8
1874rate_lowest_index(struct ieee80211_supported_band *sband,
1875 struct ieee80211_sta *sta)
1876{
1877 int i;
1878
1879 for (i = 0; i < sband->n_bitrates; i++)
1880 if (rate_supported(sta, sband->band, i))
1881 return i;
1882
1883 /* warn when we cannot find a rate. */
1884 WARN_ON(1);
1885
1886 return 0;
1887}
1888
1889
1890int ieee80211_rate_control_register(struct rate_control_ops *ops);
1891void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1892
1761#endif /* MAC80211_H */ 1893#endif /* MAC80211_H */