diff options
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r-- | include/net/mac80211.h | 206 |
1 files changed, 158 insertions, 48 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index ff137fd7714f..f5f5b1ff1584 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 | */ |
163 | enum ieee80211_bss_change { | 165 | enum 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 | */ |
188 | struct ieee80211_bss_conf { | 196 | struct 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; |
@@ -290,6 +300,9 @@ enum mac80211_tx_control_flags { | |||
290 | * (2) driver internal use (if applicable) | 300 | * (2) driver internal use (if applicable) |
291 | * (3) TX status information - driver tells mac80211 what happened | 301 | * (3) TX status information - driver tells mac80211 what happened |
292 | * | 302 | * |
303 | * The TX control's sta pointer is only valid during the ->tx call, | ||
304 | * it may be NULL. | ||
305 | * | ||
293 | * @flags: transmit info flags, defined above | 306 | * @flags: transmit info flags, defined above |
294 | * @band: TBD | 307 | * @band: TBD |
295 | * @tx_rate_idx: TBD | 308 | * @tx_rate_idx: TBD |
@@ -317,10 +330,11 @@ struct ieee80211_tx_info { | |||
317 | 330 | ||
318 | union { | 331 | union { |
319 | struct { | 332 | struct { |
333 | /* NB: vif can be NULL for injected frames */ | ||
320 | struct ieee80211_vif *vif; | 334 | struct ieee80211_vif *vif; |
321 | struct ieee80211_key_conf *hw_key; | 335 | struct ieee80211_key_conf *hw_key; |
336 | struct ieee80211_sta *sta; | ||
322 | unsigned long jiffies; | 337 | unsigned long jiffies; |
323 | u16 aid; | ||
324 | s8 rts_cts_rate_idx, alt_retry_rate_idx; | 338 | s8 rts_cts_rate_idx, alt_retry_rate_idx; |
325 | u8 retry_limit; | 339 | u8 retry_limit; |
326 | u8 icv_len; | 340 | u8 icv_len; |
@@ -363,6 +377,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) | 377 | * @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 | 378 | * is valid. This is useful in monitor mode and necessary for beacon frames |
365 | * to enable IBSS merging. | 379 | * to enable IBSS merging. |
380 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame | ||
366 | */ | 381 | */ |
367 | enum mac80211_rx_flags { | 382 | enum mac80211_rx_flags { |
368 | RX_FLAG_MMIC_ERROR = 1<<0, | 383 | RX_FLAG_MMIC_ERROR = 1<<0, |
@@ -373,6 +388,7 @@ enum mac80211_rx_flags { | |||
373 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 388 | RX_FLAG_FAILED_FCS_CRC = 1<<5, |
374 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, | 389 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, |
375 | RX_FLAG_TSFT = 1<<7, | 390 | RX_FLAG_TSFT = 1<<7, |
391 | RX_FLAG_SHORTPRE = 1<<8 | ||
376 | }; | 392 | }; |
377 | 393 | ||
378 | /** | 394 | /** |
@@ -418,6 +434,11 @@ struct ieee80211_rx_status { | |||
418 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode | 434 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode |
419 | */ | 435 | */ |
420 | enum ieee80211_conf_flags { | 436 | enum ieee80211_conf_flags { |
437 | /* | ||
438 | * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers | ||
439 | * have been converted to use bss_info_changed() for slot time | ||
440 | * configuration | ||
441 | */ | ||
421 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), | 442 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), |
422 | IEEE80211_CONF_RADIOTAP = (1<<1), | 443 | IEEE80211_CONF_RADIOTAP = (1<<1), |
423 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), | 444 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), |
@@ -461,33 +482,6 @@ struct ieee80211_conf { | |||
461 | }; | 482 | }; |
462 | 483 | ||
463 | /** | 484 | /** |
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 | */ | ||
479 | enum 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 | 485 | * struct ieee80211_vif - per-interface data |
492 | * | 486 | * |
493 | * Data in this structure is continually present for driver | 487 | * Data in this structure is continually present for driver |
@@ -498,7 +492,7 @@ enum ieee80211_if_types { | |||
498 | * sizeof(void *). | 492 | * sizeof(void *). |
499 | */ | 493 | */ |
500 | struct ieee80211_vif { | 494 | struct ieee80211_vif { |
501 | enum ieee80211_if_types type; | 495 | enum nl80211_iftype type; |
502 | /* must be last */ | 496 | /* must be last */ |
503 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 497 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
504 | }; | 498 | }; |
@@ -506,7 +500,7 @@ struct ieee80211_vif { | |||
506 | static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | 500 | static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) |
507 | { | 501 | { |
508 | #ifdef CONFIG_MAC80211_MESH | 502 | #ifdef CONFIG_MAC80211_MESH |
509 | return vif->type == IEEE80211_IF_TYPE_MESH_POINT; | 503 | return vif->type == NL80211_IFTYPE_MESH_POINT; |
510 | #endif | 504 | #endif |
511 | return false; | 505 | return false; |
512 | } | 506 | } |
@@ -517,7 +511,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
517 | * @vif: pointer to a driver-use per-interface structure. The pointer | 511 | * @vif: pointer to a driver-use per-interface structure. The pointer |
518 | * itself is also used for various functions including | 512 | * itself is also used for various functions including |
519 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). | 513 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). |
520 | * @type: one of &enum ieee80211_if_types constants. Determines the type of | 514 | * @type: one of &enum nl80211_iftype constants. Determines the type of |
521 | * added/removed interface. | 515 | * added/removed interface. |
522 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 516 | * @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 | 517 | * until the interface is removed (i.e. it cannot be used after |
@@ -533,7 +527,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
533 | * in pure monitor mode. | 527 | * in pure monitor mode. |
534 | */ | 528 | */ |
535 | struct ieee80211_if_init_conf { | 529 | struct ieee80211_if_init_conf { |
536 | enum ieee80211_if_types type; | 530 | enum nl80211_iftype type; |
537 | struct ieee80211_vif *vif; | 531 | struct ieee80211_vif *vif; |
538 | void *mac_addr; | 532 | void *mac_addr; |
539 | }; | 533 | }; |
@@ -662,6 +656,33 @@ enum set_key_cmd { | |||
662 | }; | 656 | }; |
663 | 657 | ||
664 | /** | 658 | /** |
659 | * struct ieee80211_sta - station table entry | ||
660 | * | ||
661 | * A station table entry represents a station we are possibly | ||
662 | * communicating with. Since stations are RCU-managed in | ||
663 | * mac80211, any ieee80211_sta pointer you get access to must | ||
664 | * either be protected by rcu_read_lock() explicitly or implicitly, | ||
665 | * or you must take good care to not use such a pointer after a | ||
666 | * call to your sta_notify callback that removed it. | ||
667 | * | ||
668 | * @addr: MAC address | ||
669 | * @aid: AID we assigned to the station if we're an AP | ||
670 | * @supp_rates: Bitmap of supported rates (per band) | ||
671 | * @ht_info: HT capabilities of this STA | ||
672 | * @drv_priv: data area for driver use, will always be aligned to | ||
673 | * sizeof(void *), size is determined in hw information. | ||
674 | */ | ||
675 | struct ieee80211_sta { | ||
676 | u64 supp_rates[IEEE80211_NUM_BANDS]; | ||
677 | u8 addr[ETH_ALEN]; | ||
678 | u16 aid; | ||
679 | struct ieee80211_ht_info ht_info; | ||
680 | |||
681 | /* must be last */ | ||
682 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | ||
683 | }; | ||
684 | |||
685 | /** | ||
665 | * enum sta_notify_cmd - sta notify command | 686 | * enum sta_notify_cmd - sta notify command |
666 | * | 687 | * |
667 | * Used with the sta_notify() callback in &struct ieee80211_ops, this | 688 | * Used with the sta_notify() callback in &struct ieee80211_ops, this |
@@ -805,6 +826,8 @@ enum ieee80211_hw_flags { | |||
805 | * | 826 | * |
806 | * @vif_data_size: size (in bytes) of the drv_priv data area | 827 | * @vif_data_size: size (in bytes) of the drv_priv data area |
807 | * within &struct ieee80211_vif. | 828 | * within &struct ieee80211_vif. |
829 | * @sta_data_size: size (in bytes) of the drv_priv data area | ||
830 | * within &struct ieee80211_sta. | ||
808 | */ | 831 | */ |
809 | struct ieee80211_hw { | 832 | struct ieee80211_hw { |
810 | struct ieee80211_conf conf; | 833 | struct ieee80211_conf conf; |
@@ -816,12 +839,15 @@ struct ieee80211_hw { | |||
816 | unsigned int extra_tx_headroom; | 839 | unsigned int extra_tx_headroom; |
817 | int channel_change_time; | 840 | int channel_change_time; |
818 | int vif_data_size; | 841 | int vif_data_size; |
842 | int sta_data_size; | ||
819 | u16 queues; | 843 | u16 queues; |
820 | u16 ampdu_queues; | 844 | u16 ampdu_queues; |
821 | u16 max_listen_interval; | 845 | u16 max_listen_interval; |
822 | s8 max_signal; | 846 | s8 max_signal; |
823 | }; | 847 | }; |
824 | 848 | ||
849 | struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy); | ||
850 | |||
825 | /** | 851 | /** |
826 | * SET_IEEE80211_DEV - set device for 802.11 hardware | 852 | * SET_IEEE80211_DEV - set device for 802.11 hardware |
827 | * | 853 | * |
@@ -1097,7 +1123,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1097 | * This callback must be implemented and atomic. | 1123 | * This callback must be implemented and atomic. |
1098 | * | 1124 | * |
1099 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit | 1125 | * @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. | 1126 | * must be set or cleared for a given STA. Must be atomic. |
1101 | * | 1127 | * |
1102 | * @set_key: See the section "Hardware crypto acceleration" | 1128 | * @set_key: See the section "Hardware crypto acceleration" |
1103 | * This callback can sleep, and is only called between add_interface | 1129 | * This callback can sleep, and is only called between add_interface |
@@ -1111,7 +1137,9 @@ enum ieee80211_ampdu_mlme_action { | |||
1111 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 1137 | * @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 | 1138 | * the scan state machine in stack. The scan must honour the channel |
1113 | * configuration done by the regulatory agent in the wiphy's registered | 1139 | * configuration done by the regulatory agent in the wiphy's registered |
1114 | * bands. | 1140 | * bands. When the scan finishes, ieee80211_scan_completed() must be |
1141 | * called; note that it also must be called when the scan cannot finish | ||
1142 | * because the hardware is turned off! Anything else is a bug! | ||
1115 | * | 1143 | * |
1116 | * @get_stats: return low-level statistics | 1144 | * @get_stats: return low-level statistics |
1117 | * | 1145 | * |
@@ -1131,7 +1159,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1131 | * of assocaited station or AP. | 1159 | * of assocaited station or AP. |
1132 | * | 1160 | * |
1133 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1161 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
1134 | * bursting) for a hardware TX queue. Must be atomic. | 1162 | * bursting) for a hardware TX queue. |
1135 | * | 1163 | * |
1136 | * @get_tx_stats: Get statistics of the current TX queue status. This is used | 1164 | * @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 | 1165 | * to get number of currently queued packets (queue length), maximum queue |
@@ -1181,7 +1209,8 @@ struct ieee80211_ops { | |||
1181 | unsigned int changed_flags, | 1209 | unsigned int changed_flags, |
1182 | unsigned int *total_flags, | 1210 | unsigned int *total_flags, |
1183 | int mc_count, struct dev_addr_list *mc_list); | 1211 | int mc_count, struct dev_addr_list *mc_list); |
1184 | int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); | 1212 | int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, |
1213 | bool set); | ||
1185 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 1214 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
1186 | const u8 *local_address, const u8 *address, | 1215 | const u8 *local_address, const u8 *address, |
1187 | struct ieee80211_key_conf *key); | 1216 | struct ieee80211_key_conf *key); |
@@ -1198,7 +1227,7 @@ struct ieee80211_ops { | |||
1198 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1227 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
1199 | u32 short_retry, u32 long_retr); | 1228 | u32 short_retry, u32 long_retr); |
1200 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1229 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1201 | enum sta_notify_cmd, const u8 *addr); | 1230 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
1202 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, | 1231 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, |
1203 | const struct ieee80211_tx_queue_params *params); | 1232 | const struct ieee80211_tx_queue_params *params); |
1204 | int (*get_tx_stats)(struct ieee80211_hw *hw, | 1233 | int (*get_tx_stats)(struct ieee80211_hw *hw, |
@@ -1208,7 +1237,7 @@ struct ieee80211_ops { | |||
1208 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1237 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
1209 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1238 | int (*ampdu_action)(struct ieee80211_hw *hw, |
1210 | enum ieee80211_ampdu_mlme_action action, | 1239 | enum ieee80211_ampdu_mlme_action action, |
1211 | const u8 *addr, u16 tid, u16 *ssn); | 1240 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
1212 | }; | 1241 | }; |
1213 | 1242 | ||
1214 | /** | 1243 | /** |
@@ -1557,16 +1586,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | |||
1557 | unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | 1586 | unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); |
1558 | 1587 | ||
1559 | /** | 1588 | /** |
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 | */ | ||
1567 | int ieee80211_get_hdrlen(u16 fc); | ||
1568 | |||
1569 | /** | ||
1570 | * ieee80211_hdrlen - get header length in bytes from frame control | 1589 | * ieee80211_hdrlen - get header length in bytes from frame control |
1571 | * @fc: frame control field in little-endian format | 1590 | * @fc: frame control field in little-endian format |
1572 | */ | 1591 | */ |
@@ -1608,6 +1627,16 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue); | |||
1608 | void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); | 1627 | void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); |
1609 | 1628 | ||
1610 | /** | 1629 | /** |
1630 | * ieee80211_queue_stopped - test status of the queue | ||
1631 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | ||
1632 | * @queue: queue number (counted from zero). | ||
1633 | * | ||
1634 | * Drivers should use this function instead of netif_stop_queue. | ||
1635 | */ | ||
1636 | |||
1637 | int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue); | ||
1638 | |||
1639 | /** | ||
1611 | * ieee80211_stop_queues - stop all queues | 1640 | * ieee80211_stop_queues - stop all queues |
1612 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 1641 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
1613 | * | 1642 | * |
@@ -1758,4 +1787,85 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | |||
1758 | */ | 1787 | */ |
1759 | void ieee80211_notify_mac(struct ieee80211_hw *hw, | 1788 | void ieee80211_notify_mac(struct ieee80211_hw *hw, |
1760 | enum ieee80211_notification_types notif_type); | 1789 | enum ieee80211_notification_types notif_type); |
1790 | |||
1791 | /** | ||
1792 | * ieee80211_find_sta - find a station | ||
1793 | * | ||
1794 | * @hw: pointer as obtained from ieee80211_alloc_hw() | ||
1795 | * @addr: station's address | ||
1796 | * | ||
1797 | * This function must be called under RCU lock and the | ||
1798 | * resulting pointer is only valid under RCU lock as well. | ||
1799 | */ | ||
1800 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | ||
1801 | const u8 *addr); | ||
1802 | |||
1803 | |||
1804 | /* Rate control API */ | ||
1805 | /** | ||
1806 | * struct rate_selection - rate information for/from rate control algorithms | ||
1807 | * | ||
1808 | * @rate_idx: selected transmission rate index | ||
1809 | * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used | ||
1810 | * @probe_idx: rate for probing (or -1) | ||
1811 | * @max_rate_idx: maximum rate index that can be used, this is | ||
1812 | * input to the algorithm and will be enforced | ||
1813 | */ | ||
1814 | struct rate_selection { | ||
1815 | s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx; | ||
1816 | }; | ||
1817 | |||
1818 | struct rate_control_ops { | ||
1819 | struct module *module; | ||
1820 | const char *name; | ||
1821 | void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); | ||
1822 | void (*clear)(void *priv); | ||
1823 | void (*free)(void *priv); | ||
1824 | |||
1825 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); | ||
1826 | void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, | ||
1827 | struct ieee80211_sta *sta, void *priv_sta); | ||
1828 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, | ||
1829 | void *priv_sta); | ||
1830 | |||
1831 | void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, | ||
1832 | struct ieee80211_sta *sta, void *priv_sta, | ||
1833 | struct sk_buff *skb); | ||
1834 | void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, | ||
1835 | struct ieee80211_sta *sta, void *priv_sta, | ||
1836 | struct sk_buff *skb, | ||
1837 | struct rate_selection *sel); | ||
1838 | |||
1839 | void (*add_sta_debugfs)(void *priv, void *priv_sta, | ||
1840 | struct dentry *dir); | ||
1841 | void (*remove_sta_debugfs)(void *priv, void *priv_sta); | ||
1842 | }; | ||
1843 | |||
1844 | static inline int rate_supported(struct ieee80211_sta *sta, | ||
1845 | enum ieee80211_band band, | ||
1846 | int index) | ||
1847 | { | ||
1848 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); | ||
1849 | } | ||
1850 | |||
1851 | static inline s8 | ||
1852 | rate_lowest_index(struct ieee80211_supported_band *sband, | ||
1853 | struct ieee80211_sta *sta) | ||
1854 | { | ||
1855 | int i; | ||
1856 | |||
1857 | for (i = 0; i < sband->n_bitrates; i++) | ||
1858 | if (rate_supported(sta, sband->band, i)) | ||
1859 | return i; | ||
1860 | |||
1861 | /* warn when we cannot find a rate. */ | ||
1862 | WARN_ON(1); | ||
1863 | |||
1864 | return 0; | ||
1865 | } | ||
1866 | |||
1867 | |||
1868 | int ieee80211_rate_control_register(struct rate_control_ops *ops); | ||
1869 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); | ||
1870 | |||
1761 | #endif /* MAC80211_H */ | 1871 | #endif /* MAC80211_H */ |