cfg80211: allow finding vendor with OUI without specifying the OUI type
[cascardo/linux.git] / include / net / cfg80211.h
index 9e1b24c..5f6e98a 100644 (file)
@@ -67,26 +67,6 @@ struct wiphy;
  * wireless hardware capability structures
  */
 
-/**
- * enum ieee80211_band - supported frequency bands
- *
- * The bands are assigned this way because the supported
- * bitrates differ in these bands.
- *
- * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
- * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
- * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
- * @IEEE80211_NUM_BANDS: number of defined bands
- */
-enum ieee80211_band {
-       IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
-       IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
-       IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
-
-       /* keep last */
-       IEEE80211_NUM_BANDS
-};
-
 /**
  * enum ieee80211_channel_flags - channel flags
  *
@@ -167,7 +147,7 @@ enum ieee80211_channel_flags {
  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
  */
 struct ieee80211_channel {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u16 center_freq;
        u16 hw_value;
        u32 flags;
@@ -324,7 +304,7 @@ struct ieee80211_sta_vht_cap {
 struct ieee80211_supported_band {
        struct ieee80211_channel *channels;
        struct ieee80211_rate *bitrates;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int n_channels;
        int n_bitrates;
        struct ieee80211_sta_ht_cap ht_cap;
@@ -816,6 +796,7 @@ enum station_parameters_apply_mask {
  * @supported_oper_classes_len: number of supported operating classes
  * @opmode_notif: operating mode field from Operating Mode Notification
  * @opmode_notif_used: information if operating mode field is used
+ * @support_p2p_ps: information if station supports P2P PS mechanism
  */
 struct station_parameters {
        const u8 *supported_rates;
@@ -841,6 +822,7 @@ struct station_parameters {
        u8 supported_oper_classes_len;
        u8 opmode_notif;
        bool opmode_notif_used;
+       int support_p2p_ps;
 };
 
 /**
@@ -1063,11 +1045,12 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  *     from this peer
+ * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
  *     (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-       u32 filled;
+       u64 filled;
        u32 connected_time;
        u32 inactive_time;
        u64 rx_bytes;
@@ -1106,6 +1089,7 @@ struct station_info {
        u32 expected_throughput;
 
        u64 rx_beacon;
+       u64 rx_duration;
        u8 rx_beacon_signal_avg;
        struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
@@ -1368,7 +1352,7 @@ struct mesh_setup {
        bool user_mpm;
        u8 dtim_period;
        u16 beacon_interval;
-       int mcast_rate[IEEE80211_NUM_BANDS];
+       int mcast_rate[NUM_NL80211_BANDS];
        u32 basic_rates;
 };
 
@@ -1455,6 +1439,7 @@ struct cfg80211_ssid {
  * @mac_addr_mask: MAC address mask used with randomisation, bits that
  *     are 0 in the mask should be randomised, bits that are 1 should
  *     be taken from the @mac_addr
+ * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
  */
 struct cfg80211_scan_request {
        struct cfg80211_ssid *ssids;
@@ -1465,12 +1450,13 @@ struct cfg80211_scan_request {
        size_t ie_len;
        u32 flags;
 
-       u32 rates[IEEE80211_NUM_BANDS];
+       u32 rates[NUM_NL80211_BANDS];
 
        struct wireless_dev *wdev;
 
        u8 mac_addr[ETH_ALEN] __aligned(2);
        u8 mac_addr_mask[ETH_ALEN] __aligned(2);
+       u8 bssid[ETH_ALEN] __aligned(2);
 
        /* internal */
        struct wiphy *wiphy;
@@ -1617,7 +1603,7 @@ struct cfg80211_inform_bss {
 };
 
 /**
- * struct cfg80211_bss_ie_data - BSS entry IE data
+ * struct cfg80211_bss_ies - BSS entry IE data
  * @tsf: TSF contained in the frame that carried these IEs
  * @rcu_head: internal use, for freeing
  * @len: length of the IEs
@@ -1746,7 +1732,12 @@ enum cfg80211_assoc_req_flags {
  * @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
+ * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
+ *     to indicate a request to reassociate within the ESS instead of a request
+ *     do the initial association with the ESS. When included, this is set to
+ *     the BSSID of the current association, i.e., to the value that is
+ *     included in the Current AP address field of the Reassociation Request
+ *     frame.
  * @flags:  See &enum cfg80211_assoc_req_flags
  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
  *     will be used in ht_capa.  Un-supported values will be ignored.
@@ -1851,11 +1842,38 @@ struct cfg80211_ibss_params {
        bool privacy;
        bool control_port;
        bool userspace_handles_dfs;
-       int mcast_rate[IEEE80211_NUM_BANDS];
+       int mcast_rate[NUM_NL80211_BANDS];
        struct ieee80211_ht_cap ht_capa;
        struct ieee80211_ht_cap ht_capa_mask;
 };
 
+/**
+ * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
+ *
+ * @band: band of BSS which should match for RSSI level adjustment.
+ * @delta: value of RSSI level adjustment.
+ */
+struct cfg80211_bss_select_adjust {
+       enum nl80211_band band;
+       s8 delta;
+};
+
+/**
+ * struct cfg80211_bss_selection - connection parameters for BSS selection.
+ *
+ * @behaviour: requested BSS selection behaviour.
+ * @param: parameters for requestion behaviour.
+ * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
+ * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
+ */
+struct cfg80211_bss_selection {
+       enum nl80211_bss_select_attr behaviour;
+       union {
+               enum nl80211_band band_pref;
+               struct cfg80211_bss_select_adjust adjust;
+       } param;
+};
+
 /**
  * struct cfg80211_connect_params - Connection parameters
  *
@@ -1893,6 +1911,13 @@ struct cfg80211_ibss_params {
  * @vht_capa_mask: The bits of vht_capa which are to be used.
  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
  *     networks.
+ * @bss_select: criteria to be used for BSS selection.
+ * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
+ *     to indicate a request to reassociate within the ESS instead of a request
+ *     do the initial association with the ESS. When included, this is set to
+ *     the BSSID of the current association, i.e., to the value that is
+ *     included in the Current AP address field of the Reassociation Request
+ *     frame.
  */
 struct cfg80211_connect_params {
        struct ieee80211_channel *channel;
@@ -1916,6 +1941,8 @@ struct cfg80211_connect_params {
        struct ieee80211_vht_cap vht_capa;
        struct ieee80211_vht_cap vht_capa_mask;
        bool pbss;
+       struct cfg80211_bss_selection bss_select;
+       const u8 *prev_bssid;
 };
 
 /**
@@ -1945,7 +1972,7 @@ struct cfg80211_bitrate_mask {
                u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
                u16 vht_mcs[NL80211_VHT_NSS_MAX];
                enum nl80211_txrate_gi gi;
-       } control[IEEE80211_NUM_BANDS];
+       } control[NUM_NL80211_BANDS];
 };
 /**
  * struct cfg80211_pmksa - PMK Security Association
@@ -2342,7 +2369,17 @@ struct cfg80211_qos_map {
  * @connect: Connect to the ESS with the specified parameters. When connected,
  *     call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
  *     If the connection fails for some reason, call cfg80211_connect_result()
- *     with the status from the AP.
+ *     with the status from the AP. The driver is allowed to roam to other
+ *     BSSes within the ESS when the other BSS matches the connect parameters.
+ *     When such roaming is initiated by the driver, the driver is expected to
+ *     verify that the target matches the configured security parameters and
+ *     to use Reassociation Request frame instead of Association Request frame.
+ *     The connect function can also be used to request the driver to perform
+ *     a specific roam when connected to an ESS. In that case, the prev_bssid
+ *     parameter is set to the BSSID of the currently associated BSS as an
+ *     indication of requesting reassociation. In both the driver-initiated and
+ *     new connect() call initiated roaming cases, the result of roaming is
+ *     indicated with a call to cfg80211_roamed() or cfg80211_roamed_bss().
  *     (invoked with the wireless_dev mutex held)
  * @disconnect: Disconnect from the BSS/ESS.
  *     (invoked with the wireless_dev mutex held)
@@ -2622,7 +2659,7 @@ struct cfg80211_ops {
        int     (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
 
        int     (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
-                                 int rate[IEEE80211_NUM_BANDS]);
+                                 int rate[NUM_NL80211_BANDS]);
 
        int     (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
 
@@ -3184,6 +3221,9 @@ struct wiphy_vendor_command {
  *     low rssi when a frame is heard on different channel, then it should set
  *     this variable to the maximal offset for which it can compensate.
  *     This value should be set in MHz.
+ * @bss_select_support: bitmask indicating the BSS selection criteria supported
+ *     by the driver in the .connect() callback. The bit position maps to the
+ *     attribute indices defined in &enum nl80211_bss_select_attr.
  */
 struct wiphy {
        /* assign these fields before you register the wiphy */
@@ -3265,7 +3305,7 @@ struct wiphy {
         * help determine whether you own this wiphy or not. */
        const void *privid;
 
-       struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
 
        /* Lets us get back the wiphy on the callback */
        void (*reg_notifier)(struct wiphy *wiphy,
@@ -3306,6 +3346,8 @@ struct wiphy {
        u8 max_num_csa_counters;
        u8 max_adj_channel_rssi_comp;
 
+       u32 bss_select_support;
+
        char priv[0] __aligned(NETDEV_ALIGN);
 };
 
@@ -3598,7 +3640,7 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
  * @band: band, necessary due to channel number overlap
  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
  */
-int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
+int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
 
 /**
  * ieee80211_frequency_to_channel - convert frequency to channel number
@@ -3851,7 +3893,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
  * cfg80211_find_vendor_ie - find vendor specific information element in data
  *
  * @oui: vendor OUI
- * @oui_type: vendor-specific OUI type
+ * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
  * @ies: data consisting of IEs
  * @len: length of data
  *
@@ -3863,7 +3905,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
  * Note: There are no checks on the element length other than having to fit into
  * the given data.
  */
-const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
+const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
                                  const u8 *ies, int len);
 
 /**
@@ -4609,6 +4651,32 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
 #define CFG80211_TESTMODE_DUMP(cmd)
 #endif
 
+/**
+ * cfg80211_connect_bss - notify cfg80211 of connection result
+ *
+ * @dev: network device
+ * @bssid: the BSSID of the AP
+ * @bss: entry of bss to which STA got connected to, can be obtained
+ *     through cfg80211_get_bss (may be %NULL)
+ * @req_ie: association request IEs (maybe be %NULL)
+ * @req_ie_len: association request IEs length
+ * @resp_ie: association response IEs (may be %NULL)
+ * @resp_ie_len: assoc response IEs length
+ * @status: status code, 0 for successful connection, use
+ *      %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
+ *      the real status code for failures.
+ * @gfp: allocation flags
+ *
+ * It should be called by the underlying driver whenever connect() has
+ * succeeded. This is similar to cfg80211_connect_result(), but with the
+ * option of identifying the exact bss entry for the connection. Only one of
+ * these functions should be called.
+ */
+void cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
+                         struct cfg80211_bss *bss, const u8 *req_ie,
+                         size_t req_ie_len, const u8 *resp_ie,
+                         size_t resp_ie_len, u16 status, gfp_t gfp);
+
 /**
  * cfg80211_connect_result - notify cfg80211 of connection result
  *
@@ -4626,10 +4694,15 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
  * It should be called by the underlying driver whenever connect() has
  * succeeded.
  */
-void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
-                            const u8 *req_ie, size_t req_ie_len,
-                            const u8 *resp_ie, size_t resp_ie_len,
-                            u16 status, gfp_t gfp);
+static inline void
+cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
+                       const u8 *req_ie, size_t req_ie_len,
+                       const u8 *resp_ie, size_t resp_ie_len,
+                       u16 status, gfp_t gfp)
+{
+       cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
+                            resp_ie_len, status, gfp);
+}
 
 /**
  * cfg80211_roamed - notify cfg80211 of roaming
@@ -5029,7 +5102,7 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev,
  * Returns %true if the conversion was successful, %false otherwise.
  */
 bool ieee80211_operating_class_to_band(u8 operating_class,
-                                      enum ieee80211_band *band);
+                                      enum nl80211_band *band);
 
 /**
  * ieee80211_chandef_to_operating_class - convert chandef to operation class