cfg/mac80211: define TDLS channel switch feature bit

Define some related TDLS protocol constants and advertise channel switch
support in the extended-capabilities IE when the feature bit is defined.

Actually supporting TDLS channel-switching also requires support for
some new nl80211 commands, to be introduced by future patches.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Arik Nemtsov 2014-11-09 18:50:14 +02:00 committed by Johannes Berg
parent 2cedd87960
commit 78632a17ea
3 changed files with 15 additions and 3 deletions

View File

@ -2019,6 +2019,11 @@ enum ieee80211_tdls_actioncode {
*/ */
#define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2) #define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2)
/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */
#define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
#define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
/* Interworking capabilities are set in 7th bit of 4th byte of the /* Interworking capabilities are set in 7th bit of 4th byte of the
* @WLAN_EID_EXT_CAPABILITY information element * @WLAN_EID_EXT_CAPABILITY information element
*/ */
@ -2030,6 +2035,7 @@ enum ieee80211_tdls_actioncode {
*/ */
#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) #define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) #define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
#define WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED BIT(7)
#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6) #define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7) #define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7)

View File

@ -4095,6 +4095,8 @@ enum nl80211_ap_sme_features {
* @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring
* the vif's MAC address upon creation. * the vif's MAC address upon creation.
* See 'macaddr' field in the vif_params (cfg80211.h). * See 'macaddr' field in the vif_params (cfg80211.h).
* @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when
* operating as a TDLS peer.
*/ */
enum nl80211_feature_flags { enum nl80211_feature_flags {
NL80211_FEATURE_SK_TX_STATUS = 1 << 0, NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@ -4125,6 +4127,7 @@ enum nl80211_feature_flags {
NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25, NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25,
NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26, NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26,
NL80211_FEATURE_MAC_ON_CREATE = 1 << 27, NL80211_FEATURE_MAC_ON_CREATE = 1 << 27,
NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28,
}; };
/** /**

View File

@ -35,16 +35,19 @@ void ieee80211_tdls_peer_del_work(struct work_struct *wk)
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
} }
static void ieee80211_tdls_add_ext_capab(struct sk_buff *skb) static void ieee80211_tdls_add_ext_capab(struct ieee80211_local *local,
struct sk_buff *skb)
{ {
u8 *pos = (void *)skb_put(skb, 7); u8 *pos = (void *)skb_put(skb, 7);
bool chan_switch = local->hw.wiphy->features &
NL80211_FEATURE_TDLS_CHANNEL_SWITCH;
*pos++ = WLAN_EID_EXT_CAPABILITY; *pos++ = WLAN_EID_EXT_CAPABILITY;
*pos++ = 5; /* len */ *pos++ = 5; /* len */
*pos++ = 0x0; *pos++ = 0x0;
*pos++ = 0x0; *pos++ = 0x0;
*pos++ = 0x0; *pos++ = 0x0;
*pos++ = 0x0; *pos++ = chan_switch ? WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH : 0;
*pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED; *pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED;
} }
@ -289,7 +292,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
offset = noffset; offset = noffset;
} }
ieee80211_tdls_add_ext_capab(skb); ieee80211_tdls_add_ext_capab(local, skb);
/* add the QoS element if we support it */ /* add the QoS element if we support it */
if (local->hw.queues >= IEEE80211_NUM_ACS && if (local->hw.queues >= IEEE80211_NUM_ACS &&