]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - net/wireless/core.h
cfg80211: configuration for WoWLAN over TCP
[linux-3.10.git] / net / wireless / core.h
index 56f18c2eb9190242d30c01f670227692df22c250..949c9573d8d73a7329c2af4565f30f21b58e6dfc 100644 (file)
@@ -8,15 +8,18 @@
 #include <linux/mutex.h>
 #include <linux/list.h>
 #include <linux/netdevice.h>
-#include <linux/kref.h>
 #include <linux/rbtree.h>
 #include <linux/debugfs.h>
 #include <linux/rfkill.h>
 #include <linux/workqueue.h>
+#include <linux/rtnetlink.h>
 #include <net/genetlink.h>
 #include <net/cfg80211.h>
 #include "reg.h"
 
+
+#define WIPHY_IDX_INVALID      -1
+
 struct cfg80211_registered_device {
        const struct cfg80211_ops *ops;
        struct list_head list;
@@ -46,15 +49,20 @@ struct cfg80211_registered_device {
        /* wiphy index, internal only */
        int wiphy_idx;
 
-       /* associate netdev list */
+       /* associated wireless interfaces */
        struct mutex devlist_mtx;
        /* protected by devlist_mtx or RCU */
-       struct list_head netdev_list;
-       int devlist_generation;
+       struct list_head wdev_list;
+       int devlist_generation, wdev_id;
        int opencount; /* also protected by devlist_mtx */
        wait_queue_head_t dev_wait;
 
-       u32 ap_beacons_nlpid;
+       struct list_head beacon_registrations;
+       spinlock_t beacon_registrations_lock;
+
+       /* protected by RTNL only */
+       int num_running_ifaces;
+       int num_running_monitor_ifaces;
 
        /* BSSes/scanning */
        spinlock_t bss_lock;
@@ -80,7 +88,7 @@ struct cfg80211_registered_device {
 
        /* must be last because of the way we do wiphy_priv(),
         * and it should at least be aligned to NETDEV_ALIGN */
-       struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN)));
+       struct wiphy wiphy __aligned(NETDEV_ALIGN);
 };
 
 static inline
@@ -90,13 +98,6 @@ struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy)
        return container_of(wiphy, struct cfg80211_registered_device, wiphy);
 }
 
-/* Note 0 is valid, hence phy0 */
-static inline
-bool wiphy_idx_valid(int wiphy_idx)
-{
-       return wiphy_idx >= 0;
-}
-
 static inline void
 cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev)
 {
@@ -107,6 +108,9 @@ cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev)
        for (i = 0; i < rdev->wowlan->n_patterns; i++)
                kfree(rdev->wowlan->patterns[i].mask);
        kfree(rdev->wowlan->patterns);
+       if (rdev->wowlan->tcp && rdev->wowlan->tcp->sock)
+               sock_release(rdev->wowlan->tcp->sock);
+       kfree(rdev->wowlan->tcp);
        kfree(rdev->wowlan);
 }
 
@@ -120,20 +124,13 @@ static inline void assert_cfg80211_lock(void)
        lockdep_assert_held(&cfg80211_mutex);
 }
 
-/*
- * You can use this to mark a wiphy_idx as not having an associated wiphy.
- * It guarantees cfg80211_rdev_by_wiphy_idx(wiphy_idx) will return NULL
- */
-#define WIPHY_IDX_STALE -1
-
 struct cfg80211_internal_bss {
        struct list_head list;
+       struct list_head hidden_list;
        struct rb_node rbn;
        unsigned long ts;
-       struct kref ref;
+       unsigned long refcount;
        atomic_t hold;
-       bool beacon_ies_allocated;
-       bool proberesp_ies_allocated;
 
        /* must be last because of priv member */
        struct cfg80211_bss pub;
@@ -197,6 +194,14 @@ static inline void wdev_unlock(struct wireless_dev *wdev)
 #define ASSERT_RDEV_LOCK(rdev) lockdep_assert_held(&(rdev)->mtx)
 #define ASSERT_WDEV_LOCK(wdev) lockdep_assert_held(&(wdev)->mtx)
 
+static inline bool cfg80211_has_monitors_only(struct cfg80211_registered_device *rdev)
+{
+       ASSERT_RTNL();
+
+       return rdev->num_running_ifaces == rdev->num_running_monitor_ifaces &&
+              rdev->num_running_ifaces > 0;
+}
+
 enum cfg80211_event_type {
        EVENT_CONNECT_RESULT,
        EVENT_ROAMED,
@@ -247,6 +252,10 @@ enum cfg80211_chan_mode {
        CHAN_MODE_EXCLUSIVE,
 };
 
+struct cfg80211_beacon_registration {
+       struct list_head list;
+       u32 nlportid;
+};
 
 /* free object */
 extern void cfg80211_dev_free(struct cfg80211_registered_device *rdev);
@@ -291,9 +300,9 @@ int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
                       const struct mesh_config *conf);
 int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
                        struct net_device *dev);
