Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cfg80211.h
Go to the documentation of this file.
1 #ifndef __NET_CFG80211_H
2 #define __NET_CFG80211_H
3 /*
4  * 802.11 device and configuration interface
5  *
6  * Copyright 2006-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 #include <linux/netdevice.h>
14 #include <linux/debugfs.h>
15 #include <linux/list.h>
16 #include <linux/bug.h>
17 #include <linux/netlink.h>
18 #include <linux/skbuff.h>
19 #include <linux/nl80211.h>
20 #include <linux/if_ether.h>
21 #include <linux/ieee80211.h>
22 #include <net/regulatory.h>
23 
61 /*
62  * wireless hardware capability structures
63  */
64 
80 
81  /* keep last */
83 };
84 
109 };
110 
111 #define IEEE80211_CHAN_NO_HT40 \
112  (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
113 
146 };
147 
175 };
176 
195 };
196 
210  u16 cap; /* use IEEE80211_HT_CAP_ */
215 };
216 
229  u32 cap; /* use IEEE80211_VHT_CAP_ */
231 };
232 
258 };
259 
260 /*
261  * Wireless hardware/device configuration structures and methods
262  */
263 
283 struct vif_params {
285 };
286 
300 struct key_params {
301  u8 *key;
302  u8 *seq;
303  int key_len;
304  int seq_len;
306 };
307 
330 };
331 
350 struct survey_info {
359 };
360 
389 };
390 
411  const u8 *head, *tail;
412  const u8 *beacon_ies;
415  const u8 *probe_resp;
416 
422 };
423 
446 
448 
450  const u8 *ssid;
451  size_t ssid_len;
454  bool privacy;
457 };
458 
470 };
471 
481 };
482 
511  struct net_device *vlan;
522 };
523 
575 };
576 
593 };
594 
604 struct rate_info {
608 };
609 
624 };
625 
639 };
640 
679 struct station_info {
699 
701 
704 
707 
708  /*
709  * Note: Add a new enum station_info_flags value for each new field and
710  * use it to check which fields are initialized.
711  */
712 };
713 
732 };
733 
756 };
757 
776 struct mpath_info {
785 
787 };
788 
815 };
816 
880 struct mesh_config {
906 };
907 
925 struct mesh_setup {
928  const u8 *mesh_id;
933  const u8 *ie;
936  bool is_secure;
938 };
939 
956 };
957 
958 /* from net/wireless.h */
959 struct wiphy;
960 
992 };
993 
1011  int n_ssids;
1013  const u8 *ie;
1014  size_t ie_len;
1015 
1017 
1019 
1020  /* internal */
1021  struct wiphy *wiphy;
1022  bool aborted;
1023  bool no_cck;
1024 
1025  /* keep last */
1027 };
1028 
1036 };
1037 
1059  int n_ssids;
1062  const u8 *ie;
1063  size_t ie_len;
1067 
1068  /* internal */
1069  struct wiphy *wiphy;
1070  struct net_device *dev;
1071 
1072  /* keep last */
1074 };
1075 
1087 };
1088 
1115 
1126 
1128 
1129  void (*free_priv)(struct cfg80211_bss *bss);
1130  u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
1131 };
1132 
1139 const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1140 
1141 
1158  const u8 *ie;
1159  size_t ie_len;
1161  const u8 *key;
1163 };
1164 
1172 };
1173 
1196  const u8 *ie, *prev_bssid;
1197  size_t ie_len;
1199  bool use_mfp;
1203 };
1204 
1217  const u8 *bssid;
1218  const u8 *ie;
1219  size_t ie_len;
1222 };
1223 
1239  const u8 *ie;
1240  size_t ie_len;
1243 };
1244 
1276  u8 *ie;
1281  bool privacy;
1284 };
1285 
1317  size_t ssid_len;
1319  u8 *ie;
1320  size_t ie_len;
1321  bool privacy;
1323  const u8 *key;
1329 };
1330 
1345 };
1346 
1347 /*
1348  * cfg80211_bitrate_mask - masks for bitrate control
1349  */
1351  struct {
1355 };
1368 };
1369 
1383 };
1384 
1406 };
1407 
1418 };
1419 
1627  int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
1628  int (*resume)(struct wiphy *wiphy);
1629  void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
1630 
1631  struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
1632  const char *name,
1633  enum nl80211_iftype type,
1634  u32 *flags,
1635  struct vif_params *params);
1637  struct wireless_dev *wdev);
1639  struct net_device *dev,
1640  enum nl80211_iftype type, u32 *flags,
1641  struct vif_params *params);
1642 
1643  int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1644  u8 key_index, bool pairwise, const u8 *mac_addr,
1645  struct key_params *params);
1646  int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1647  u8 key_index, bool pairwise, const u8 *mac_addr,
1648  void *cookie,
1649  void (*callback)(void *cookie, struct key_params*));
1650  int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1651  u8 key_index, bool pairwise, const u8 *mac_addr);
1653  struct net_device *netdev,
1654  u8 key_index, bool unicast, bool multicast);
1656  struct net_device *netdev,
1657  u8 key_index);
1658 
1659  int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
1660  struct cfg80211_ap_settings *settings);
1662  struct cfg80211_beacon_data *info);
1663  int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
1664 
1665 
1666  int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
1667  u8 *mac, struct station_parameters *params);
1668  int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
1669  u8 *mac);
1671  u8 *mac, struct station_parameters *params);
1672  int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
1673  u8 *mac, struct station_info *sinfo);
1674  int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
1675  int idx, u8 *mac, struct station_info *sinfo);
1676 
1677  int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
1678  u8 *dst, u8 *next_hop);
1679  int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
1680  u8 *dst);
1681  int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
1682  u8 *dst, u8 *next_hop);
1683  int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
1684  u8 *dst, u8 *next_hop,
1685  struct mpath_info *pinfo);
1686  int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
1687  int idx, u8 *dst, u8 *next_hop,
1688  struct mpath_info *pinfo);
1690  struct net_device *dev,
1691  struct mesh_config *conf);
1693  struct net_device *dev, u32 mask,
1694  const struct mesh_config *nconf);
1695  int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
1696  const struct mesh_config *conf,
1697  const struct mesh_setup *setup);
1698  int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
1699 
1700  int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
1701  struct bss_parameters *params);
1702 
1704  struct ieee80211_txq_params *params);
1705 
1707  struct net_device *dev,
1708  struct ieee80211_channel *chan);
1709 
1711  struct ieee80211_channel *chan,
1713 
1714  int (*scan)(struct wiphy *wiphy,
1715  struct cfg80211_scan_request *request);
1716 
1717  int (*auth)(struct wiphy *wiphy, struct net_device *dev,
1718  struct cfg80211_auth_request *req);
1719  int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
1720  struct cfg80211_assoc_request *req);
1721  int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
1722  struct cfg80211_deauth_request *req);
1723  int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1724  struct cfg80211_disassoc_request *req);
1725 
1726  int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1727  struct cfg80211_connect_params *sme);
1728  int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1729  u16 reason_code);
1730 
1731  int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
1732  struct cfg80211_ibss_params *params);
1733  int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1734 
1736 
1738  enum nl80211_tx_power_setting type, int mbm);
1739  int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
1740 
1741  int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1742  const u8 *addr);
1743 
1745 
1746 #ifdef CONFIG_NL80211_TESTMODE
1747  int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
1748  int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
1749  struct netlink_callback *cb,
1750  void *data, int len);
1751 #endif
1752 
1754  struct net_device *dev,
1755  const u8 *peer,
1756  const struct cfg80211_bitrate_mask *mask);
1757 
1758  int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
1759  int idx, struct survey_info *info);
1760 
1761  int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
1762  struct cfg80211_pmksa *pmksa);
1763  int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
1764  struct cfg80211_pmksa *pmksa);
1765  int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
1766 
1768  struct wireless_dev *wdev,
1769  struct ieee80211_channel *chan,
1771  unsigned int duration,
1772  u64 *cookie);
1774  struct wireless_dev *wdev,
1775  u64 cookie);
1776 
1777  int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1778  struct ieee80211_channel *chan, bool offchan,
1780  bool channel_type_valid, unsigned int wait,
1781  const u8 *buf, size_t len, bool no_cck,
1782  bool dont_wait_for_ack, u64 *cookie);
1784  struct wireless_dev *wdev,
1785  u64 cookie);
1786 
1788  bool enabled, int timeout);
1789 
1791  struct net_device *dev,
1792  s32 rssi_thold, u32 rssi_hyst);
1793 
1795  struct net_device *dev,
1796  u32 rate, u32 pkts, u32 intvl);
1797 
1799  struct wireless_dev *wdev,
1800  u16 frame_type, bool reg);
1801 
1802  int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1803  int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
1804 
1807  u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1808 
1810  struct net_device *dev,
1813 
1815  struct cfg80211_gtk_rekey_data *data);
1816 
1817  int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1818  u8 *peer, u8 action_code, u8 dialog_token,
1819  u16 status_code, const u8 *buf, size_t len);
1820  int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1821  u8 *peer, enum nl80211_tdls_operation oper);
1822 
1823  int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
1824  const u8 *peer, u64 *cookie);
1825 
1827  struct net_device *dev,
1828  u16 noack_map);
1829 
1831  struct net_device *dev, int sset);
1833  struct ethtool_stats *stats, u64 *data);
1835  u32 sset, u8 *data);
1836 
1837  struct ieee80211_channel *
1838  (*get_channel)(struct wiphy *wiphy,
1839  struct wireless_dev *wdev,
1840  enum nl80211_channel_type *type);
1841 
1843  struct wireless_dev *wdev);
1845  struct wireless_dev *wdev);
1846 };
1847 
1848 /*
1849  * wireless hardware and networking interfaces structures
1850  * and registration/helper functions
1851  */
1852 
1923  /* use hole at 12 */
1933 };
1934 
1943 };
1944 
2007 };
2008 
2009 struct mac_address {
2011 };
2012 
2015 };
2016 
2042 };
2043 
2057 };
2058 
2154 struct wiphy {
2155  /* assign these fields before you register the wiphy */
2156 
2157  /* permanent MAC address(es) */
2160 
2162 
2164 
2168 
2170 
2171  /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2173 
2175 
2177 
2179 
2186 
2189 
2195 
2198 
2199 #ifdef CONFIG_PM
2200  struct wiphy_wowlan_support wowlan;
2201 #endif
2202 
2204 
2206 
2209 
2210  /*
2211  * Bitmap of supported protocols for probe response offloading
2212  * see &enum nl80211_probe_resp_offload_support_attr. Only valid
2213  * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
2214  */
2216 
2217  /* If multiple wiphys are registered and you're handed e.g.
2218  * a regular netdev with assigned ieee80211_ptr, you won't
2219  * know whether it points to a wiphy your driver has registered
2220  * or not. Assign this to something global to your driver to
2221  * help determine whether you own this wiphy or not. */
2222  const void *privid;
2223 
2225 
2226  /* Lets us get back the wiphy on the callback */
2228  struct regulatory_request *request);
2229 
2230  /* fields below are read-only, assigned by cfg80211 */
2231 
2232  const struct ieee80211_regdomain *regd;
2233 
2234  /* the item in /sys/class/ieee80211/ points to this,
2235  * you need use set_wiphy_dev() (see below) */
2236  struct device dev;
2237 
2238  /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2240 
2241  /* dir in debugfs: ieee80211/<wiphyname> */
2243 
2245 
2246 #ifdef CONFIG_NET_NS
2247  /* the network namespace this phy lives in currently */
2248  struct net *_net;
2249 #endif
2250 
2251 #ifdef CONFIG_CFG80211_WEXT
2252  const struct iw_handler_def *wext;
2253 #endif
2254 
2255  char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
2256 };
2257 
2258 static inline struct net *wiphy_net(struct wiphy *wiphy)
2259 {
2260  return read_pnet(&wiphy->_net);
2261 }
2262 
2263 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2264 {
2265  write_pnet(&wiphy->_net, net);
2266 }
2267 
2273 static inline void *wiphy_priv(struct wiphy *wiphy)
2274 {
2275  BUG_ON(!wiphy);
2276  return &wiphy->priv;
2277 }
2278 
2284 static inline struct wiphy *priv_to_wiphy(void *priv)
2285 {
2286  BUG_ON(!priv);
2287  return container_of(priv, struct wiphy, priv);
2288 }
2289 
2296 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2297 {
2298  wiphy->dev.parent = dev;
2299 }
2300 
2306 static inline struct device *wiphy_dev(struct wiphy *wiphy)
2307 {
2308  return wiphy->dev.parent;
2309 }
2310 
2316 static inline const char *wiphy_name(const struct wiphy *wiphy)
2317 {
2318  return dev_name(&wiphy->dev);
2319 }
2320 
2333 struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2334 
2342 extern int wiphy_register(struct wiphy *wiphy);
2343 
2353 extern void wiphy_unregister(struct wiphy *wiphy);
2354 
2360 extern void wiphy_free(struct wiphy *wiphy);
2361 
2362 /* internal structs */
2363 struct cfg80211_conn;
2364 struct cfg80211_internal_bss;
2365 struct cfg80211_cached_keys;
2366 
2413  struct wiphy *wiphy;
2415 
2416  /* the remainder of this struct should be private to cfg80211 */
2417  struct list_head list;
2419 
2421 
2424 
2425  struct mutex mtx;
2426 
2428 
2430 
2431  u8 address[ETH_ALEN] __aligned(sizeof(u16));
2432 
2433  /* currently used for IBSS and SME - might be rearranged later */
2436  enum {
2440  } sme_state;
2443 
2446 
2447  struct cfg80211_internal_bss *current_bss; /* associated / joined */
2450 
2451  /* for AP and mesh channel tracking */
2453 
2455 
2456  bool ps;
2458 
2460 
2462 
2463 #ifdef CONFIG_CFG80211_WEXT
2464  /* wext data */
2465  struct {
2466  struct cfg80211_ibss_params ibss;
2467  struct cfg80211_connect_params connect;
2468  struct cfg80211_cached_keys *keys;
2469  u8 *ie;
2470  size_t ie_len;
2471  u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
2473  s8 default_key, default_mgmt_key;
2474  bool prev_bssid_valid;
2475  } wext;
2476 #endif
2477 };
2478 
2479 static inline u8 *wdev_address(struct wireless_dev *wdev)
2480 {
2481  if (wdev->netdev)
2482  return wdev->netdev->dev_addr;
2483  return wdev->address;
2484 }
2485 
2491 static inline void *wdev_priv(struct wireless_dev *wdev)
2492 {
2493  BUG_ON(!wdev);
2494  return wiphy_priv(wdev->wiphy);
2495 }
2496 
2508 extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2509 
2514 extern int ieee80211_frequency_to_channel(int freq);
2515 
2516 /*
2517  * Name indirection necessary because the ieee80211 code also has
2518  * a function named "ieee80211_get_channel", so if you include
2519  * cfg80211's header file you get cfg80211's version, if you try
2520  * to include both header files you'll (rightfully!) get a symbol
2521  * clash.
2522  */
2523 extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2524  int freq);
2530 static inline struct ieee80211_channel *
2531 ieee80211_get_channel(struct wiphy *wiphy, int freq)
2532 {
2533  return __ieee80211_get_channel(wiphy, freq);
2534 }
2535 
2548 struct ieee80211_rate *
2550  u32 basic_rates, int bitrate);
2551 
2552 /*
2553  * Radiotap parsing functions -- for controlled injection support
2554  *
2555  * Implemented in net/wireless/radiotap.c
2556  * Documentation in Documentation/networking/radiotap-headers.txt
2557  */
2558 
2561 };
2562 
2565  int n_bits;
2568 };
2569 
2572  int n_ns;
2573 };
2574 
2608 
2609  unsigned char *_arg, *_next_ns_data;
2611 
2612  unsigned char *this_arg;
2615 
2617 
2622 };
2623 
2625  struct ieee80211_radiotap_iterator *iterator,
2626  struct ieee80211_radiotap_header *radiotap_header,
2627  int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
2628 
2630  struct ieee80211_radiotap_iterator *iterator);
2631 
2632 
2633 extern const unsigned char rfc1042_header[6];
2634 extern const unsigned char bridge_tunnel_header[6];
2635 
2646 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2647 
2653 
2661 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
2662 
2677 int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2678  enum nl80211_iftype iftype);
2679 
2688 int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2689  enum nl80211_iftype iftype, u8 *bssid, bool qos);
2690 
2706 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2707  const u8 *addr, enum nl80211_iftype iftype,
2708  const unsigned int extra_headroom,
2709  bool has_80211_header);
2710 
2715 unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2716 
2731 const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2732 
2748 const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
2749  const u8 *ies, int len);
2750 
2780 extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2781 
2794 extern void wiphy_apply_custom_regulatory(
2795  struct wiphy *wiphy,
2796  const struct ieee80211_regdomain *regd);
2797 
2820 extern int freq_reg_info(struct wiphy *wiphy,
2821  u32 center_freq,
2822  u32 desired_bw_khz,
2823  const struct ieee80211_reg_rule **reg_rule);
2824 
2825 /*
2826  * callbacks for asynchronous cfg80211 methods, notification
2827  * functions and BSS handling helpers
2828  */
2829 
2838 
2845 
2856 
2872 struct cfg80211_bss * __must_check
2874  struct ieee80211_channel *channel,
2875  struct ieee80211_mgmt *mgmt, size_t len,
2876  s32 signal, gfp_t gfp);
2877 
2897 struct cfg80211_bss * __must_check
2899  struct ieee80211_channel *channel,
2900  const u8 *bssid, u64 tsf, u16 capability,
2901  u16 beacon_interval, const u8 *ie, size_t ielen,
2902  s32 signal, gfp_t gfp);
2903 
2904 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
2905  struct ieee80211_channel *channel,
2906  const u8 *bssid,
2907  const u8 *ssid, size_t ssid_len,
2908  u16 capa_mask, u16 capa_val);
2909 static inline struct cfg80211_bss *
2910 cfg80211_get_ibss(struct wiphy *wiphy,
2911  struct ieee80211_channel *channel,
2912  const u8 *ssid, size_t ssid_len)
2913 {
2914  return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
2916 }
2917 
2918 struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
2919  struct ieee80211_channel *channel,
2920  const u8 *meshid, size_t meshidlen,
2921  const u8 *meshcfg);
2928 void cfg80211_ref_bss(struct cfg80211_bss *bss);
2929 
2936 void cfg80211_put_bss(struct cfg80211_bss *bss);
2937 
2948 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
2949 
2961 void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
2962 
2970 void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
2971 
2985 void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
2986  const u8 *buf, size_t len);
2987 
2995 void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
2996 
3007 void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3008 
3017 void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3018 
3029 void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
3030 
3039 void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
3040  size_t len);
3041 
3052 void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
3053  size_t len);
3054 
3065 void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
3066  size_t len);
3067 
3081 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3082  enum nl80211_key_type key_type, int key_id,
3083  const u8 *tsc, gfp_t gfp);
3084 
3099 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
3100 
3115  const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3116 
3136 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
3137 
3142 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
3143 
3148 void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
3149 
3150 #ifdef CONFIG_NL80211_TESTMODE
3151 
3183 struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3184  int approxlen);
3185 
3197 int cfg80211_testmode_reply(struct sk_buff *skb);
3198 
3218 struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3219  int approxlen, gfp_t gfp);
3220 
3231 void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3232 
3233 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
3234 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
3235 #else
3236 #define CFG80211_TESTMODE_CMD(cmd)
3237 #define CFG80211_TESTMODE_DUMP(cmd)
3238 #endif
3239 
3257 void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3258  const u8 *req_ie, size_t req_ie_len,
3259  const u8 *resp_ie, size_t resp_ie_len,
3260  u16 status, gfp_t gfp);
3261 
3277 void cfg80211_roamed(struct net_device *dev,
3278  struct ieee80211_channel *channel,
3279  const u8 *bssid,
3280  const u8 *req_ie, size_t req_ie_len,
3281  const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3282 
3305 void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3306  const u8 *req_ie, size_t req_ie_len,
3307  const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3308 
3322  u8 *ie, size_t ie_len, gfp_t gfp);
3323 
3335  struct ieee80211_channel *chan,
3337  unsigned int duration, gfp_t gfp);
3338 
3348  struct ieee80211_channel *chan,
3350  gfp_t gfp);
3351 
3352 
3361 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
3362  struct station_info *sinfo, gfp_t gfp);
3363 
3371 void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3372 
3388 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
3390  gfp_t gfp);
3391 
3409 bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3410  const u8 *buf, size_t len, gfp_t gfp);
3411 
3425 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
3426  const u8 *buf, size_t len, bool ack, gfp_t gfp);
3427 
3428 
3439  enum nl80211_cqm_rssi_threshold_event rssi_event,
3440  gfp_t gfp);
3441 
3452  const u8 *peer, u32 num_packets, gfp_t gfp);
3453 
3466 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
3467  u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
3468 
3476 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3477  const u8 *replay_ctr, gfp_t gfp);
3478 
3488  const u8 *bssid, bool preauth, gfp_t gfp);
3489 
3503  const u8 *addr, gfp_t gfp);
3504 
3519  const u8 *addr, gfp_t gfp);
3520 
3529 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3530  u64 cookie, bool acked, gfp_t gfp);
3531 
3546  const u8 *frame, size_t len,
3547  int freq, int sig_dbm, gfp_t gfp);
3548 
3559  struct ieee80211_channel *chan,
3561 
3562 /*
3563  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
3564  * @dev: the device which switched channels
3565  * @freq: new channel frequency (in MHz)
3566  * @type: channel type
3567  *
3568  * Acquires wdev_lock, so must only be called from sleepable driver context!
3569  */
3570 void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
3571  enum nl80211_channel_type type);
3572 
3573 /*
3574  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3575  * @rate: given rate_info to calculate bitrate from
3576  *
3577  * return 0 if MCS index >= 32
3578  */
3580 
3595 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
3596 
3597 /* Logging, debugging and troubleshooting/diagnostic helpers. */
3598 
3599 /* wiphy_printk helpers, similar to dev_printk */
3600 
3601 #define wiphy_printk(level, wiphy, format, args...) \
3602  dev_printk(level, &(wiphy)->dev, format, ##args)
3603 #define wiphy_emerg(wiphy, format, args...) \
3604  dev_emerg(&(wiphy)->dev, format, ##args)
3605 #define wiphy_alert(wiphy, format, args...) \
3606  dev_alert(&(wiphy)->dev, format, ##args)
3607 #define wiphy_crit(wiphy, format, args...) \
3608  dev_crit(&(wiphy)->dev, format, ##args)
3609 #define wiphy_err(wiphy, format, args...) \
3610  dev_err(&(wiphy)->dev, format, ##args)
3611 #define wiphy_warn(wiphy, format, args...) \
3612  dev_warn(&(wiphy)->dev, format, ##args)
3613 #define wiphy_notice(wiphy, format, args...) \
3614  dev_notice(&(wiphy)->dev, format, ##args)
3615 #define wiphy_info(wiphy, format, args...) \
3616  dev_info(&(wiphy)->dev, format, ##args)
3617 
3618 #define wiphy_debug(wiphy, format, args...) \
3619  wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
3620 
3621 #define wiphy_dbg(wiphy, format, args...) \
3622  dev_dbg(&(wiphy)->dev, format, ##args)
3623 
3624 #if defined(VERBOSE_DEBUG)
3625 #define wiphy_vdbg wiphy_dbg
3626 #else
3627 #define wiphy_vdbg(wiphy, format, args...) \
3628 ({ \
3629  if (0) \
3630  wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
3631  0; \
3632 })
3633 #endif
3634 
3635 /*
3636  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
3637  * of using a WARN/WARN_ON to get the message out, including the
3638  * file/line information and a backtrace.
3639  */
3640 #define wiphy_WARN(wiphy, format, args...) \
3641  WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
3642 
3643 #endif /* __NET_CFG80211_H */