Search Linux Wireless

[RFC 4/5] mac80211: add a HW flag for TDLS support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow TDLS operations and peers only in supporting hardware.

Signed-off-by: Arik Nemtsov <arik@xxxxxxxxxx>
Cc: Kalyan C Gaddam <chakkal@xxxxxxx>
---
 include/net/mac80211.h |    4 ++++
 net/mac80211/cfg.c     |   11 +++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2f01d84..25bd038 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1094,6 +1094,9 @@ enum sta_notify_cmd {
  *	stations based on the PM bit of incoming frames.
  *	Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure
  *	the PS mode of connected stations.
+ *
+ * @IEEE80211_HW_SUPPORTS_TDLS:
+ *	This device can operate as a TDLS (802.11z) peer.
  */
 enum ieee80211_hw_flags {
 	IEEE80211_HW_HAS_RATE_CONTROL			= 1<<0,
@@ -1119,6 +1122,7 @@ enum ieee80211_hw_flags {
 	IEEE80211_HW_SUPPORTS_CQM_RSSI			= 1<<20,
 	IEEE80211_HW_SUPPORTS_PER_STA_GTK		= 1<<21,
 	IEEE80211_HW_AP_LINK_PS				= 1<<22,
+	IEEE80211_HW_SUPPORTS_TDLS			= 1<<23,
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3ef0bc6..9c6ac93 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -797,6 +797,11 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
 
 	sta_apply_parameters(local, sta, params);
 
+	if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_TDLS) &&
+	    (sta->flags & WLAN_STA_TDLS_PEER)) {
+		return -ENOTSUPP;
+	}
+
 	rate_control_rate_init(sta);
 
 	layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
@@ -2308,6 +2313,9 @@ static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
 	bool send_direct;
 	int ret;
 
+	if (!(sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_TDLS))
+		return -ENOTSUPP;
+
 #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
 	printk(KERN_DEBUG "TDLS mgmt action %d peer %pM\n", action_code, peer);
 #endif
@@ -2422,6 +2430,9 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct sta_info *sta = NULL;
 
+	if (!(sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_TDLS))
+		return -ENOTSUPP;
+
 #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
 	printk(KERN_DEBUG "TDLS oper %d peer %pM\n", oper, peer);
 #endif
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux