Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mac80211.h
Go to the documentation of this file.
1 /*
2  * mac80211 <-> driver interface
3  *
4  * Copyright 2002-2005, Devicescape Software, Inc.
5  * Copyright 2006-2007 Jiri Benc <[email protected]>
6  * Copyright 2007-2010 Johannes Berg <[email protected]>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 
13 #ifndef MAC80211_H
14 #define MAC80211_H
15 
16 #include <linux/bug.h>
17 #include <linux/kernel.h>
18 #include <linux/if_ether.h>
19 #include <linux/skbuff.h>
20 #include <linux/ieee80211.h>
21 #include <net/cfg80211.h>
22 #include <asm/unaligned.h>
23 
90 struct device;
91 
99 };
100 
101 #define IEEE80211_INVAL_HW_QUEUE 0xff
102 
115 };
116 #define IEEE80211_NUM_ACS 4
117 
136  bool uapsd;
137 };
138 
140  unsigned int dot11ACKFailureCount;
141  unsigned int dot11RTSFailureCount;
142  unsigned int dot11FCSErrorCount;
143  unsigned int dot11RTSSuccessCount;
144 };
145 
194  BSS_CHANGED_PS = 1<<17,
195 
196  /* when adding here, make sure to change ieee80211_reconfig */
197 };
198 
199 /*
200  * The maximum number of IPv4 addresses listed for ARP filtering. If the number
201  * of addresses for an interface increase beyond this value, hardware ARP
202  * filtering will be disabled.
203  */
204 #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
205 
215 };
216 
278  const u8 *bssid;
279  /* association related data */
282  /* erp related data */
301  bool qos;
302  bool idle;
303  bool ps;
305  size_t ssid_len;
307 };
308 
418  /* hole at 20, use later */
428 };
429 
430 #define IEEE80211_TX_CTL_STBC_SHIFT 23
431 
432 /*
433  * This definition is used as a mask to clear all temporary flags, which are
434  * set by the tx handlers for each transmission attempt by the mac80211 stack.
435  */
436 #define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \
437  IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \
438  IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
439  IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
440  IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
441  IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
442  IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
443  IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
444 
469 
470  /* rate index is an MCS rate number instead of an index */
476 };
477 
478 
479 /* there are 40 bytes if you don't need the rateset to be kept */
480 #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
481 
482 /* if you do need the rateset, then you have less space */
483 #define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
484 
485 /* maximum number of rate stages */
486 #define IEEE80211_TX_MAX_RATES 4
487 
520 } __packed;
521 
544  /* common information */
547 
549 
551 
552  union {
553  struct {
554  union {
555  /* rate control */
556  struct {
560  /* 3 bytes free */
561  };
562  /* only needed before rate control */
563  unsigned long jiffies;
564  };
565  /* NB: vif can be NULL for injected frames */
568  /* 8 bytes free */
569  } control;
570  struct {
571  struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
576  /* 21 bytes free */
577  } status;
578  struct {
581  void *rate_driver_data[
583  };
584  void *driver_data[
586  };
587 };
588 
602 };
603 
604 static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
605 {
606  return (struct ieee80211_tx_info *)skb->cb;
607 }
608 
609 static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
610 {
611  return (struct ieee80211_rx_status *)skb->cb;
612 }
613 
628 static inline void
629 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
630 {
631  int i;
632 
634  offsetof(struct ieee80211_tx_info, control.rates));
636  offsetof(struct ieee80211_tx_info, driver_rates));
637  BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
638  /* clear the rate counts */
639  for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
640  info->status.rates[i].count = 0;
641 
642  BUILD_BUG_ON(
643  offsetof(struct ieee80211_tx_info, status.ack_signal) != 20);
644  memset(&info->status.ampdu_ack_len, 0,
645  sizeof(struct ieee80211_tx_info) -
646  offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
647 }
648 
649 
714 };
715 
753 };
754 
783 };
784 
785 
807 };
808 
823 
824  /* keep last */
826 };
827 
868 
871 
873 
877 };
878 
896  bool block_tx;
899 };
900 
914 };
915 
941  bool p2p;
942 
945 
947 
948  /* must be last */
949  u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
950 };
951 
952 static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
953 {
954 #ifdef CONFIG_MAC80211_MESH
955  return vif->type == NL80211_IFTYPE_MESH_POINT;
956 #endif
957  return false;
958 }
959 
999 };
1000 
1030  u8 key[0];
1031 };
1032 
1044 };
1045 
1057  /* NOTE: These need to be ordered correctly! */
1063 };
1064 
1091  bool wme;
1094 
1095  /* must be last */
1096  u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
1097 };
1098 
1110 };
1111 
1120 };
1121 
1284 };
1285 
1364  struct wiphy *wiphy;
1366  void *priv;
1368  unsigned int extra_tx_headroom;
1384 };
1385 
1398 
1405 static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
1406 {
1407  set_wiphy_dev(hw->wiphy, dev);
1408 }
1409 
1416 static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
1417 {
1418  memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
1419 }
1420 
1421 static inline struct ieee80211_rate *
1422 ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
1423  const struct ieee80211_tx_info *c)
1424 {
1425  if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
1426  return NULL;
1427  return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
1428 }
1429 
1430 static inline struct ieee80211_rate *
1431 ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
1432  const struct ieee80211_tx_info *c)
1433 {
1434  if (c->control.rts_cts_rate_idx < 0)
1435  return NULL;
1436  return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx];
1437 }
1438 
1439 static inline struct ieee80211_rate *
1440 ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1441  const struct ieee80211_tx_info *c, int idx)
1442 {
1443  if (c->control.rates[idx + 1].idx < 0)
1444  return NULL;
1445  return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
1446 }
1447 
1456 void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1457 
1887  FIF_FCSFAIL = 1<<2,
1890  FIF_CONTROL = 1<<5,
1892  FIF_PSPOLL = 1<<7,
1894 };
1895 
1919 };
1920 
1930 };
1931 
1946 };
1947 
2322  void (*tx)(struct ieee80211_hw *hw,
2323  struct ieee80211_tx_control *control,
2324  struct sk_buff *skb);
2325  int (*start)(struct ieee80211_hw *hw);
2326  void (*stop)(struct ieee80211_hw *hw);
2327 #ifdef CONFIG_PM
2328  int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
2329  int (*resume)(struct ieee80211_hw *hw);
2330  void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
2331 #endif
2333  struct ieee80211_vif *vif);
2335  struct ieee80211_vif *vif,
2336  enum nl80211_iftype new_type, bool p2p);
2338  struct ieee80211_vif *vif);
2341  struct ieee80211_vif *vif,
2342  struct ieee80211_bss_conf *info,
2343  u32 changed);
2344 
2346  struct netdev_hw_addr_list *mc_list);
2348  unsigned int changed_flags,
2349  unsigned int *total_flags,
2350  u64 multicast);
2351  int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2352  bool set);
2354  struct ieee80211_vif *vif, struct ieee80211_sta *sta,
2355  struct ieee80211_key_conf *key);
2357  struct ieee80211_vif *vif,
2358  struct ieee80211_key_conf *conf,
2359  struct ieee80211_sta *sta,
2360  u32 iv32, u16 *phase1key);
2362  struct ieee80211_vif *vif,
2363  struct cfg80211_gtk_rekey_data *data);
2364  int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2365  struct cfg80211_scan_request *req);
2367  struct ieee80211_vif *vif);
2369  struct ieee80211_vif *vif,
2371  struct ieee80211_sched_scan_ies *ies);
2373  struct ieee80211_vif *vif);
2378  void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
2379  u32 *iv32, u16 *iv16);
2382  int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2383  struct ieee80211_sta *sta);
2384  int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2385  struct ieee80211_sta *sta);
2386  void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2387  enum sta_notify_cmd, struct ieee80211_sta *sta);
2388  int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2389  struct ieee80211_sta *sta,
2390  enum ieee80211_sta_state old_state,
2393  struct ieee80211_vif *vif,
2394  struct ieee80211_sta *sta,
2395  u32 changed);
2397  struct ieee80211_vif *vif, u16 ac,
2398  const struct ieee80211_tx_queue_params *params);
2399  u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2400  void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2401  u64 tsf);
2402  void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2405  struct ieee80211_vif *vif,
2407  struct ieee80211_sta *sta, u16 tid, u16 *ssn,
2408  u8 buf_size);
2409  int (*get_survey)(struct ieee80211_hw *hw, int idx,
2410  struct survey_info *survey);
2413 #ifdef CONFIG_NL80211_TESTMODE
2414  int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
2415  int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb,
2416  struct netlink_callback *cb,
2417  void *data, int len);
2418 #endif
2419  void (*flush)(struct ieee80211_hw *hw, bool drop);
2421  struct ieee80211_channel_switch *ch_switch);
2422  int (*napi_poll)(struct ieee80211_hw *hw, int budget);
2423  int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
2424  int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
2425 
2427  struct ieee80211_channel *chan,
2429  int duration);
2433  u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
2436  const struct cfg80211_bitrate_mask *mask);
2438  enum ieee80211_rssi_event rssi_event);
2439 
2441  struct ieee80211_sta *sta,
2442  u16 tids, int num_frames,
2444  bool more_data);
2446  struct ieee80211_sta *sta,
2447  u16 tids, int num_frames,
2449  bool more_data);
2450 
2452  struct ieee80211_vif *vif, int sset);
2454  struct ieee80211_vif *vif,
2455  struct ethtool_stats *stats, u64 *data);
2457  struct ieee80211_vif *vif,
2458  u32 sset, u8 *data);
2459  int (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2460  struct ieee80211_sta *sta, s8 *rssi_dbm);
2461 
2463  struct ieee80211_vif *vif);
2464 };
2465 
2478 struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
2479  const struct ieee80211_ops *ops);
2480 
2490 int ieee80211_register_hw(struct ieee80211_hw *hw);
2491 
2501 };
2502 
2514 };
2515 
2516 #ifdef CONFIG_MAC80211_LEDS
2517 extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
2518 extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
2519 extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
2520 extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
2522  struct ieee80211_hw *hw, unsigned int flags,
2523  const struct ieee80211_tpt_blink *blink_table,
2524  unsigned int blink_table_len);
2525 #endif
2526 
2536 static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
2537 {
2538 #ifdef CONFIG_MAC80211_LEDS
2539  return __ieee80211_get_tx_led_name(hw);
2540 #else
2541  return NULL;
2542 #endif
2543 }
2544 
2555 static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
2556 {
2557 #ifdef CONFIG_MAC80211_LEDS
2558  return __ieee80211_get_rx_led_name(hw);
2559 #else
2560  return NULL;
2561 #endif
2562 }
2563 
2574 static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
2575 {
2576 #ifdef CONFIG_MAC80211_LEDS
2577  return __ieee80211_get_assoc_led_name(hw);
2578 #else
2579  return NULL;
2580 #endif
2581 }
2582 
2593 static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
2594 {
2595 #ifdef CONFIG_MAC80211_LEDS
2596  return __ieee80211_get_radio_led_name(hw);
2597 #else
2598  return NULL;
2599 #endif
2600 }
2601 
2613 static inline char *
2614 ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
2615  const struct ieee80211_tpt_blink *blink_table,
2616  unsigned int blink_table_len)
2617 {
2618 #ifdef CONFIG_MAC80211_LEDS
2619  return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table,
2620  blink_table_len);
2621 #else
2622  return NULL;
2623 #endif
2624 }
2625 
2634 void ieee80211_unregister_hw(struct ieee80211_hw *hw);
2635 
2645 void ieee80211_free_hw(struct ieee80211_hw *hw);
2646 
2659 void ieee80211_restart_hw(struct ieee80211_hw *hw);
2660 
2667 void ieee80211_napi_schedule(struct ieee80211_hw *hw);
2668 
2675 void ieee80211_napi_complete(struct ieee80211_hw *hw);
2676 
2696 void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
2697 
2710 void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
2711 
2724 static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
2725  struct sk_buff *skb)
2726 {
2727  local_bh_disable();
2728  ieee80211_rx(hw, skb);
2729  local_bh_enable();
2730 }
2731 
2749 int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
2750 
2762 static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
2763  bool start)
2764 {
2765  int ret;
2766 
2767  local_bh_disable();
2768  ret = ieee80211_sta_ps_transition(sta, start);
2769  local_bh_enable();
2770 
2771  return ret;
2772 }
2773 
2774 /*
2775  * The TX headroom reserved by mac80211 for its own tx_status functions.
2776  * This is enough for the radiotap header.
2777  */
2778 #define IEEE80211_TX_STATUS_HEADROOM 14
2779 
2808 void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
2809  u8 tid, bool buffered);
2810 
2826 void ieee80211_tx_status(struct ieee80211_hw *hw,
2827  struct sk_buff *skb);
2828 
2841 static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
2842  struct sk_buff *skb)
2843 {
2844  local_bh_disable();
2845  ieee80211_tx_status(hw, skb);
2846  local_bh_enable();
2847 }
2848 
2862  struct sk_buff *skb);
2863 
2873 void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
2874 
2899 struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2900  struct ieee80211_vif *vif,
2901  u16 *tim_offset, u16 *tim_length);
2902 
2910 static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
2911  struct ieee80211_vif *vif)
2912 {
2913  return ieee80211_beacon_get_tim(hw, vif, NULL, NULL);
2914 }
2915 
2926 struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
2927  struct ieee80211_vif *vif);
2928 
2941 struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
2942  struct ieee80211_vif *vif);
2943 
2956 struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2957  struct ieee80211_vif *vif);
2958 
2971 struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2972  struct ieee80211_vif *vif,
2973  const u8 *ssid, size_t ssid_len,
2974  const u8 *ie, size_t ie_len);
2975 
2990 void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2991  const void *frame, size_t frame_len,
2992  const struct ieee80211_tx_info *frame_txctl,
2993  struct ieee80211_rts *rts);
2994 
3007  struct ieee80211_vif *vif, size_t frame_len,
3008  const struct ieee80211_tx_info *frame_txctl);
3009 
3024 void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
3025  struct ieee80211_vif *vif,
3026  const void *frame, size_t frame_len,
3027  const struct ieee80211_tx_info *frame_txctl,
3028  struct ieee80211_cts *cts);
3029 
3042  struct ieee80211_vif *vif,
3043  size_t frame_len,
3044  const struct ieee80211_tx_info *frame_txctl);
3045 
3058  struct ieee80211_vif *vif,
3059  enum ieee80211_band band,
3060  size_t frame_len,
3061  struct ieee80211_rate *rate);
3062 
3083 struct sk_buff *
3084 ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
3085 
3095 void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf,
3096  u32 iv32, u16 *p1k);
3097 
3109 static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf,
3110  struct sk_buff *skb, u16 *p1k)
3111 {
3112  struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
3113  const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
3114  u32 iv32 = get_unaligned_le32(&data[4]);
3115 
3116  ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k);
3117 }
3118 
3130 void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
3131  const u8 *ta, u32 iv32, u16 *p1k);
3132 
3144 void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
3145  struct sk_buff *skb, u8 *p2k);
3146 
3157  union {
3158  struct {
3161  } tkip;
3162  struct {
3163  u8 pn[6];
3164  } ccmp;
3165  struct {
3166  u8 pn[6];
3167  } aes_cmac;
3168  };
3169 };
3170 
3185 void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf,
3186  struct ieee80211_key_seq *seq);
3187 
3204 void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
3205  int tid, struct ieee80211_key_seq *seq);
3206 
3214 void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
3215  const u8 *replay_ctr, gfp_t gfp);
3216 
3224 void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
3225 
3233 void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
3234 
3243 int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
3244 
3251 void ieee80211_stop_queues(struct ieee80211_hw *hw);
3252 
3259 void ieee80211_wake_queues(struct ieee80211_hw *hw);
3260 
3272 void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
3273 
3283 
3295 
3311  void (*iterator)(void *data, u8 *mac,
3312  struct ieee80211_vif *vif),
3313  void *data);
3314 
3329  void (*iterator)(void *data,
3330  u8 *mac,
3331  struct ieee80211_vif *vif),
3332  void *data);
3333 
3343 void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
3344 
3356  struct delayed_work *dwork,
3357  unsigned long delay);
3358 
3371 int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
3372  u16 timeout);
3373 
3384 void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
3385  u16 tid);
3386 
3398 int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
3399 
3410 void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
3411  u16 tid);
3412 
3422 struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
3423  const u8 *addr);
3424 
3446  const u8 *addr,
3447  const u8 *localaddr);
3448 
3478 void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
3479  struct ieee80211_sta *pubsta, bool block);
3480 
3497 void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta);
3498 
3517 void ieee80211_iter_keys(struct ieee80211_hw *hw,
3518  struct ieee80211_vif *vif,
3519  void (*iter)(struct ieee80211_hw *hw,
3520  struct ieee80211_vif *vif,
3521  struct ieee80211_sta *sta,
3522  struct ieee80211_key_conf *key,
3523  void *data),
3524  void *iter_data);
3525 
3539  struct ieee80211_vif *vif);
3540 
3550 void ieee80211_beacon_loss(struct ieee80211_vif *vif);
3551 
3564 void ieee80211_connection_loss(struct ieee80211_vif *vif);
3565 
3587 void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
3588 
3605 void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif);
3606 
3617 void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
3618 
3631 void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
3632  enum nl80211_cqm_rssi_threshold_event rssi_event,
3633  gfp_t gfp);
3634 
3643 void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
3644 
3654 void ieee80211_request_smps(struct ieee80211_vif *vif,
3655  enum ieee80211_smps_mode smps_mode);
3656 
3661 void ieee80211_ready_on_channel(struct ieee80211_hw *hw);
3662 
3668 
3683 void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
3684  const u8 *addr);
3685 
3697 void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
3698 
3699 /* Rate control API */
3700 
3724  struct ieee80211_hw *hw;
3727  struct sk_buff *skb;
3733  bool bss;
3734 };
3735 
3737  struct module *module;
3738  const char *name;
3739  void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
3740  void (*free)(void *priv);
3741 
3742  void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
3743  void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
3744  struct ieee80211_sta *sta, void *priv_sta);
3746  struct ieee80211_sta *sta, void *priv_sta,
3747  u32 changed);
3748  void (*free_sta)(void *priv, struct ieee80211_sta *sta,
3749  void *priv_sta);
3750 
3751  void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
3752  struct ieee80211_sta *sta, void *priv_sta,
3753  struct sk_buff *skb);
3754  void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
3755  struct ieee80211_tx_rate_control *txrc);
3756 
3757  void (*add_sta_debugfs)(void *priv, void *priv_sta,
3758  struct dentry *dir);
3759  void (*remove_sta_debugfs)(void *priv, void *priv_sta);
3760 };
3761 
3762 static inline int rate_supported(struct ieee80211_sta *sta,
3763  enum ieee80211_band band,
3764  int index)
3765 {
3766  return (sta == NULL || sta->supp_rates[band] & BIT(index));
3767 }
3768 
3787 bool rate_control_send_low(struct ieee80211_sta *sta,
3788  void *priv_sta,
3789  struct ieee80211_tx_rate_control *txrc);
3790 
3791 
3792 static inline s8
3793 rate_lowest_index(struct ieee80211_supported_band *sband,
3794  struct ieee80211_sta *sta)
3795 {
3796  int i;
3797 
3798  for (i = 0; i < sband->n_bitrates; i++)
3799  if (rate_supported(sta, sband->band, i))
3800  return i;
3801 
3802  /* warn when we cannot find a rate. */
3803  WARN_ON_ONCE(1);
3804 
3805  /* and return 0 (the lowest index) */
3806  return 0;
3807 }
3808 
3809 static inline
3810 bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
3811  struct ieee80211_sta *sta)
3812 {
3813  unsigned int i;
3814 
3815  for (i = 0; i < sband->n_bitrates; i++)
3816  if (rate_supported(sta, sband->band, i))
3817  return true;
3818  return false;
3819 }
3820 
3823 
3824 static inline bool
3825 conf_is_ht20(struct ieee80211_conf *conf)
3826 {
3827  return conf->channel_type == NL80211_CHAN_HT20;
3828 }
3829 
3830 static inline bool
3831 conf_is_ht40_minus(struct ieee80211_conf *conf)
3832 {
3833  return conf->channel_type == NL80211_CHAN_HT40MINUS;
3834 }
3835 
3836 static inline bool
3837 conf_is_ht40_plus(struct ieee80211_conf *conf)
3838 {
3839  return conf->channel_type == NL80211_CHAN_HT40PLUS;
3840 }
3841 
3842 static inline bool
3843 conf_is_ht40(struct ieee80211_conf *conf)
3844 {
3845  return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
3846 }
3847 
3848 static inline bool
3849 conf_is_ht(struct ieee80211_conf *conf)
3850 {
3851  return conf->channel_type != NL80211_CHAN_NO_HT;
3852 }
3853 
3854 static inline enum nl80211_iftype
3855 ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p)
3856 {
3857  if (p2p) {
3858  switch (type) {
3861  case NL80211_IFTYPE_AP:
3862  return NL80211_IFTYPE_P2P_GO;
3863  default:
3864  break;
3865  }
3866  }
3867  return type;
3868 }
3869 
3870 static inline enum nl80211_iftype
3871 ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
3872 {
3873  return ieee80211_iftype_p2p(vif->type, vif->p2p);
3874 }
3875 
3877  int rssi_min_thold,
3878  int rssi_max_thold);
3879 
3881 
3890 int ieee80211_ave_rssi(struct ieee80211_vif *vif);
3891 
3892 #endif /* MAC80211_H */