All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
@ 2014-02-19 15:15 Sunil Dutt Undekari
  2014-02-20  9:39 ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Sunil Dutt Undekari @ 2014-02-19 15:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: jouni, c_ppotte, djindal, usdutt

While framing the TDLS Setup Confirmation frame, the driver needs to
know if the TDLS peer is VHT/HT/WMM capable and thus shall construct
the VHT/HT operation / WMM parameter elements accordingly. Supplicant
determines if the TDLS peer is VHT/HT/WMM capable based on the
presence of the respective IEs in the received TDLS Setup Response frame.

The host driver should not need to parse the received TDLS Response
frame and thus, should be able to rely on the supplicant to indicate
the capability of the peer through additional flags while transmitting
the TDLS Setup Confirmation frame through tdls_mgmt operations.

Signed-off-by: Sunil Dutt Undekari <usdutt@qti.qualcomm.com>
---
 drivers/net/wireless/mwifiex/cfg80211.c |  4 ++--
 include/net/cfg80211.h                  |  3 ++-
 include/uapi/linux/nl80211.h            | 21 +++++++++++++++++++++
 net/wireless/nl80211.c                  |  7 ++++++-
 net/wireless/rdev-ops.h                 |  9 ++++++---
 net/wireless/trace.h                    | 12 ++++++++----
 6 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 436ba43..6948a97 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2600,8 +2600,8 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy,
 static int
 mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
 			   u8 *peer, u8 action_code, u8 dialog_token,
-			   u16 status_code, const u8 *extra_ies,
-			   size_t extra_ies_len)
+			   u16 status_code, u32 peer_capability,
+			   const u8 *extra_ies, size_t extra_ies_len)
 {
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 	int ret;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9f90554..c89a5b5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2465,7 +2465,8 @@ struct cfg80211_ops {
 
 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
 			     u8 *peer, u8 action_code,  u8 dialog_token,
-			     u16 status_code, const u8 *buf, size_t len);
+			     u16 status_code, u32 peer_capability,
+			     const u8 *buf, size_t len);
 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
 			     u8 *peer, enum nl80211_tdls_operation oper);
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index a12e6ca..3465405 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1575,6 +1575,9 @@ enum nl80211_commands {
  *	advertise values that cannot always be met. In such cases, an attempt
  *	to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
  *
+ * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
+ *	As specified in the &enum nl80211_tdls_peer_capability.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1908,6 +1911,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_MAX_AP_ASSOC_STA,
 
+	NL80211_ATTR_TDLS_PEER_CAPABILITY,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -4079,4 +4084,20 @@ struct nl80211_vendor_cmd_info {
 	__u32 subcmd;
 };
 
+/**
+ * enum nl80211_tdls_peer_capability - TDLS peer flags.
+ *
+ * Used by tdls_mgmt() to determine which conditional elements need
+ * to be added to TDLS Setup frames. 
+ *
+ * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable.
+ * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable.
+ * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable.
+ */
+enum nl80211_tdls_peer_capability {
+	NL80211_TDLS_PEER_HT = 1<<0,
+	NL80211_TDLS_PEER_VHT = 1<<1,
+	NL80211_TDLS_PEER_WMM = 1<<2,
+};
+
 #endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8e6b6a2..8114c11 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -384,6 +384,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 				   .len = IEEE80211_QOS_MAP_LEN_MAX },
 	[NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN },
 	[NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 },
+	[NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 },
 };
 
 /* policy for the key attributes */
@@ -7269,6 +7270,7 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
 	struct net_device *dev = info->user_ptr[1];
 	u8 action_code, dialog_token;
+	u32 peer_capability = 0;
 	u16 status_code;
 	u8 *peer;
 
@@ -7287,9 +7289,12 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
 	action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]);
 	status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]);
 	dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]);
+	if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY])
+		peer_capability =
+			nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]);
 
 	return rdev_tdls_mgmt(rdev, dev, peer, action_code,
-			      dialog_token, status_code,
+			      dialog_token, status_code, peer_capability,
 			      nla_data(info->attrs[NL80211_ATTR_IE]),
 			      nla_len(info->attrs[NL80211_ATTR_IE]));
 }
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index c8e2259..74d97d3 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -769,13 +769,16 @@ static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
 				 struct net_device *dev, u8 *peer,
 				 u8 action_code, u8 dialog_token,
