aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/mac80211.h12
-rw-r--r--net/mac80211/driver-ops.h16
-rw-r--r--net/mac80211/tdls.c10
-rw-r--r--net/mac80211/trace.h7
4 files changed, 44 insertions, 1 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8d876dc8b299..18c2bdbaf988 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2764,6 +2764,15 @@ enum ieee80211_roc_type {
2764 * mac80211 will transmit the frame right away. 2764 * mac80211 will transmit the frame right away.
2765 * The callback is optional and can (should!) sleep. 2765 * The callback is optional and can (should!) sleep.
2766 * 2766 *
2767 * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
2768 * a TDLS discovery-request, we expect a reply to arrive on the AP's
2769 * channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
2770 * setup-response is a direct packet not buffered by the AP.
2771 * mac80211 will call this function just before the transmission of a TDLS
2772 * discovery-request. The recommended period of protection is at least
2773 * 2 * (DTIM period).
2774 * The callback is optional and can sleep.
2775 *
2767 * @add_chanctx: Notifies device driver about new channel context creation. 2776 * @add_chanctx: Notifies device driver about new channel context creation.
2768 * @remove_chanctx: Notifies device driver about channel context destruction. 2777 * @remove_chanctx: Notifies device driver about channel context destruction.
2769 * @change_chanctx: Notifies device driver about channel context changes that 2778 * @change_chanctx: Notifies device driver about channel context changes that
@@ -2981,6 +2990,9 @@ struct ieee80211_ops {
2981 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 2990 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2982 struct ieee80211_vif *vif); 2991 struct ieee80211_vif *vif);
2983 2992
2993 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
2994 struct ieee80211_vif *vif);
2995
2984 int (*add_chanctx)(struct ieee80211_hw *hw, 2996 int (*add_chanctx)(struct ieee80211_hw *hw,
2985 struct ieee80211_chanctx_conf *ctx); 2997 struct ieee80211_chanctx_conf *ctx);
2986 void (*remove_chanctx)(struct ieee80211_hw *hw, 2998 void (*remove_chanctx)(struct ieee80211_hw *hw,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index bd782dcffcc7..2265bd7a44ba 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -970,6 +970,22 @@ static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
970 trace_drv_return_void(local); 970 trace_drv_return_void(local);
971} 971}
972 972
973static inline void
974drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
975 struct ieee80211_sub_if_data *sdata)
976{
977 might_sleep();
978
979 if (!check_sdata_in_driver(sdata))
980 return;
981 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
982
983 trace_drv_mgd_protect_tdls_discover(local, sdata);
984 if (local->ops->mgd_protect_tdls_discover)
985 local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
986 trace_drv_return_void(local);
987}
988
973static inline int drv_add_chanctx(struct ieee80211_local *local, 989static inline int drv_add_chanctx(struct ieee80211_local *local,
974 struct ieee80211_chanctx *ctx) 990 struct ieee80211_chanctx *ctx)
975{ 991{
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index b87e369561f4..f7185338a0fa 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -10,6 +10,7 @@
10#include <linux/ieee80211.h> 10#include <linux/ieee80211.h>
11#include <net/cfg80211.h> 11#include <net/cfg80211.h>
12#include "ieee80211_i.h" 12#include "ieee80211_i.h"
13#include "driver-ops.h"
13 14
14/* give usermode some time for retries in setting up the TDLS session */ 15/* give usermode some time for retries in setting up the TDLS session */
15#define TDLS_PEER_SETUP_TIMEOUT (15 * HZ) 16#define TDLS_PEER_SETUP_TIMEOUT (15 * HZ)
@@ -442,8 +443,15 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
442 peer_capability, initiator, 443 peer_capability, initiator,
443 extra_ies, extra_ies_len); 444 extra_ies, extra_ies_len);
444 break; 445 break;
445 case WLAN_TDLS_SETUP_CONFIRM:
446 case WLAN_TDLS_DISCOVERY_REQUEST: 446 case WLAN_TDLS_DISCOVERY_REQUEST:
447 /*
448 * Protect the discovery so we can hear the TDLS discovery
449 * response frame. It is transmitted directly and not buffered
450 * by the AP.
451 */
452 drv_mgd_protect_tdls_discover(sdata->local, sdata);
453 /* fall-through */
454 case WLAN_TDLS_SETUP_CONFIRM:
447 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 455 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
448 /* no special handling */ 456 /* no special handling */
449 ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer, 457 ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer,
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index cfe1a0688b5c..02ac535d1274 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1330,6 +1330,13 @@ DEFINE_EVENT(local_sdata_evt, drv_mgd_prepare_tx,
1330 TP_ARGS(local, sdata) 1330 TP_ARGS(local, sdata)
1331); 1331);
1332 1332
1333DEFINE_EVENT(local_sdata_evt, drv_mgd_protect_tdls_discover,
1334 TP_PROTO(struct ieee80211_local *local,
1335 struct ieee80211_sub_if_data *sdata),
1336
1337 TP_ARGS(local, sdata)
1338);
1339
1333DECLARE_EVENT_CLASS(local_chanctx, 1340DECLARE_EVENT_CLASS(local_chanctx,
1334 TP_PROTO(struct ieee80211_local *local, 1341 TP_PROTO(struct ieee80211_local *local,
1335 struct ieee80211_chanctx *ctx), 1342 struct ieee80211_chanctx *ctx),