-int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev,
-                          struct wireless_dev *wdev, int freq,
-                          enum nl80211_channel_type channel_type);
+int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev,
+                             struct wireless_dev *wdev,
+                             struct cfg80211_chan_def *chandef);
 
 /* AP */
 int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
@@ -307,13 +316,15 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
                         const u8 *bssid,
                         const u8 *ssid, int ssid_len,
                         const u8 *ie, int ie_len,
-                        const u8 *key, int key_len, int key_idx);
+                        const u8 *key, int key_len, int key_idx,
+                        const u8 *sae_data, int sae_data_len);
 int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
                       struct net_device *dev, struct ieee80211_channel *chan,
                       enum nl80211_auth_type auth_type, const u8 *bssid,
                       const u8 *ssid, int ssid_len,
                       const u8 *ie, int ie_len,
-                      const u8 *key, int key_len, int key_idx);
+                      const u8 *key, int key_len, int key_idx,
+                      const u8 *sae_data, int sae_data_len);
 int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
                          struct net_device *dev,
                          struct ieee80211_channel *chan,
@@ -356,12 +367,10 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
 void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid);
 void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev);
 int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
-                         struct net_device *dev,
+                         struct wireless_dev *wdev,
                          struct ieee80211_channel *chan, bool offchan,
-                         enum nl80211_channel_type channel_type,
-                         bool channel_type_valid, unsigned int wait,
-                         const u8 *buf, size_t len, bool no_cck,
-                         bool dont_wait_for_ack, u64 *cookie);
+                         unsigned int wait, const u8 *buf, size_t len,
+                         bool no_cck, bool dont_wait_for_ack, u64 *cookie);
 void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
                               const struct ieee80211_ht_cap *ht_capa_mask);
 
@@ -413,10 +422,23 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                          struct net_device *dev, enum nl80211_iftype ntype,
                          u32 *flags, struct vif_params *params);
 void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev);
+void cfg80211_process_wdev_events(struct wireless_dev *wdev);
+
+int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
+                                struct wireless_dev *wdev,
+                                enum nl80211_iftype iftype,
+                                struct ieee80211_channel *chan,
+                                enum cfg80211_chan_mode chanmode,
+                                u8 radar_detect);
 
-int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
-                                 struct wireless_dev *wdev,
-                                 enum nl80211_iftype iftype);
+static inline int
+cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
+                             struct wireless_dev *wdev,
+                             enum nl80211_iftype iftype)
+{
+       return cfg80211_can_use_iftype_chan(rdev, wdev, iftype, NULL,
+                                           CHAN_MODE_UNDEFINED, 0);
+}
 
 static inline int
 cfg80211_can_add_interface(struct cfg80211_registered_device *rdev,
@@ -425,17 +447,23 @@ cfg80211_can_add_interface(struct cfg80211_registered_device *rdev,
        return cfg80211_can_change_interface(rdev, NULL, iftype);
 }
 
+static inline int
+cfg80211_can_use_chan(struct cfg80211_registered_device *rdev,
+                     struct wireless_dev *wdev,
+                     struct ieee80211_channel *chan,
+                     enum cfg80211_chan_mode chanmode)
+{
+       return cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype,
+                                           chan, chanmode, 0);
+}
+
 void
-cfg80211_get_chan_state(struct cfg80211_registered_device *rdev,
-                       struct wireless_dev *wdev,
+cfg80211_get_chan_state(struct wireless_dev *wdev,
                        struct ieee80211_channel **chan,
                        enum cfg80211_chan_mode *chanmode);
 
-struct ieee80211_channel *
-rdev_freq_to_chan(struct cfg80211_registered_device *rdev,
-                 int freq, enum nl80211_channel_type channel_type);
 int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
-                                int freq, enum nl80211_channel_type chantype);
+                                struct cfg80211_chan_def *chandef);
 
 int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
                           const u8 *rates, unsigned int n_rates,
@@ -444,6 +472,11 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
 int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
                                 u32 beacon_int);
 
+void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
+                              enum nl80211_iftype iftype, int num);
+
+#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
+
 #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS
 #define CFG80211_DEV_WARN_ON(cond)     WARN_ON(cond)
 #else