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.h248
1 files changed, 187 insertions, 61 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b397e4d984c7..5617a1613c91 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};
@@ -641,6 +649,8 @@ enum ieee80211_key_flags {
641 */ 649 */
642struct ieee80211_key_conf { 650struct ieee80211_key_conf {
643 enum ieee80211_key_alg alg; 651 enum ieee80211_key_alg alg;
652 u8 icv_len;
653 u8 iv_len;
644 u8 hw_key_idx; 654 u8 hw_key_idx;
645 u8 flags; 655 u8 flags;
646 s8 keyidx; 656 s8 keyidx;
@@ -662,6 +672,33 @@ enum set_key_cmd {
662}; 672};
663 673
664/** 674/**
675 * struct ieee80211_sta - station table entry
676 *
677 * A station table entry represents a station we are possibly
678 * communicating with. Since stations are RCU-managed in
679 * mac80211, any ieee80211_sta pointer you get access to must
680 * either be protected by rcu_read_lock() explicitly or implicitly,
681 * or you must take good care to not use such a pointer after a
682 * call to your sta_notify callback that removed it.
683 *
684 * @addr: MAC address
685 * @aid: AID we assigned to the station if we're an AP
686 * @supp_rates: Bitmap of supported rates (per band)
687 * @ht_info: HT capabilities of this STA
688 * @drv_priv: data area for driver use, will always be aligned to
689 * sizeof(void *), size is determined in hw information.
690 */
691struct ieee80211_sta {
692 u64 supp_rates[IEEE80211_NUM_BANDS];
693 u8 addr[ETH_ALEN];
694 u16 aid;
695 struct ieee80211_ht_info ht_info;
696
697 /* must be last */
698 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
699};
700
701/**
665 * enum sta_notify_cmd - sta notify command 702 * enum sta_notify_cmd - sta notify command
666 * 703 *
667 * Used with the sta_notify() callback in &struct ieee80211_ops, this 704 * Used with the sta_notify() callback in &struct ieee80211_ops, this
@@ -708,10 +745,7 @@ enum ieee80211_tkip_key_type {
708 * rely on the host system for such buffering. This option is used 745 * rely on the host system for such buffering. This option is used
709 * to configure the IEEE 802.11 upper layer to buffer broadcast and 746 * to configure the IEEE 802.11 upper layer to buffer broadcast and
710 * multicast frames when there are power saving stations so that 747 * multicast frames when there are power saving stations so that
711 * the driver can fetch them with ieee80211_get_buffered_bc(). Note 748 * the driver can fetch them with ieee80211_get_buffered_bc().
712 * that not setting this flag works properly only when the
713 * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because
714 * otherwise the stack will not know when the DTIM beacon was sent.
715 * 749 *
716 * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE: 750 * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
717 * Hardware is not capable of short slot operation on the 2.4 GHz band. 751 * Hardware is not capable of short slot operation on the 2.4 GHz band.
@@ -808,6 +842,11 @@ enum ieee80211_hw_flags {
808 * 842 *
809 * @vif_data_size: size (in bytes) of the drv_priv data area 843 * @vif_data_size: size (in bytes) of the drv_priv data area
810 * within &struct ieee80211_vif. 844 * within &struct ieee80211_vif.
845 * @sta_data_size: size (in bytes) of the drv_priv data area
846 * within &struct ieee80211_sta.
847 *
848 * @max_altrates: maximum number of alternate rate retry stages
849 * @max_altrate_tries: maximum number of tries for each stage
811 */ 850 */
812struct ieee80211_hw { 851struct ieee80211_hw {
813 struct ieee80211_conf conf; 852 struct ieee80211_conf conf;
@@ -819,12 +858,17 @@ struct ieee80211_hw {
819 unsigned int extra_tx_headroom; 858 unsigned int extra_tx_headroom;
820 int channel_change_time; 859 int channel_change_time;
821 int vif_data_size; 860 int vif_data_size;
861 int sta_data_size;
822 u16 queues; 862 u16 queues;
823 u16 ampdu_queues; 863 u16 ampdu_queues;
824 u16 max_listen_interval; 864 u16 max_listen_interval;
825 s8 max_signal; 865 s8 max_signal;
866 u8 max_altrates;
867 u8 max_altrate_tries;
826}; 868};
827 869
870struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
871
828/** 872/**
829 * SET_IEEE80211_DEV - set device for 802.11 hardware 873 * SET_IEEE80211_DEV - set device for 802.11 hardware
830 * 874 *
@@ -877,11 +921,11 @@ ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
877 921
878static inline struct ieee80211_rate * 922static inline struct ieee80211_rate *
879ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 923ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
880 const struct ieee80211_tx_info *c) 924 const struct ieee80211_tx_info *c, int idx)
881{ 925{
882 if (c->control.alt_retry_rate_idx < 0) 926 if (c->control.retries[idx].rate_idx < 0)
883 return NULL; 927 return NULL;
884 return &hw->wiphy->bands[c->band]->bitrates[c->control.alt_retry_rate_idx]; 928 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx];
885} 929}
886 930
887/** 931/**
@@ -1099,10 +1143,8 @@ enum ieee80211_ampdu_mlme_action {
1099 * See the section "Frame filtering" for more information. 1143 * See the section "Frame filtering" for more information.
1100 * This callback must be implemented and atomic. 1144 * This callback must be implemented and atomic.
1101 * 1145 *
1102 * @set_tim: Set TIM bit. If the hardware/firmware takes care of beacon 1146 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1103 * generation (that is, %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is set) 1147 * must be set or cleared for a given STA. Must be atomic.
1104 * mac80211 calls this function when a TIM bit must be set or cleared
1105 * for a given AID. Must be atomic.
1106 * 1148 *
1107 * @set_key: See the section "Hardware crypto acceleration" 1149 * @set_key: See the section "Hardware crypto acceleration"
1108 * This callback can sleep, and is only called between add_interface 1150 * This callback can sleep, and is only called between add_interface
@@ -1116,7 +1158,9 @@ enum ieee80211_ampdu_mlme_action {
1116 * @hw_scan: Ask the hardware to service the scan request, no need to start 1158 * @hw_scan: Ask the hardware to service the scan request, no need to start
1117 * the scan state machine in stack. The scan must honour the channel 1159 * the scan state machine in stack. The scan must honour the channel
1118 * configuration done by the regulatory agent in the wiphy's registered 1160 * configuration done by the regulatory agent in the wiphy's registered
1119 * bands. 1161 * bands. When the scan finishes, ieee80211_scan_completed() must be
1162 * called; note that it also must be called when the scan cannot finish
1163 * because the hardware is turned off! Anything else is a bug!
1120 * 1164 *
1121 * @get_stats: return low-level statistics 1165 * @get_stats: return low-level statistics
1122 * 1166 *
@@ -1136,7 +1180,7 @@ enum ieee80211_ampdu_mlme_action {
1136 * of assocaited station or AP. 1180 * of assocaited station or AP.
1137 * 1181 *
1138 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1182 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1139 * bursting) for a hardware TX queue. Must be atomic. 1183 * bursting) for a hardware TX queue.
1140 * 1184 *
1141 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1185 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1142 * to get number of currently queued packets (queue length), maximum queue 1186 * to get number of currently queued packets (queue length), maximum queue
@@ -1186,7 +1230,8 @@ struct ieee80211_ops {
1186 unsigned int changed_flags, 1230 unsigned int changed_flags,
1187 unsigned int *total_flags, 1231 unsigned int *total_flags,
1188 int mc_count, struct dev_addr_list *mc_list); 1232 int mc_count, struct dev_addr_list *mc_list);
1189 int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); 1233 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1234 bool set);
1190 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1235 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1191 const u8 *local_address, const u8 *address, 1236 const u8 *local_address, const u8 *address,
1192 struct ieee80211_key_conf *key); 1237 struct ieee80211_key_conf *key);
@@ -1203,7 +1248,7 @@ struct ieee80211_ops {
1203 int (*set_retry_limit)(struct ieee80211_hw *hw, 1248 int (*set_retry_limit)(struct ieee80211_hw *hw,
1204 u32 short_retry, u32 long_retr); 1249 u32 short_retry, u32 long_retr);
1205 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1250 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1206 enum sta_notify_cmd, const u8 *addr); 1251 enum sta_notify_cmd, struct ieee80211_sta *sta);
1207 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1252 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1208 const struct ieee80211_tx_queue_params *params); 1253 const struct ieee80211_tx_queue_params *params);
1209 int (*get_tx_stats)(struct ieee80211_hw *hw, 1254 int (*get_tx_stats)(struct ieee80211_hw *hw,
@@ -1213,7 +1258,7 @@ struct ieee80211_ops {
1213 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1258 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1214 int (*ampdu_action)(struct ieee80211_hw *hw, 1259 int (*ampdu_action)(struct ieee80211_hw *hw,
1215 enum ieee80211_ampdu_mlme_action action, 1260 enum ieee80211_ampdu_mlme_action action,
1216 const u8 *addr, u16 tid, u16 *ssn); 1261 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1217}; 1262};
1218 1263
1219/** 1264/**
@@ -1562,16 +1607,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1562unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1607unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1563 1608
1564/** 1609/**
1565 * ieee80211_get_hdrlen - get header length from frame control
1566 *
1567 * This function returns the 802.11 header length in bytes (not including
1568 * encryption headers.)
1569 *
1570 * @fc: the frame control field (in CPU endianness)
1571 */
1572int ieee80211_get_hdrlen(u16 fc);
1573
1574/**
1575 * ieee80211_hdrlen - get header length in bytes from frame control 1610 * ieee80211_hdrlen - get header length in bytes from frame control
1576 * @fc: frame control field in little-endian format 1611 * @fc: frame control field in little-endian format
1577 */ 1612 */
@@ -1613,6 +1648,16 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
1613void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); 1648void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
1614 1649
1615/** 1650/**
1651 * ieee80211_queue_stopped - test status of the queue
1652 * @hw: pointer as obtained from ieee80211_alloc_hw().
1653 * @queue: queue number (counted from zero).
1654 *
1655 * Drivers should use this function instead of netif_stop_queue.
1656 */
1657
1658int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
1659
1660/**
1616 * ieee80211_stop_queues - stop all queues 1661 * ieee80211_stop_queues - stop all queues
1617 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1662 * @hw: pointer as obtained from ieee80211_alloc_hw().
1618 * 1663 *
@@ -1763,4 +1808,85 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1763 */ 1808 */
1764void ieee80211_notify_mac(struct ieee80211_hw *hw, 1809void ieee80211_notify_mac(struct ieee80211_hw *hw,
1765 enum ieee80211_notification_types notif_type); 1810 enum ieee80211_notification_types notif_type);
1811
1812/**
1813 * ieee80211_find_sta - find a station
1814 *
1815 * @hw: pointer as obtained from ieee80211_alloc_hw()
1816 * @addr: station's address
1817 *
1818 * This function must be called under RCU lock and the
1819 * resulting pointer is only valid under RCU lock as well.
1820 */
1821struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1822 const u8 *addr);
1823
1824
1825/* Rate control API */
1826/**
1827 * struct rate_selection - rate information for/from rate control algorithms
1828 *
1829 * @rate_idx: selected transmission rate index
1830 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used
1831 * @probe_idx: rate for probing (or -1)
1832 * @max_rate_idx: maximum rate index that can be used, this is
1833 * input to the algorithm and will be enforced
1834 */
1835struct rate_selection {
1836 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx;
1837};
1838
1839struct rate_control_ops {
1840 struct module *module;
1841 const char *name;
1842 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
1843 void (*clear)(void *priv);
1844 void (*free)(void *priv);
1845
1846 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1847 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1848 struct ieee80211_sta *sta, void *priv_sta);
1849 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1850 void *priv_sta);
1851
1852 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1853 struct ieee80211_sta *sta, void *priv_sta,
1854 struct sk_buff *skb);
1855 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband,
1856 struct ieee80211_sta *sta, void *priv_sta,
1857 struct sk_buff *skb,
1858 struct rate_selection *sel);
1859
1860 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1861 struct dentry *dir);
1862 void (*remove_sta_debugfs)(void *priv, void *priv_sta);
1863};
1864
1865static inline int rate_supported(struct ieee80211_sta *sta,
1866 enum ieee80211_band band,
1867 int index)
1868{
1869 return (sta == NULL || sta->supp_rates[band] & BIT(index));
1870}
1871
1872static inline s8
1873rate_lowest_index(struct ieee80211_supported_band *sband,
1874 struct ieee80211_sta *sta)
1875{
1876 int i;
1877
1878 for (i = 0; i < sband->n_bitrates; i++)
1879 if (rate_supported(sta, sband->band, i))
1880 return i;
1881
1882 /* warn when we cannot find a rate. */
1883 WARN_ON(1);
1884
1885 return 0;
1886}
1887
1888
1889int ieee80211_rate_control_register(struct rate_control_ops *ops);
1890void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1891
1766#endif /* MAC80211_H */ 1892#endif /* MAC80211_H */