-				 u16 status_code, const u8 *buf, size_t len)
+				 u16 status_code, u32 peer_capability,
+				 const u8 *buf, size_t len)
 {
 	int ret;
 	trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
-			     dialog_token, status_code, buf, len);
+			     dialog_token, status_code, peer_capability,
+			     buf, len);
 	ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
-				   dialog_token, status_code, buf, len);
+				   dialog_token, status_code, peer_capability,
+				   buf, len);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 5eaeed5..aabccf1 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1468,9 +1468,10 @@ TRACE_EVENT(rdev_sched_scan_start,
 TRACE_EVENT(rdev_tdls_mgmt,
 	TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
 		 u8 *peer, u8 action_code, u8 dialog_token,
-		 u16 status_code, const u8 *buf, size_t len),
+		 u16 status_code, u32 peer_capability,
+		 const u8 *buf, size_t len),
 	TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code,
-		buf, len),
+		peer_capability, buf, len),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
 		NETDEV_ENTRY
@@ -1478,6 +1479,7 @@ TRACE_EVENT(rdev_tdls_mgmt,
 		__field(u8, action_code)
 		__field(u8, dialog_token)
 		__field(u16, status_code)
+		__field(u32, peer_capability)
 		__dynamic_array(u8, buf, len)
 	),
 	TP_fast_assign(
@@ -1487,13 +1489,15 @@ TRACE_EVENT(rdev_tdls_mgmt,
 		__entry->action_code = action_code;
 		__entry->dialog_token = dialog_token;
 		__entry->status_code = status_code;
+		__entry->peer_capability = peer_capability;
 		memcpy(__get_dynamic_array(buf), buf, len);
 	),
 	TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", action_code: %u, "
-		  "dialog_token: %u, status_code: %u, buf: %#.2x ",
+		  "dialog_token: %u, status_code: %u, peer_capability: %u buf: %#.2x ",
 		  WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer),
 		  __entry->action_code, __entry->dialog_token,
