aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/cfg80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r--include/net/cfg80211.h296
1 files changed, 227 insertions, 69 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 2fd06c60ffbb..2a7936d7851d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -25,6 +25,43 @@
25#include <linux/wireless.h> 25#include <linux/wireless.h>
26 26
27 27
28/**
29 * DOC: Introduction
30 *
31 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32 * userspace and drivers, and offers some utility functionality associated
33 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34 * by all modern wireless drivers in Linux, so that they offer a consistent
35 * API through nl80211. For backward compatibility, cfg80211 also offers
36 * wireless extensions to userspace, but hides them from drivers completely.
37 *
38 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
39 * use restrictions.
40 */
41
42
43/**
44 * DOC: Device registration
45 *
46 * In order for a driver to use cfg80211, it must register the hardware device
47 * with cfg80211. This happens through a number of hardware capability structs
48 * described below.
49 *
50 * The fundamental structure for each device is the 'wiphy', of which each
51 * instance describes a physical wireless device connected to the system. Each
52 * such wiphy can have zero, one, or many virtual interfaces associated with
53 * it, which need to be identified as such by pointing the network interface's
54 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55 * the wireless part of the interface, normally this struct is embedded in the
56 * network interface's private data area. Drivers can optionally allow creating
57 * or destroying virtual interfaces on the fly, but without at least one or the
58 * ability to create some the wireless device isn't useful.
59 *
60 * Each wiphy structure contains device capability information, and also has
61 * a pointer to the various operations the driver offers. The definitions and
62 * structures here describe these capabilities in detail.
63 */
64
28/* 65/*
29 * wireless hardware capability structures 66 * wireless hardware capability structures
30 */ 67 */
@@ -205,6 +242,21 @@ struct ieee80211_supported_band {
205 */ 242 */
206 243
207/** 244/**
245 * DOC: Actions and configuration
246 *
247 * Each wireless device and each virtual interface offer a set of configuration
248 * operations and other actions that are invoked by userspace. Each of these
249 * actions is described in the operations structure, and the parameters these
250 * operations use are described separately.
251 *
252 * Additionally, some operations are asynchronous and expect to get status
253 * information via some functions that drivers need to call.
254 *
255 * Scanning and BSS list handling with its associated functionality is described
256 * in a separate chapter.
257 */
258
259/**
208 * struct vif_params - describes virtual interface parameters 260 * struct vif_params - describes virtual interface parameters
209 * @mesh_id: mesh ID to use 261 * @mesh_id: mesh ID to use
210 * @mesh_id_len: length of the mesh ID 262 * @mesh_id_len: length of the mesh ID
@@ -241,12 +293,24 @@ struct key_params {
241 * enum survey_info_flags - survey information flags 293 * enum survey_info_flags - survey information flags
242 * 294 *
243 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 295 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
296 * @SURVEY_INFO_IN_USE: channel is currently being used
297 * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
298 * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
299 * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
300 * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
301 * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
244 * 302 *
245 * Used by the driver to indicate which info in &struct survey_info 303 * Used by the driver to indicate which info in &struct survey_info
246 * it has filled in during the get_survey(). 304 * it has filled in during the get_survey().
247 */ 305 */
248enum survey_info_flags { 306enum survey_info_flags {
249 SURVEY_INFO_NOISE_DBM = 1<<0, 307 SURVEY_INFO_NOISE_DBM = 1<<0,
308 SURVEY_INFO_IN_USE = 1<<1,
309 SURVEY_INFO_CHANNEL_TIME = 1<<2,
310 SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
311 SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
312 SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
313 SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
250}; 314};
251 315
252/** 316/**
@@ -256,6 +320,11 @@ enum survey_info_flags {
256 * @filled: bitflag of flags from &enum survey_info_flags 320 * @filled: bitflag of flags from &enum survey_info_flags
257 * @noise: channel noise in dBm. This and all following fields are 321 * @noise: channel noise in dBm. This and all following fields are
258 * optional 322 * optional
323 * @channel_time: amount of time in ms the radio spent on the channel
324 * @channel_time_busy: amount of time the primary channel was sensed busy
325 * @channel_time_ext_busy: amount of time the extension channel was sensed busy
326 * @channel_time_rx: amount of time the radio spent receiving data
327 * @channel_time_tx: amount of time the radio spent transmitting data
259 * 328 *
260 * Used by dump_survey() to report back per-channel survey information. 329 * Used by dump_survey() to report back per-channel survey information.
261 * 330 *
@@ -264,6 +333,11 @@ enum survey_info_flags {
264 */ 333 */
265struct survey_info { 334struct survey_info {
266 struct ieee80211_channel *channel; 335 struct ieee80211_channel *channel;
336 u64 channel_time;
337 u64 channel_time_busy;
338 u64 channel_time_ext_busy;
339 u64 channel_time_rx;
340 u64 channel_time_tx;
267 u32 filled; 341 u32 filled;
268 s8 noise; 342 s8 noise;
269}; 343};
@@ -347,6 +421,9 @@ struct station_parameters {
347 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 421 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
348 * @STATION_INFO_RX_PACKETS: @rx_packets filled 422 * @STATION_INFO_RX_PACKETS: @rx_packets filled
349 * @STATION_INFO_TX_PACKETS: @tx_packets filled 423 * @STATION_INFO_TX_PACKETS: @tx_packets filled
424 * @STATION_INFO_TX_RETRIES: @tx_retries filled
425 * @STATION_INFO_TX_FAILED: @tx_failed filled
426 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
350 */ 427 */
351enum station_info_flags { 428enum station_info_flags {
352 STATION_INFO_INACTIVE_TIME = 1<<0, 429 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -359,6 +436,9 @@ enum station_info_flags {
359 STATION_INFO_TX_BITRATE = 1<<7, 436 STATION_INFO_TX_BITRATE = 1<<7,
360 STATION_INFO_RX_PACKETS = 1<<8, 437 STATION_INFO_RX_PACKETS = 1<<8,
361 STATION_INFO_TX_PACKETS = 1<<9, 438 STATION_INFO_TX_PACKETS = 1<<9,
439 STATION_INFO_TX_RETRIES = 1<<10,
440 STATION_INFO_TX_FAILED = 1<<11,
441 STATION_INFO_RX_DROP_MISC = 1<<12,
362}; 442};
363 443
364/** 444/**
@@ -408,6 +488,9 @@ struct rate_info {
408 * @txrate: current unicast bitrate to this station 488 * @txrate: current unicast bitrate to this station
409 * @rx_packets: packets received from this station 489 * @rx_packets: packets received from this station
410 * @tx_packets: packets transmitted to this station 490 * @tx_packets: packets transmitted to this station
491 * @tx_retries: cumulative retry counts
492 * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
493 * @rx_dropped_misc: Dropped for un-specified reason.
411 * @generation: generation number for nl80211 dumps. 494 * @generation: generation number for nl80211 dumps.
412 * This number should increase every time the list of stations 495 * This number should increase every time the list of stations
413 * changes, i.e. when a station is added or removed, so that 496 * changes, i.e. when a station is added or removed, so that
@@ -425,6 +508,9 @@ struct station_info {
425 struct rate_info txrate; 508 struct rate_info txrate;
426 u32 rx_packets; 509 u32 rx_packets;
427 u32 tx_packets; 510 u32 tx_packets;
511 u32 tx_retries;
512 u32 tx_failed;
513 u32 rx_dropped_misc;
428 514
429 int generation; 515 int generation;
430}; 516};
@@ -570,8 +656,28 @@ struct ieee80211_txq_params {
570/* from net/wireless.h */ 656/* from net/wireless.h */
571struct wiphy; 657struct wiphy;
572 658
573/* from net/ieee80211.h */ 659/**
574struct ieee80211_channel; 660 * DOC: Scanning and BSS list handling
661 *
662 * The scanning process itself is fairly simple, but cfg80211 offers quite
663 * a bit of helper functionality. To start a scan, the scan operation will
664 * be invoked with a scan definition. This scan definition contains the
665 * channels to scan, and the SSIDs to send probe requests for (including the
666 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
667 * probe. Additionally, a scan request may contain extra information elements
668 * that should be added to the probe request. The IEs are guaranteed to be
669 * well-formed, and will not exceed the maximum length the driver advertised
670 * in the wiphy structure.
671 *
672 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
673 * it is responsible for maintaining the BSS list; the driver should not
674 * maintain a list itself. For this notification, various functions exist.
675 *
676 * Since drivers do not maintain a BSS list, there are also a number of
677 * functions to search for a BSS and obtain information about it from the
678 * BSS structure cfg80211 maintains. The BSS list is also made available
679 * to userspace.
680 */
575 681
576/** 682/**
577 * struct cfg80211_ssid - SSID description 683 * struct cfg80211_ssid - SSID description
@@ -691,6 +797,10 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
691 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 797 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
692 * required to assume that the port is unauthorized until authorized by 798 * required to assume that the port is unauthorized until authorized by
693 * user space. Otherwise, port is marked authorized by default. 799 * user space. Otherwise, port is marked authorized by default.
800 * @control_port_ethertype: the control port protocol that should be
801 * allowed through even on unauthorized ports
802 * @control_port_no_encrypt: TRUE to prevent encryption of control port
803 * protocol frames.
694 */ 804 */
695struct cfg80211_crypto_settings { 805struct cfg80211_crypto_settings {
696 u32 wpa_versions; 806 u32 wpa_versions;
@@ -700,6 +810,8 @@ struct cfg80211_crypto_settings {
700 int n_akm_suites; 810 int n_akm_suites;
701 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 811 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
702 bool control_port; 812 bool control_port;
813 __be16 control_port_ethertype;
814 bool control_port_no_encrypt;
703}; 815};
704 816
705/** 817/**
@@ -1020,7 +1132,7 @@ struct cfg80211_pmksa {
1020 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 1132 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
1021 * This allows the operation to be terminated prior to timeout based on 1133 * This allows the operation to be terminated prior to timeout based on
1022 * the duration value. 1134 * the duration value.
1023 * @action: Transmit an action frame 1135 * @mgmt_tx: Transmit a management frame
1024 * 1136 *
1025 * @testmode_cmd: run a test mode command 1137 * @testmode_cmd: run a test mode command
1026 * 1138 *
@@ -1035,6 +1147,9 @@ struct cfg80211_pmksa {
1035 * allows the driver to adjust the dynamic ps timeout value. 1147 * allows the driver to adjust the dynamic ps timeout value.
1036 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 1148 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1037 * 1149 *
1150 * @mgmt_frame_register: Notify driver that a management frame type was
1151 * registered. Note that this callback may not sleep, and cannot run
1152 * concurrently with itself.
1038 */ 1153 */
1039struct cfg80211_ops { 1154struct cfg80211_ops {
1040 int (*suspend)(struct wiphy *wiphy); 1155 int (*suspend)(struct wiphy *wiphy);
@@ -1050,13 +1165,14 @@ struct cfg80211_ops {
1050 struct vif_params *params); 1165 struct vif_params *params);
1051 1166
1052 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 1167 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1053 u8 key_index, const u8 *mac_addr, 1168 u8 key_index, bool pairwise, const u8 *mac_addr,
1054 struct key_params *params); 1169 struct key_params *params);
1055 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 1170 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1056 u8 key_index, const u8 *mac_addr, void *cookie, 1171 u8 key_index, bool pairwise, const u8 *mac_addr,
1172 void *cookie,
1057 void (*callback)(void *cookie, struct key_params*)); 1173 void (*callback)(void *cookie, struct key_params*));
1058 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 1174 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1059 u8 key_index, const u8 *mac_addr); 1175 u8 key_index, bool pairwise, const u8 *mac_addr);
1060 int (*set_default_key)(struct wiphy *wiphy, 1176 int (*set_default_key)(struct wiphy *wiphy,
1061 struct net_device *netdev, 1177 struct net_device *netdev,
1062 u8 key_index); 1178 u8 key_index);
@@ -1140,7 +1256,7 @@ struct cfg80211_ops {
1140 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1256 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
1141 1257
1142 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1258 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1143 u8 *addr); 1259 const u8 *addr);
1144 1260
1145 void (*rfkill_poll)(struct wiphy *wiphy); 1261 void (*rfkill_poll)(struct wiphy *wiphy);
1146 1262
@@ -1172,7 +1288,7 @@ struct cfg80211_ops {
1172 struct net_device *dev, 1288 struct net_device *dev,
1173 u64 cookie); 1289 u64 cookie);
1174 1290
1175 int (*action)(struct wiphy *wiphy, struct net_device *dev, 1291 int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev,
1176 struct ieee80211_channel *chan, 1292 struct ieee80211_channel *chan,
1177 enum nl80211_channel_type channel_type, 1293 enum nl80211_channel_type channel_type,
1178 bool channel_type_valid, 1294 bool channel_type_valid,
@@ -1184,6 +1300,10 @@ struct cfg80211_ops {
1184 int (*set_cqm_rssi_config)(struct wiphy *wiphy, 1300 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
1185 struct net_device *dev, 1301 struct net_device *dev,
1186 s32 rssi_thold, u32 rssi_hyst); 1302 s32 rssi_thold, u32 rssi_hyst);
1303
1304 void (*mgmt_frame_register)(struct wiphy *wiphy,
1305 struct net_device *dev,
1306 u16 frame_type, bool reg);
1187}; 1307};
1188 1308
1189/* 1309/*
@@ -1221,21 +1341,31 @@ struct cfg80211_ops {
1221 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 1341 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
1222 * on a VLAN interface) 1342 * on a VLAN interface)
1223 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 1343 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
1344 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
1345 * control port protocol ethertype. The device also honours the
1346 * control_port_no_encrypt flag.
1347 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
1224 */ 1348 */
1225enum wiphy_flags { 1349enum wiphy_flags {
1226 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 1350 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),
1227 WIPHY_FLAG_STRICT_REGULATORY = BIT(1), 1351 WIPHY_FLAG_STRICT_REGULATORY = BIT(1),
1228 WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), 1352 WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2),
1229 WIPHY_FLAG_NETNS_OK = BIT(3), 1353 WIPHY_FLAG_NETNS_OK = BIT(3),
1230 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 1354 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
1231 WIPHY_FLAG_4ADDR_AP = BIT(5), 1355 WIPHY_FLAG_4ADDR_AP = BIT(5),
1232 WIPHY_FLAG_4ADDR_STATION = BIT(6), 1356 WIPHY_FLAG_4ADDR_STATION = BIT(6),
1357 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
1358 WIPHY_FLAG_IBSS_RSN = BIT(7),
1233}; 1359};
1234 1360
1235struct mac_address { 1361struct mac_address {
1236 u8 addr[ETH_ALEN]; 1362 u8 addr[ETH_ALEN];
1237}; 1363};
1238 1364
1365struct ieee80211_txrx_stypes {
1366 u16 tx, rx;
1367};
1368
1239/** 1369/**
1240 * struct wiphy - wireless hardware description 1370 * struct wiphy - wireless hardware description
1241 * @reg_notifier: the driver's regulatory notification callback 1371 * @reg_notifier: the driver's regulatory notification callback
@@ -1286,6 +1416,10 @@ struct mac_address {
1286 * @privid: a pointer that drivers can use to identify if an arbitrary 1416 * @privid: a pointer that drivers can use to identify if an arbitrary
1287 * wiphy is theirs, e.g. in global notifiers 1417 * wiphy is theirs, e.g. in global notifiers
1288 * @bands: information about bands/channels supported by this device 1418 * @bands: information about bands/channels supported by this device
1419 *
1420 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
1421 * transmitted through nl80211, points to an array indexed by interface
1422 * type
1289 */ 1423 */
1290struct wiphy { 1424struct wiphy {
1291 /* assign these fields before you register the wiphy */ 1425 /* assign these fields before you register the wiphy */
@@ -1294,9 +1428,12 @@ struct wiphy {
1294 u8 perm_addr[ETH_ALEN]; 1428 u8 perm_addr[ETH_ALEN];
1295 u8 addr_mask[ETH_ALEN]; 1429 u8 addr_mask[ETH_ALEN];
1296 1430
1297 u16 n_addresses;
1298 struct mac_address *addresses; 1431 struct mac_address *addresses;
1299 1432
1433 const struct ieee80211_txrx_stypes *mgmt_stypes;
1434
1435 u16 n_addresses;
1436
1300 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1437 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1301 u16 interface_modes; 1438 u16 interface_modes;
1302 1439
@@ -1492,8 +1629,8 @@ struct cfg80211_cached_keys;
1492 * set by driver (if supported) on add_interface BEFORE registering the 1629 * set by driver (if supported) on add_interface BEFORE registering the
1493 * netdev and may otherwise be used by driver read-only, will be update 1630 * netdev and may otherwise be used by driver read-only, will be update
1494 * by cfg80211 on change_interface 1631 * by cfg80211 on change_interface
1495 * @action_registrations: list of registrations for action frames 1632 * @mgmt_registrations: list of registrations for management frames
1496 * @action_registrations_lock: lock for the list 1633 * @mgmt_registrations_lock: lock for the list
1497 * @mtx: mutex used to lock data in this struct 1634 * @mtx: mutex used to lock data in this struct
1498 * @cleanup_work: work struct used for cleanup that can't be done directly 1635 * @cleanup_work: work struct used for cleanup that can't be done directly
1499 */ 1636 */
@@ -1505,8 +1642,8 @@ struct wireless_dev {
1505 struct list_head list; 1642 struct list_head list;
1506 struct net_device *netdev; 1643 struct net_device *netdev;
1507 1644
1508 struct list_head action_registrations; 1645 struct list_head mgmt_registrations;
1509 spinlock_t action_registrations_lock; 1646 spinlock_t mgmt_registrations_lock;
1510 1647
1511 struct mutex mtx; 1648 struct mutex mtx;
1512 1649
@@ -1563,8 +1700,10 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
1563 return wiphy_priv(wdev->wiphy); 1700 return wiphy_priv(wdev->wiphy);
1564} 1701}
1565 1702
1566/* 1703/**
1567 * Utility functions 1704 * DOC: Utility functions
1705 *
1706 * cfg80211 offers a number of utility functions that can be useful.
1568 */ 1707 */
1569 1708
1570/** 1709/**
@@ -1715,7 +1854,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1715 * ieee80211_hdrlen - get header length in bytes from frame control 1854 * ieee80211_hdrlen - get header length in bytes from frame control
1716 * @fc: frame control field in little-endian format 1855 * @fc: frame control field in little-endian format
1717 */ 1856 */
1718unsigned int ieee80211_hdrlen(__le16 fc); 1857unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
1858
1859/**
1860 * DOC: Data path helpers
1861 *
1862 * In addition to generic utilities, cfg80211 also offers
1863 * functions that help implement the data path for devices
1864 * that do not do the 802.11/802.3 conversion on the device.
1865 */
1719 1866
1720/** 1867/**
1721 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 1868 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
@@ -1777,8 +1924,10 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1777 */ 1924 */
1778const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 1925const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
1779 1926
1780/* 1927/**
1781 * Regulatory helper functions for wiphys 1928 * DOC: Regulatory enforcement infrastructure
1929 *
1930 * TODO
1782 */ 1931 */
1783 1932
1784/** 1933/**
@@ -2181,6 +2330,20 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
2181void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 2330void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
2182 2331
2183/** 2332/**
2333 * DOC: RFkill integration
2334 *
2335 * RFkill integration in cfg80211 is almost invisible to drivers,
2336 * as cfg80211 automatically registers an rfkill instance for each
2337 * wireless device it knows about. Soft kill is also translated
2338 * into disconnecting and turning all interfaces off, drivers are
2339 * expected to turn off the device when all interfaces are down.
2340 *
2341 * However, devices may have a hard RFkill line, in which case they
2342 * also need to interact with the rfkill subsystem, via cfg80211.
2343 * They can do this with a few helper functions documented here.
2344 */
2345
2346/**
2184 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 2347 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
2185 * @wiphy: the wiphy 2348 * @wiphy: the wiphy
2186 * @blocked: block status 2349 * @blocked: block status
@@ -2201,6 +2364,17 @@ void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
2201 2364
2202#ifdef CONFIG_NL80211_TESTMODE 2365#ifdef CONFIG_NL80211_TESTMODE
2203/** 2366/**
2367 * DOC: Test mode
2368 *
2369 * Test mode is a set of utility functions to allow drivers to
2370 * interact with driver-specific tools to aid, for instance,
2371 * factory programming.
2372 *
2373 * This chapter describes how drivers interact with it, for more
2374 * information see the nl80211 book's chapter on it.
2375 */
2376
2377/**
2204 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 2378 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
2205 * @wiphy: the wiphy 2379 * @wiphy: the wiphy
2206 * @approxlen: an upper bound of the length of the data that will 2380 * @approxlen: an upper bound of the length of the data that will
@@ -2373,38 +2547,39 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
2373 struct station_info *sinfo, gfp_t gfp); 2547 struct station_info *sinfo, gfp_t gfp);
2374 2548
2375/** 2549/**
2376 * cfg80211_rx_action - notification of received, unprocessed Action frame 2550 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
2377 * @dev: network device 2551 * @dev: network device
2378 * @freq: Frequency on which the frame was received in MHz 2552 * @freq: Frequency on which the frame was received in MHz
2379 * @buf: Action frame (header + body) 2553 * @buf: Management frame (header + body)
2380 * @len: length of the frame data 2554 * @len: length of the frame data
2381 * @gfp: context flags 2555 * @gfp: context flags
2382 * Returns %true if a user space application is responsible for rejecting the 2556 *
2383 * unrecognized Action frame; %false if no such application is registered 2557 * Returns %true if a user space application has registered for this frame.
2384 * (i.e., the driver is responsible for rejecting the unrecognized Action 2558 * For action frames, that makes it responsible for rejecting unrecognized
2385 * frame) 2559 * action frames; %false otherwise, in which case for action frames the
2560 * driver is responsible for rejecting the frame.
2386 * 2561 *
2387 * This function is called whenever an Action frame is received for a station 2562 * This function is called whenever an Action frame is received for a station
2388 * mode interface, but is not processed in kernel. 2563 * mode interface, but is not processed in kernel.
2389 */ 2564 */
2390bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, 2565bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
2391 size_t len, gfp_t gfp); 2566 size_t len, gfp_t gfp);
2392 2567
2393/** 2568/**
2394 * cfg80211_action_tx_status - notification of TX status for Action frame 2569 * cfg80211_mgmt_tx_status - notification of TX status for management frame
2395 * @dev: network device 2570 * @dev: network device
2396 * @cookie: Cookie returned by cfg80211_ops::action() 2571 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
2397 * @buf: Action frame (header + body) 2572 * @buf: Management frame (header + body)
2398 * @len: length of the frame data 2573 * @len: length of the frame data
2399 * @ack: Whether frame was acknowledged 2574 * @ack: Whether frame was acknowledged
2400 * @gfp: context flags 2575 * @gfp: context flags
2401 * 2576 *
2402 * This function is called whenever an Action frame was requested to be 2577 * This function is called whenever a management frame was requested to be
2403 * transmitted with cfg80211_ops::action() to report the TX status of the 2578 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
2404 * transmission attempt. 2579 * transmission attempt.
2405 */ 2580 */
2406void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, 2581void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie,
2407 const u8 *buf, size_t len, bool ack, gfp_t gfp); 2582 const u8 *buf, size_t len, bool ack, gfp_t gfp);
2408 2583
2409 2584
2410/** 2585/**
@@ -2420,56 +2595,41 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
2420 enum nl80211_cqm_rssi_threshold_event rssi_event, 2595 enum nl80211_cqm_rssi_threshold_event rssi_event,
2421 gfp_t gfp); 2596 gfp_t gfp);
2422 2597
2423#ifdef __KERNEL__
2424
2425/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2598/* Logging, debugging and troubleshooting/diagnostic helpers. */
2426 2599
2427/* wiphy_printk helpers, similar to dev_printk */ 2600/* wiphy_printk helpers, similar to dev_printk */
2428 2601
2429#define wiphy_printk(level, wiphy, format, args...) \ 2602#define wiphy_printk(level, wiphy, format, args...) \
2430 printk(level "%s: " format, wiphy_name(wiphy), ##args) 2603 dev_printk(level, &(wiphy)->dev, format, ##args)
2431#define wiphy_emerg(wiphy, format, args...) \ 2604#define wiphy_emerg(wiphy, format, args...) \
2432 wiphy_printk(KERN_EMERG, wiphy, format, ##args) 2605 dev_emerg(&(wiphy)->dev, format, ##args)
2433#define wiphy_alert(wiphy, format, args...) \ 2606#define wiphy_alert(wiphy, format, args...) \
2434 wiphy_printk(KERN_ALERT, wiphy, format, ##args) 2607 dev_alert(&(wiphy)->dev, format, ##args)
2435#define wiphy_crit(wiphy, format, args...) \ 2608#define wiphy_crit(wiphy, format, args...) \
2436 wiphy_printk(KERN_CRIT, wiphy, format, ##args) 2609 dev_crit(&(wiphy)->dev, format, ##args)
2437#define wiphy_err(wiphy, format, args...) \ 2610#define wiphy_err(wiphy, format, args...) \
2438 wiphy_printk(KERN_ERR, wiphy, format, ##args) 2611 dev_err(&(wiphy)->dev, format, ##args)
2439#define wiphy_warn(wiphy, format, args...) \ 2612#define wiphy_warn(wiphy, format, args...) \
2440 wiphy_printk(KERN_WARNING, wiphy, format, ##args) 2613 dev_warn(&(wiphy)->dev, format, ##args)
2441#define wiphy_notice(wiphy, format, args...) \ 2614#define wiphy_notice(wiphy, format, args...) \
2442 wiphy_printk(KERN_NOTICE, wiphy, format, ##args) 2615 dev_notice(&(wiphy)->dev, format, ##args)
2443#define wiphy_info(wiphy, format, args...) \ 2616#define wiphy_info(wiphy, format, args...) \
2444 wiphy_printk(KERN_INFO, wiphy, format, ##args) 2617 dev_info(&(wiphy)->dev, format, ##args)
2445 2618
2446int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) 2619#define wiphy_debug(wiphy, format, args...) \
2447 __attribute__ ((format (printf, 2, 3)));
2448
2449#if defined(DEBUG)
2450#define wiphy_dbg(wiphy, format, args...) \
2451 wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 2620 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
2452#elif defined(CONFIG_DYNAMIC_DEBUG) 2621
2453#define wiphy_dbg(wiphy, format, args...) \ 2622#define wiphy_dbg(wiphy, format, args...) \
2454 dynamic_pr_debug("%s: " format, wiphy_name(wiphy), ##args) 2623 dev_dbg(&(wiphy)->dev, format, ##args)
2455#else
2456#define wiphy_dbg(wiphy, format, args...) \
2457({ \
2458 if (0) \
2459 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
2460 0; \
2461})
2462#endif
2463 2624
2464#if defined(VERBOSE_DEBUG) 2625#if defined(VERBOSE_DEBUG)
2465#define wiphy_vdbg wiphy_dbg 2626#define wiphy_vdbg wiphy_dbg
2466#else 2627#else
2467
2468#define wiphy_vdbg(wiphy, format, args...) \ 2628#define wiphy_vdbg(wiphy, format, args...) \
2469({ \ 2629({ \
2470 if (0) \ 2630 if (0) \
2471 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 2631 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
2472 0; \ 2632 0; \
2473}) 2633})
2474#endif 2634#endif
2475 2635
@@ -2481,6 +2641,4 @@ int wiphy_debug(const struct wiphy *wiphy, const char *format, ...)
2481#define wiphy_WARN(wiphy, format, args...) \ 2641#define wiphy_WARN(wiphy, format, args...) \
2482 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 2642 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
2483 2643
2484#endif
2485
2486#endif /* __NET_CFG80211_H */ 2644#endif /* __NET_CFG80211_H */