cfg80211: add firmware and hardware version to wiphy
[safe/jmp/linux-2.6] / include / net / cfg80211.h
index ca986cc..6f4862b 100644 (file)
@@ -80,7 +80,6 @@ enum ieee80211_channel_flags {
  * with cfg80211.
  *
  * @center_freq: center frequency in MHz
- * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
  * @hw_value: hardware-specific value for the channel
  * @flags: channel flags from &enum ieee80211_channel_flags.
  * @orig_flags: channel flags at registration time, used by regulatory
@@ -97,7 +96,6 @@ enum ieee80211_channel_flags {
 struct ieee80211_channel {
        enum ieee80211_band band;
        u16 center_freq;
-       u8 max_bandwidth;
        u16 hw_value;
        u32 flags;
        int max_antenna_gain;
@@ -372,6 +370,10 @@ struct rate_info {
  * @txrate: current unicast bitrate to this station
  * @rx_packets: packets received from this station
  * @tx_packets: packets transmitted to this station
+ * @generation: generation number for nl80211 dumps.
+ *     This number should increase every time the list of stations
+ *     changes, i.e. when a station is added or removed, so that
+ *     userspace can tell whether it got a consistent snapshot.
  */
 struct station_info {
        u32 filled;
@@ -385,6 +387,8 @@ struct station_info {
        struct rate_info txrate;
        u32 rx_packets;
        u32 tx_packets;
+
+       int generation;
 };
 
 /**
@@ -444,6 +448,10 @@ enum mpath_info_flags {
  * @flags: mesh path flags
  * @discovery_timeout: total mesh path discovery timeout, in msecs
  * @discovery_retries: mesh path discovery retries
+ * @generation: generation number for nl80211 dumps.
+ *     This number should increase every time the list of mesh paths
+ *     changes, i.e. when a station is added or removed, so that
+ *     userspace can tell whether it got a consistent snapshot.
  */
 struct mpath_info {
        u32 filled;
@@ -454,6 +462,8 @@ struct mpath_info {
        u32 discovery_timeout;
        u8 discovery_retries;
        u8 flags;
+
+       int generation;
 };
 
 /**
@@ -538,23 +548,26 @@ struct cfg80211_ssid {
  * @ssids: SSIDs to scan for (active scan only)
  * @n_ssids: number of SSIDs
  * @channels: channels to scan on.
- * @n_channels: number of channels for each band
+ * @n_channels: total number of channels to scan
  * @ie: optional information element(s) to add into Probe Request or %NULL
  * @ie_len: length of ie in octets
  * @wiphy: the wiphy this was for
- * @ifidx: the interface index
+ * @dev: the interface
  */
 struct cfg80211_scan_request {
        struct cfg80211_ssid *ssids;
        int n_ssids;
-       struct ieee80211_channel **channels;
        u32 n_channels;
        const u8 *ie;
        size_t ie_len;
 
        /* internal */
        struct wiphy *wiphy;
-       int ifidx;
+       struct net_device *dev;
+       bool aborted;
+
+       /* keep last */
+       struct ieee80211_channel *channels[0];
 };
 
 /**
@@ -646,12 +659,17 @@ struct cfg80211_crypto_settings {
  * @auth_type: Authentication type (algorithm)
  * @ie: Extra IEs to add to Authentication frame or %NULL
  * @ie_len: Length of ie buffer in octets
+ * @key_len: length of WEP key for shared key authentication
+ * @key_idx: index of WEP key for shared key authentication
+ * @key: WEP key for shared key authentication
  */
 struct cfg80211_auth_request {
        struct cfg80211_bss *bss;
        const u8 *ie;
        size_t ie_len;
        enum nl80211_auth_type auth_type;
+       const u8 *key;
+       u8 key_len, key_idx;
 };
 
 /**
@@ -664,10 +682,11 @@ struct cfg80211_auth_request {
  * @ie_len: Length of ie buffer in octets
  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
  * @crypto: crypto settings
+ * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
  */
 struct cfg80211_assoc_request {
        struct cfg80211_bss *bss;
-       const u8 *ie;
+       const u8 *ie, *prev_bssid;
        size_t ie_len;
        struct cfg80211_crypto_settings crypto;
        bool use_mfp;
@@ -725,6 +744,8 @@ struct cfg80211_disassoc_request {
  * @ie: information element(s) to include in the beacon
  * @ie_len: length of that
  * @beacon_interval: beacon interval to use
+ * @privacy: this is a protected network, keys will be configured
+ *     after joining
  */
 struct cfg80211_ibss_params {
        u8 *ssid;
@@ -734,6 +755,7 @@ struct cfg80211_ibss_params {
        u8 ssid_len, ie_len;
        u16 beacon_interval;
        bool channel_fixed;
+       bool privacy;
 };
 
 /**
@@ -753,6 +775,9 @@ struct cfg80211_ibss_params {
  * @assoc_ie_len: Length of assoc_ie in octets
  * @privacy: indicates whether privacy-enabled APs should be used
  * @crypto: crypto settings
+ * @key_len: length of WEP key for shared key authentication
+ * @key_idx: index of WEP key for shared key authentication
+ * @key: WEP key for shared key authentication
  */
 struct cfg80211_connect_params {
        struct ieee80211_channel *channel;
@@ -764,6 +789,8 @@ struct cfg80211_connect_params {
        size_t ie_len;
        bool privacy;
        struct cfg80211_crypto_settings crypto;
+       const u8 *key;
+       u8 key_len, key_idx;
 };
 
 /**
@@ -830,7 +857,8 @@ struct cfg80211_bitrate_mask {
  * @resume: wiphy device needs to be resumed
  *
  * @add_virtual_intf: create a new virtual interface with the given name,
- *     must set the struct wireless_dev's iftype.
+ *     must set the struct wireless_dev's iftype. Beware: You must create
+ *     the new netdev in the wiphy's network namespace!
  *
  * @del_virtual_intf: remove the virtual interface determined by ifindex.
  *
@@ -922,7 +950,7 @@ struct cfg80211_ops {
        int     (*add_virtual_intf)(struct wiphy *wiphy, char *name,
                                    enum nl80211_iftype type, u32 *flags,
                                    struct vif_params *params);
-       int     (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
+       int     (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);
        int     (*change_virtual_intf)(struct wiphy *wiphy,
                                       struct net_device *dev,
                                       enum nl80211_iftype type, u32 *flags,
@@ -997,9 +1025,11 @@ struct cfg80211_ops {
        int     (*assoc)(struct wiphy *wiphy, struct net_device *dev,
                         struct cfg80211_assoc_request *req);
        int     (*deauth)(struct wiphy *wiphy, struct net_device *dev,
-                         struct cfg80211_deauth_request *req);
+                         struct cfg80211_deauth_request *req,
+                         void *cookie);
        int     (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
-                           struct cfg80211_disassoc_request *req);
+                           struct cfg80211_disassoc_request *req,
+                           void *cookie);
 
        int     (*connect)(struct wiphy *wiphy, struct net_device *dev,
                           struct cfg80211_connect_params *sme);
@@ -1058,6 +1088,10 @@ struct cfg80211_ops {
  *     channels at a later time. This can be used for devices which do not
  *     have calibration information gauranteed for frequencies or settings
  *     outside of its regulatory domain.
+ * @disable_beacon_hints: enable this if your driver needs to ensure that
+ *     passive scan flags and beaconing flags may not be lifted by cfg80211
+ *     due to regulatory beacon hints. For more information on beacon
+ *     hints read the documenation for regulatory_hint_found_beacon()
  * @reg_notifier: the driver's regulatory notification callback
  * @regd: the driver's regulatory domain, if one was requested via
  *     the regulatory_hint() API. This can be used by the driver
@@ -1071,6 +1105,12 @@ struct cfg80211_ops {
  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
  *     -1 = fragmentation disabled, only odd values >= 256 used
  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
+ * @net: the network namespace this wiphy currently lives in
+ * @netnsok: if set to false, do not allow changing the netns of this
+ *     wiphy at all
+ * @ps_default: default for powersave, will be set depending on the
+ *     kernel's default on wiphy_new(), but can be changed by the
+ *     driver if it has a good reason to override the default
  */
 struct wiphy {
        /* assign these fields before you register the wiphy */
@@ -1083,6 +1123,10 @@ struct wiphy {
 
        bool custom_regulatory;
        bool strict_regulatory;
+       bool disable_beacon_hints;
+
+       bool netnsok;
+       bool ps_default;
 
        enum cfg80211_signal_type signal_type;
 
@@ -1098,6 +1142,9 @@ struct wiphy {
        u32 frag_threshold;
        u32 rts_threshold;
 
+       char fw_version[ETHTOOL_BUSINFO_LEN];
+       u32 hw_version;
+
        /* If multiple wiphys are registered and you're handed e.g.
         * a regular netdev with assigned ieee80211_ptr, you won't
         * know whether it points to a wiphy your driver has registered
@@ -1122,9 +1169,39 @@ struct wiphy {
        /* dir in debugfs: ieee80211/<wiphyname> */
        struct dentry *debugfsdir;
 
+#ifdef CONFIG_NET_NS
+       /* the network namespace this phy lives in currently */
+       struct net *_net;
+#endif
+
+#ifdef CONFIG_CFG80211_WEXT
+       const struct iw_handler_def *wext;
+#endif
+
        char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
 };
 
+#ifdef CONFIG_NET_NS
+static inline struct net *wiphy_net(struct wiphy *wiphy)
+{
+       return wiphy->_net;
+}
+
+static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
+{
+       wiphy->_net = net;
+}
+#else
+static inline struct net *wiphy_net(struct wiphy *wiphy)
+{
+       return &init_net;
+}
+
+static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
+{
+}
+#endif
+
 /**
  * wiphy_priv - return priv from wiphy
  *
@@ -1219,9 +1296,10 @@ extern void wiphy_unregister(struct wiphy *wiphy);
  */
 extern void wiphy_free(struct wiphy *wiphy);
 
-/* internal struct */
+/* internal structs */
 struct cfg80211_conn;
 struct cfg80211_internal_bss;
+struct cfg80211_cached_keys;
 
 #define MAX_AUTH_BSSES         4
 
@@ -1248,10 +1326,14 @@ struct wireless_dev {
        struct wiphy *wiphy;
        enum nl80211_iftype iftype;
 
-       /* private to the generic wireless code */
+       /* the remainder of this struct should be private to cfg80211 */
        struct list_head list;
        struct net_device *netdev;
 
+       struct mutex mtx;
+
+       struct work_struct cleanup_work;
+
        /* currently used for IBSS and SME - might be rearranged later */
        u8 ssid[IEEE80211_MAX_SSID_LEN];
        u8 ssid_len;
@@ -1261,24 +1343,27 @@ struct wireless_dev {
                CFG80211_SME_CONNECTED,
        } sme_state;
        struct cfg80211_conn *conn;
+       struct cfg80211_cached_keys *connect_keys;
+
+       struct list_head event_list;
+       spinlock_t event_lock;
 
        struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
        struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
        struct cfg80211_internal_bss *current_bss; /* associated / joined */
 
-#ifdef CONFIG_WIRELESS_EXT
+#ifdef CONFIG_CFG80211_WEXT
        /* wext data */
        struct {
-               union {
-                       struct cfg80211_ibss_params ibss;
-                       struct cfg80211_connect_params connect;
-               };
+               struct cfg80211_ibss_params ibss;
+               struct cfg80211_connect_params connect;
+               struct cfg80211_cached_keys *keys;
                u8 *ie;
                size_t ie_len;
-               u8 bssid[ETH_ALEN];
+               u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
                u8 ssid[IEEE80211_MAX_SSID_LEN];
                s8 default_key, default_mgmt_key;
-               bool ps;
+               bool ps, prev_bssid_valid;
                int ps_timeout;
        } wext;
 #endif
@@ -1459,20 +1544,6 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
 extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
 
 /**
- * regulatory_hint_11d - hints a country IE as a regulatory domain
- * @wiphy: the wireless device giving the hint (used only for reporting
- *     conflicts)
- * @country_ie: pointer to the country IE
- * @country_ie_len: length of the country IE
- *
- * We will intersect the rd with the what CRDA tells us should apply
- * for the alpha2 this country IE belongs to, this prevents APs from
- * sending us incorrect or outdated information against a country.
- */
-extern void regulatory_hint_11d(struct wiphy *wiphy,
-                               u8 *country_ie,
-                               u8 country_ie_len);
-/**
  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
  * @wiphy: the wireless device we want to process the regulatory domain on
  * @regd: the custom regulatory domain to use for this wiphy
@@ -1540,43 +1611,6 @@ int cfg80211_wext_siwmlme(struct net_device *dev,
 int cfg80211_wext_giwrange(struct net_device *dev,
                           struct iw_request_info *info,
                           struct iw_point *data, char *extra);
-int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
-                              struct iw_request_info *info,
-                              struct iw_freq *freq, char *extra);
-int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
-                              struct iw_request_info *info,
-                              struct iw_freq *freq, char *extra);
-int cfg80211_ibss_wext_siwessid(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct iw_point *data, char *ssid);
-int cfg80211_ibss_wext_giwessid(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct iw_point *data, char *ssid);
-int cfg80211_ibss_wext_siwap(struct net_device *dev,
-                            struct iw_request_info *info,
-                            struct sockaddr *ap_addr, char *extra);
-int cfg80211_ibss_wext_giwap(struct net_device *dev,
-                            struct iw_request_info *info,
-                            struct sockaddr *ap_addr, char *extra);
-
-int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
-                             struct iw_request_info *info,
-                             struct iw_freq *freq, char *extra);
-int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
-                             struct iw_request_info *info,
-                             struct iw_freq *freq, char *extra);
-int cfg80211_mgd_wext_siwessid(struct net_device *dev,
-                              struct iw_request_info *info,
-                              struct iw_point *data, char *ssid);
-int cfg80211_mgd_wext_giwessid(struct net_device *dev,
-                              struct iw_request_info *info,
-                              struct iw_point *data, char *ssid);
-int cfg80211_mgd_wext_siwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *ap_addr, char *extra);
-int cfg80211_mgd_wext_giwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *ap_addr, char *extra);
 int cfg80211_wext_siwgenie(struct net_device *dev,
                           struct iw_request_info *info,
                           struct iw_point *data, char *extra);
@@ -1587,9 +1621,18 @@ int cfg80211_wext_giwauth(struct net_device *dev,
                          struct iw_request_info *info,
                          struct iw_param *data, char *extra);
 
-struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
-                                            struct iw_freq *freq);
-
+int cfg80211_wext_siwfreq(struct net_device *dev,
+                         struct iw_request_info *info,
+                         struct iw_freq *freq, char *extra);
+int cfg80211_wext_giwfreq(struct net_device *dev,
+                         struct iw_request_info *info,
+                         struct iw_freq *freq, char *extra);
+int cfg80211_wext_siwessid(struct net_device *dev,
+                          struct iw_request_info *info,
+                          struct iw_point *data, char *ssid);
+int cfg80211_wext_giwessid(struct net_device *dev,
+                          struct iw_request_info *info,
+                          struct iw_point *data, char *ssid);
 int cfg80211_wext_siwrate(struct net_device *dev,
                          struct iw_request_info *info,
                          struct iw_param *rate, char *extra);
@@ -1639,12 +1682,12 @@ int cfg80211_wext_giwpower(struct net_device *dev,
                           struct iw_request_info *info,
                           struct iw_param *wrq, char *extra);
 
-int cfg80211_wds_wext_siwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *addr, char *extra);
-int cfg80211_wds_wext_giwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *addr, char *extra);
+int cfg80211_wext_siwap(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct sockaddr *ap_addr, char *extra);
+int cfg80211_wext_giwap(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct sockaddr *ap_addr, char *extra);
 
 /*
  * callbacks for asynchronous cfg80211 methods, notification
@@ -1722,70 +1765,74 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  * @dev: network device
  * @buf: authentication frame (header + body)
  * @len: length of the frame data
- * @gfp: allocation flags
  *
  * This function is called whenever an authentication has been processed in
  * station mode. The driver is required to call either this function or
  * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
- * call.
+ * call. This function may sleep.
  */
-void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
+void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
 
 /**
  * cfg80211_send_auth_timeout - notification of timed out authentication
  * @dev: network device
  * @addr: The MAC address of the device with which the authentication timed out
- * @gfp: allocation flags
+ *
+ * This function may sleep.
  */
-void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp);
+void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
 
 /**
  * cfg80211_send_rx_assoc - notification of processed association
  * @dev: network device
  * @buf: (re)association response frame (header + body)
  * @len: length of the frame data
- * @gfp: allocation flags
  *
  * This function is called whenever a (re)association response has been
  * processed in station mode. The driver is required to call either this
  * function or cfg80211_send_assoc_timeout() to indicate the result of
- * cfg80211_ops::assoc() call.
+ * cfg80211_ops::assoc() call. This function may sleep.
  */
-void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
+void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
 
 /**
  * cfg80211_send_assoc_timeout - notification of timed out association
  * @dev: network device
  * @addr: The MAC address of the device with which the association timed out
- * @gfp: allocation flags
+ *
+ * This function may sleep.
  */
-void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp);
+void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
 
 /**
  * cfg80211_send_deauth - notification of processed deauthentication
  * @dev: network device
  * @buf: deauthentication frame (header + body)
  * @len: length of the frame data
- * @gfp: allocation flags
+ * @cookie: cookie from ->deauth if called within that callback,
+ *     %NULL otherwise
  *
  * This function is called whenever deauthentication has been processed in
  * station mode. This includes both received deauthentication frames and
- * locally generated ones.
+ * locally generated ones. This function may sleep.
  */
-void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
+void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len,
+                         void *cookie);
 
 /**
  * cfg80211_send_disassoc - notification of processed disassociation
  * @dev: network device
  * @buf: disassociation response frame (header + body)
  * @len: length of the frame data
- * @gfp: allocation flags
+ * @cookie: cookie from ->disassoc if called within that callback,
+ *     %NULL otherwise
  *
  * This function is called whenever disassociation has been processed in
  * station mode. This includes both received disassociation frames and locally
- * generated ones.
+ * generated ones. This function may sleep.
  */
-void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
+void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len,
+                           void *cookie);
 
 /**
  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)