mac80211: add API to request TDLS operation from userspace
authorArik Nemtsov <arik@wizery.com>
Wed, 11 Jun 2014 14:18:25 +0000 (17:18 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 23 Jun 2014 12:28:17 +0000 (14:28 +0200)
Write a mac80211 to the cfg80211 API for requesting a userspace TDLS
operation. Define TDLS specific reason codes that can be used here.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/linux/ieee80211.h
include/net/mac80211.h
net/mac80211/tdls.c

index 6bff13f740505090eb53be8b4d91e0fe805a5191..75d17e15da338c1bcb05d1b27283ea577050b3aa 100644 (file)
@@ -1621,6 +1621,9 @@ enum ieee80211_reasoncode {
        WLAN_REASON_INVALID_RSN_IE_CAP = 22,
        WLAN_REASON_IEEE8021X_FAILED = 23,
        WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+       /* TDLS (802.11z) */
+       WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25,
+       WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26,
        /* 802.11e */
        WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
        WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
index 421b6ecb4b2cdee892379212f9d252f3f3ecffbc..8d876dc8b29935e4dd9020401f05b7113505a758 100644 (file)
@@ -4815,4 +4815,17 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
  */
 void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
 
+/**
+ * ieee80211_tdls_oper - request userspace to perform a TDLS operation
+ * @vif: virtual interface
+ * @peer: the peer's destination address
+ * @oper: the requested TDLS operation
+ * @reason_code: reason code for the operation, valid for TDLS teardown
+ * @gfp: allocation flags
+ *
+ * See cfg80211_tdls_oper_request().
+ */
+void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
+                                enum nl80211_tdls_operation oper,
+                                u16 reason_code, gfp_t gfp);
 #endif /* MAC80211_H */
index 0ba7e4c029c8a9257621ffd6dcf43837726b46db..6f3a3ad0cb7c387c43a1197ea4b578f8bc11ead5 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/ieee80211.h>
+#include <net/cfg80211.h>
 #include "ieee80211_i.h"
 
 /* give usermode some time for retries in setting up the TDLS session */
@@ -514,3 +515,19 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
        mutex_unlock(&local->mtx);
        return ret;
 }
+
+void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
+                                enum nl80211_tdls_operation oper,
+                                u16 reason_code, gfp_t gfp)
+{
+       struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+       if (vif->type != NL80211_IFTYPE_STATION || !vif->bss_conf.assoc) {
+               sdata_err(sdata, "Discarding TDLS oper %d - not STA or disconnected\n",
+                         oper);
+               return;
+       }
+
+       cfg80211_tdls_oper_request(sdata->dev, peer, oper, reason_code, gfp);
+}
+EXPORT_SYMBOL(ieee80211_tdls_oper_request);