-		  __entry->status_code, ((u8 *)__get_dynamic_array(buf))[0])
+		  __entry->status_code, __entry->peer_capability,
+		  ((u8 *)__get_dynamic_array(buf))[0])
 );
 
 TRACE_EVENT(rdev_dump_survey,
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-19 15:15 [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt Sunil Dutt Undekari
@ 2014-02-20  9:39 ` Johannes Berg
  2014-02-20  9:49   ` Jouni Malinen
  2014-02-20  9:56   ` Johannes Berg
  0 siblings, 2 replies; 9+ messages in thread
From: Johannes Berg @ 2014-02-20  9:39 UTC (permalink / raw)
  To: Sunil Dutt Undekari; +Cc: linux-wireless, jouni, c_ppotte, djindal

Generally, the patch looks fine, but I think you need to modify mac80211
as well, and the mwifiex patch doesn't apply to my mac80211-next tree.

johannes


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-20  9:39 ` Johannes Berg
@ 2014-02-20  9:49   ` Jouni Malinen
  2014-02-20  9:53     ` Johannes Berg
  2014-02-20  9:56   ` Johannes Berg
  1 sibling, 1 reply; 9+ messages in thread
From: Jouni Malinen @ 2014-02-20  9:49 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Sunil Dutt Undekari, linux-wireless, c_ppotte, djindal

On Thu, Feb 20, 2014 at 10:39:21AM +0100, Johannes Berg wrote:
> Generally, the patch looks fine, but I think you need to modify mac80211
> as well, and the mwifiex patch doesn't apply to my mac80211-next tree.

How do you want to handle mwifiex then? That function is in
wireless-testing.git and if the cfg80211 API change goes through
mac80211-next that does not have mwifiex change, I'd assume the build
will break once that gets merged into wireless-testing (or whatever is
the first tree getting changes from both)?

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-20  9:49   ` Jouni Malinen
@ 2014-02-20  9:53     ` Johannes Berg
  2014-02-20  9:58       ` Jouni Malinen
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2014-02-20  9:53 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: Sunil Dutt Undekari, linux-wireless, c_ppotte, djindal

On Thu, 2014-02-20 at 11:49 +0200, Jouni Malinen wrote:
> On Thu, Feb 20, 2014 at 10:39:21AM +0100, Johannes Berg wrote:
> > Generally, the patch looks fine, but I think you need to modify mac80211
> > as well, and the mwifiex patch doesn't apply to my mac80211-next tree.
> 
> How do you want to handle mwifiex then? That function is in
> wireless-testing.git and if the cfg80211 API change goes through
> mac80211-next that does not have mwifiex change, I'd assume the build
> will break once that gets merged into wireless-testing (or whatever is
> the first tree getting changes from both)?

Hmm, dunno. I could merge wireless-next into mac80211-next, if that
helps?

johannes


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-20  9:39 ` Johannes Berg
  2014-02-20  9:49   ` Jouni Malinen
@ 2014-02-20  9:56   ` Johannes Berg
  1 sibling, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2014-02-20  9:56 UTC (permalink / raw)
  To: Sunil Dutt Undekari; +Cc: linux-wireless, jouni, c_ppotte, djindal

On Thu, 2014-02-20 at 10:39 +0100, Johannes Berg wrote:
> Generally, the patch looks fine, but I think you need to modify mac80211
> as well, and the mwifiex patch doesn't apply to my mac80211-next tree.

Also

$ git am -s /tmp/\[PATCH\]_cfg80211
\:_Pass_TDLS_peer_capability_information_in_tdls_mgmt.mbox
Applying: cfg80211: Pass TDLS peer capability information in tdls_mgmt
/home/johannes/sys/wireless/.git/rebase-apply/patch:70: trailing
whitespace.
 * to be added to TDLS Setup frames. 
warning: 1 line adds whitespace errors.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-20  9:53     ` Johannes Berg
@ 2014-02-20  9:58       ` Jouni Malinen
  2014-02-20 10:00         ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Jouni Malinen @ 2014-02-20  9:58 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Sunil Dutt Undekari, linux-wireless, c_ppotte, djindal

On Thu, Feb 20, 2014 at 10:53:57AM +0100, Johannes Berg wrote:
> On Thu, 2014-02-20 at 11:49 +0200, Jouni Malinen wrote:
> > On Thu, Feb 20, 2014 at 10:39:21AM +0100, Johannes Berg wrote:
> > > Generally, the patch looks fine, but I think you need to modify mac80211
> > > as well, and the mwifiex patch doesn't apply to my mac80211-next tree.
> > 
> > How do you want to handle mwifiex then? That function is in
> > wireless-testing.git and if the cfg80211 API change goes through
> > mac80211-next that does not have mwifiex change, I'd assume the build
> > will break once that gets merged into wireless-testing (or whatever is
> > the first tree getting changes from both)?
> 
> Hmm, dunno. I could merge wireless-next into mac80211-next, if that
> helps?

It looks like the patch would apply cleanly to the current snapshot of
wireless-next, so this would likely allow cleaner path for getting this
in without leaving hidden issues for future merges.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-20  9:58       ` Jouni Malinen
@ 2014-02-20 10:00         ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2014-02-20 10:00 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: Sunil Dutt Undekari, linux-wireless, c_ppotte, djindal

On Thu, 2014-02-20 at 11:58 +0200, Jouni Malinen wrote:
> On Thu, Feb 20, 2014 at 10:53:57AM +0100, Johannes Berg wrote:
> > On Thu, 2014-02-20 at 11:49 +0200, Jouni Malinen wrote:
> > > On Thu, Feb 20, 2014 at 10:39:21AM +0100, Johannes Berg wrote:
> > > > Generally, the patch looks fine, but I think you need to modify mac80211
> > > > as well, and the mwifiex patch doesn't apply to my mac80211-next tree.
> > > 
> > > How do you want to handle mwifiex then? That function is in
> > > wireless-testing.git and if the cfg80211 API change goes through
> > > mac80211-next that does not have mwifiex change, I'd assume the build
> > > will break once that gets merged into wireless-testing (or whatever is
> > > the first tree getting changes from both)?
> > 
> > Hmm, dunno. I could merge wireless-next into mac80211-next, if that
> > helps?
> 
> It looks like the patch would apply cleanly to the current snapshot of
> wireless-next, so this would likely allow cleaner path for getting this
> in without leaving hidden issues for future merges.

Yeah I just tried that. Once Sunil resubmits the patch with the other
stuff fixed I'll merge wireless-next/master before the patch.

johannes


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
  2014-02-20 10:06 Sunil Dutt Undekari
@ 2014-02-20 10:10 ` Jouni Malinen
  0 siblings, 0 replies; 9+ messages in thread
From: Jouni Malinen @ 2014-02-20 10:10 UTC (permalink / raw)
  To: Sunil Dutt Undekari; +Cc: linux-wireless, c_ppotte, djindal

On Thu, Feb 20, 2014 at 03:36:28PM +0530, Sunil Dutt Undekari wrote:
> While framing the TDLS Setup Confirmation frame, the driver needs to
> know if the TDLS peer is VHT/HT/WMM capable and thus shall construct
> the VHT/HT operation / WMM parameter elements accordingly. Supplicant
> determines if the TDLS peer is VHT/HT/WMM capable based on the
> presence of the respective IEs in the received TDLS Setup Response frame.
> 
> The host driver should not need to parse the received TDLS Response
> frame and thus, should be able to rely on the supplicant to indicate
> the capability of the peer through additional flags while transmitting
> the TDLS Setup Confirmation frame through tdls_mgmt operations.
> 
> Signed-off-by: Sunil Dutt Undekari <usdutt@qti.qualcomm.com>
> ---
>  drivers/net/wireless/mwifiex/cfg80211.c |  4 ++--
>  include/net/cfg80211.h                  |  3 ++-
>  include/uapi/linux/nl80211.h            | 21 +++++++++++++++++++++
>  net/wireless/nl80211.c                  |  7 ++++++-
>  net/wireless/rdev-ops.h                 |  9 ++++++---
>  net/wireless/trace.h                    | 12 ++++++++----

This needs to add following:

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 363d19b..bcc65ef 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3647,8 +3647,8 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,
 
 static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
 			       u8 *peer, u8 action_code, u8 dialog_token,
-			       u16 status_code, const u8 *extra_ies,
-			       size_t extra_ies_len)
+			       u16 status_code, u32 peer_capability,
+			       const u8 *extra_ies, size_t extra_ies_len)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct ieee80211_local *local = sdata->local;


-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt
@ 2014-02-20 10:06 Sunil Dutt Undekari
  2014-02-20 10:10 ` Jouni Malinen
  0 siblings, 1 reply; 9+ messages in thread
From: Sunil Dutt Undekari @ 2014-02-20 10:06 UTC (permalink / raw)
  To: linux-wireless; +Cc: jouni, c_ppotte, djindal, usdutt

While framing the TDLS Setup Confirmation frame, the driver needs to
know if the TDLS peer is VHT/HT/WMM capable and thus shall construct
the VHT/HT operation / WMM parameter elements accordingly. Supplicant
determines if the TDLS peer is VHT/HT/WMM capable based on the
presence of the respective IEs in the received TDLS Setup Response frame.

The host driver should not need to parse the received TDLS Response
frame and thus, should be able to rely on the supplicant to indicate
the capability of the peer through additional flags while transmitting
the TDLS Setup Confirmation frame through tdls_mgmt operations.

Signed-off-by: Sunil Dutt Undekari <usdutt@qti.qualcomm.com>
---
 drivers/net/wireless/mwifiex/cfg80211.c |  4 ++--
 include/net/cfg80211.h                  |  3 ++-
 include/uapi/linux/nl80211.h            | 21 +++++++++++++++++++++
 net/wireless/nl80211.c                  |  7 ++++++-
 net/wireless/rdev-ops.h                 |  9 ++++++---
 net/wireless/trace.h                    | 12 ++++++++----
 6 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 436ba43..6948a97 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2600,8 +2600,8 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy,
 static int
 mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
 			   u8 *peer, u8 action_code, u8 dialog_token,
-			   u16 status_code, const u8 *extra_ies,
-			   size_t extra_ies_len)
+			   u16 status_code, u32 peer_capability,
+			   const u8 *extra_ies, size_t extra_ies_len)
 {
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 	int ret;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9f90554..c89a5b5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2465,7 +2465,8 @@ struct cfg80211_ops {
 
 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
 			     u8 *peer, u8 action_code,  u8 dialog_token,
-			     u16 status_code, const u8 *buf, size_t len);
+			     u16 status_code, u32 peer_capability,
+			     const u8 *buf, size_t len);
 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
 			     u8 *peer, enum nl80211_tdls_operation oper);
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index a12e6ca..a0f133f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1575,6 +1575,9 @@ enum nl80211_commands {
  *	advertise values that cannot always be met. In such cases, an attempt
  *	to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
  *
+ * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
+ *	As specified in the &enum nl80211_tdls_peer_capability.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1908,6 +1911,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_MAX_AP_ASSOC_STA,
 
+	NL80211_ATTR_TDLS_PEER_CAPABILITY,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -4079,4 +4084,20 @@ struct nl80211_vendor_cmd_info {
 	__u32 subcmd;
 };
 
+/**
+ * enum nl80211_tdls_peer_capability - TDLS peer flags.
+ *
+ * Used by tdls_mgmt() to determine which conditional elements need
+ * to be added to TDLS Setup frames.
+ *
+ * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable.
+ * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable.
+ * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable.
+ */
+enum nl80211_tdls_peer_capability {
+	NL80211_TDLS_PEER_HT = 1<<0,
+	NL80211_TDLS_PEER_VHT = 1<<1,
+	NL80211_TDLS_PEER_WMM = 1<<2,
+};
+
 #endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8e6b6a2..8114c11 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -384,6 +384,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 				   .len = IEEE80211_QOS_MAP_LEN_MAX },
 	[NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN },
 	[NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 },
+	[NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 },
 };
 
 /* policy for the key attributes */
@@ -7269,6 +7270,7 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
 	struct net_device *dev = info->user_ptr[1];
 	u8 action_code, dialog_token;
+	u32 peer_capability = 0;
 	u16 status_code;
 	u8 *peer;
 
@@ -7287,9 +7289,12 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
 	action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]);
 	status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]);
 	dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]);
+	if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY])
+		peer_capability =
+			nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]);
 
 	return rdev_tdls_mgmt(rdev, dev, peer, action_code,
-			      dialog_token, status_code,
+			      dialog_token, status_code, peer_capability,
 			      nla_data(info->attrs[NL80211_ATTR_IE]),
 			      nla_len(info->attrs[NL80211_ATTR_IE]));
 }
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index c8e2259..74d97d3 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -769,13 +769,16 @@ static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
 				 struct net_device *dev, u8 *peer,
 				 u8 action_code, u8 dialog_token,
-				 u16 status_code, const u8 *buf, size_t len)
+				 u16 status_code, u32 peer_capability,
+				 const u8 *buf, size_t len)
 {
 	int ret;
 	trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
-			     dialog_token, status_code, buf, len);
+			     dialog_token, status_code, peer_capability,
+			     buf, len);
 	ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
-				   dialog_token, status_code, buf, len);
+				   dialog_token, status_code, peer_capability,
+				   buf, len);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 5eaeed5..aabccf1 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1468,9 +1468,10 @@ TRACE_EVENT(rdev_sched_scan_start,
 TRACE_EVENT(rdev_tdls_mgmt,
 	TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
 		 u8 *peer, u8 action_code, u8 dialog_token,
-		 u16 status_code, const u8 *buf, size_t len),
+		 u16 status_code, u32 peer_capability,
+		 const u8 *buf, size_t len),
 	TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code,
-		buf, len),
+		peer_capability, buf, len),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
 		NETDEV_ENTRY
@@ -1478,6 +1479,7 @@ TRACE_EVENT(rdev_tdls_mgmt,
 		__field(u8, action_code)
 		__field(u8, dialog_token)
 		__field(u16, status_code)
+		__field(u32, peer_capability)
 		__dynamic_array(u8, buf, len)
 	),
 	TP_fast_assign(
@@ -1487,13 +1489,15 @@ TRACE_EVENT(rdev_tdls_mgmt,
 		__entry->action_code = action_code;
 		__entry->dialog_token = dialog_token;
 		__entry->status_code = status_code;
+		__entry->peer_capability = peer_capability;
 		memcpy(__get_dynamic_array(buf), buf, len);
 	),
 	TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", action_code: %u, "
-		  "dialog_token: %u, status_code: %u, buf: %#.2x ",
+		  "dialog_token: %u, status_code: %u, peer_capability: %u buf: %#.2x ",
 		  WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer),
 		  __entry->action_code, __entry->dialog_token,
-		  __entry->status_code, ((u8 *)__get_dynamic_array(buf))[0])
+		  __entry->status_code, __entry->peer_capability,
+		  ((u8 *)__get_dynamic_array(buf))[0])
 );
 
 TRACE_EVENT(rdev_dump_survey,
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-20 10:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-19 15:15 [PATCH] cfg80211: Pass TDLS peer capability information in tdls_mgmt Sunil Dutt Undekari
2014-02-20  9:39 ` Johannes Berg
2014-02-20  9:49   ` Jouni Malinen
2014-02-20  9:53     ` Johannes Berg
2014-02-20  9:58       ` Jouni Malinen
2014-02-20 10:00         ` Johannes Berg
2014-02-20  9:56   ` Johannes Berg
2014-02-20 10:06 Sunil Dutt Undekari
2014-02-20 10:10 ` Jouni Malinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.