All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20
@ 2018-04-20 10:49 Luca Coelho
  2018-04-20 10:49 ` [PATCH 1/9] mac80211: rename rtap_vendor_space to rtap_space Luca Coelho
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Luca Coelho

From: Luca Coelho <luciano.coelho@intel.com>

Hi,

Some patches with mac80211 and cfg80211 changes from our internal
tree.

Please review, though you have already reviewed most if not all of
them ;)

Cheers,
Luca.


Gregory Greenman (1):
  mac80211: add api to set CSA counter in mac80211

Haim Dreyfuss (1):
  nl80211: Add wmm rule attribute to NL80211_CMD_GET_WIPHY dump command.

Ilan Peer (2):
  mac80211: Adjust SAE authentication timeout
  mac80211: Support adding duration for prepare_tx() callback

Johannes Berg (4):
  mac80211: rename rtap_vendor_space to rtap_space
  mac80211: clean up rate info bandwidth setting
  mac80211: ethtool: memset the whole sinfo struct to 0
  mac80211: remove pointless flags=0 assignment

Sara Sharon (1):
  mac80211: use timeout from the AddBA response instead of the request

 drivers/net/wireless/ath/ath9k/main.c         |  3 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  6 +-
 include/net/mac80211.h                        | 18 +++++-
 include/uapi/linux/nl80211.h                  | 28 +++++++++
 net/mac80211/agg-tx.c                         |  4 ++
 net/mac80211/driver-ops.h                     |  8 ++-
 net/mac80211/ethtool.c                        |  5 +-
 net/mac80211/mlme.c                           | 42 +++++++++-----
 net/mac80211/rx.c                             | 40 +++++++------
 net/mac80211/sta_info.c                       |  2 +-
 net/mac80211/trace.h                          | 25 +++++++-
 net/mac80211/tx.c                             | 28 ++++++++-
 net/mac80211/util.c                           |  6 +-
 net/wireless/nl80211.c                        | 57 +++++++++++++++++--
 14 files changed, 217 insertions(+), 55 deletions(-)

-- 
2.17.0

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

* [PATCH 1/9] mac80211: rename rtap_vendor_space to rtap_space
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 2/9] mac80211: use timeout from the AddBA response instead of the request Luca Coelho
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Since all the HE data won't fit into struct ieee80211_rx_status,
we'll (have to) move that into the SKB proper. This means we'll
need to skip over more things in the future, so rename this to
remove the vendor-only notion from it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/rx.c | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 03102aff0953..0a38cc1cbebc 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5,6 +5,7 @@
  * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
+ * Copyright (C) 2018 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -97,27 +98,27 @@ static u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
  */
 static void remove_monitor_info(struct sk_buff *skb,
 				unsigned int present_fcs_len,
-				unsigned int rtap_vendor_space)
+				unsigned int rtap_space)
 {
 	if (present_fcs_len)
 		__pskb_trim(skb, skb->len - present_fcs_len);
-	__pskb_pull(skb, rtap_vendor_space);
+	__pskb_pull(skb, rtap_space);
 }
 
 static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len,
-				     unsigned int rtap_vendor_space)
+				     unsigned int rtap_space)
 {
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 	struct ieee80211_hdr *hdr;
 
-	hdr = (void *)(skb->data + rtap_vendor_space);
+	hdr = (void *)(skb->data + rtap_space);
 
 	if (status->flag & (RX_FLAG_FAILED_FCS_CRC |
 			    RX_FLAG_FAILED_PLCP_CRC |
 			    RX_FLAG_ONLY_MONITOR))
 		return true;
 
-	if (unlikely(skb->len < 16 + present_fcs_len + rtap_vendor_space))
+	if (unlikely(skb->len < 16 + present_fcs_len + rtap_space))
 		return true;
 
 	if (ieee80211_is_ctl(hdr->frame_control) &&
@@ -199,7 +200,7 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
 
 static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata,
 					 struct sk_buff *skb,
-					 int rtap_vendor_space)
+					 int rtap_space)
 {
 	struct {
 		struct ieee80211_hdr_3addr hdr;
@@ -212,14 +213,14 @@ static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata,
 
 	BUILD_BUG_ON(sizeof(action) != IEEE80211_MIN_ACTION_SIZE + 1);
 
-	if (skb->len < rtap_vendor_space + sizeof(action) +
+	if (skb->len < rtap_space + sizeof(action) +
 		       VHT_MUMIMO_GROUPS_DATA_LEN)
 		return;
 
 	if (!is_valid_ether_addr(sdata->u.mntr.mu_follow_addr))
 		return;
 
-	skb_copy_bits(skb, rtap_vendor_space, &action, sizeof(action));
+	skb_copy_bits(skb, rtap_space, &action, sizeof(action));
 
 	if (!ieee80211_is_action(action.hdr.frame_control))
 		return;
@@ -545,7 +546,7 @@ static struct sk_buff *
 ieee80211_make_monitor_skb(struct ieee80211_local *local,
 			   struct sk_buff **origskb,
 			   struct ieee80211_rate *rate,
-			   int rtap_vendor_space, bool use_origskb)
+			   int rtap_space, bool use_origskb)
 {
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(*origskb);
 	int rt_hdrlen, needed_headroom;
@@ -553,7 +554,7 @@ ieee80211_make_monitor_skb(struct ieee80211_local *local,
 
 	/* room for the radiotap header based on driver features */
 	rt_hdrlen = ieee80211_rx_radiotap_hdrlen(local, status, *origskb);
-	needed_headroom = rt_hdrlen - rtap_vendor_space;
+	needed_headroom = rt_hdrlen - rtap_space;
 
 	if (use_origskb) {
 		/* only need to expand headroom if necessary */
@@ -607,7 +608,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 	struct ieee80211_sub_if_data *sdata;
 	struct sk_buff *monskb = NULL;
 	int present_fcs_len = 0;
-	unsigned int rtap_vendor_space = 0;
+	unsigned int rtap_space = 0;
 	struct ieee80211_sub_if_data *monitor_sdata =
 		rcu_dereference(local->monitor_sdata);
 	bool only_monitor = false;
@@ -615,7 +616,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 	if (unlikely(status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA)) {
 		struct ieee80211_vendor_radiotap *rtap = (void *)origskb->data;
 
-		rtap_vendor_space = sizeof(*rtap) + rtap->len + rtap->pad;
+		rtap_space += sizeof(*rtap) + rtap->len + rtap->pad;
 	}
 
 	/*
@@ -638,13 +639,12 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 	}
 
 	/* ensure hdr->frame_control and vendor radiotap data are in skb head */
-	if (!pskb_may_pull(origskb, 2 + rtap_vendor_space)) {
+	if (!pskb_may_pull(origskb, 2 + rtap_space)) {
 		dev_kfree_skb(origskb);
 		return NULL;
 	}
 
-	only_monitor = should_drop_frame(origskb, present_fcs_len,
-					 rtap_vendor_space);
+	only_monitor = should_drop_frame(origskb, present_fcs_len, rtap_space);
 
 	if (!local->monitors || (status->flag & RX_FLAG_SKIP_MONITOR)) {
 		if (only_monitor) {
@@ -652,12 +652,11 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 			return NULL;
 		}
 
-		remove_monitor_info(origskb, present_fcs_len,
-				    rtap_vendor_space);
+		remove_monitor_info(origskb, present_fcs_len, rtap_space);
 		return origskb;
 	}
 
-	ieee80211_handle_mu_mimo_mon(monitor_sdata, origskb, rtap_vendor_space);
+	ieee80211_handle_mu_mimo_mon(monitor_sdata, origskb, rtap_space);
 
 	list_for_each_entry_rcu(sdata, &local->mon_list, u.mntr.list) {
 		bool last_monitor = list_is_last(&sdata->u.mntr.list,
@@ -665,8 +664,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 
 		if (!monskb)
 			monskb = ieee80211_make_monitor_skb(local, &origskb,
-							    rate,
-							    rtap_vendor_space,
+							    rate, rtap_space,
 							    only_monitor &&
 							    last_monitor);
 
@@ -698,7 +696,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 	if (!origskb)
 		return NULL;
 
-	remove_monitor_info(origskb, present_fcs_len, rtap_vendor_space);
+	remove_monitor_info(origskb, present_fcs_len, rtap_space);
 	return origskb;
 }
 
-- 
2.17.0

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

* [PATCH 2/9] mac80211: use timeout from the AddBA response instead of the request
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
  2018-04-20 10:49 ` [PATCH 1/9] mac80211: rename rtap_vendor_space to rtap_space Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 3/9] mac80211: Adjust SAE authentication timeout Luca Coelho
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Sara Sharon, Luca Coelho

From: Sara Sharon <sara.sharon@intel.com>

2016 spec, section 10.24.2 specifies that the block ack
timeout in the ADD BA request is advisory.

That means we should check the value in the response and
act upon it (same as buffer size).

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/mac80211/agg-tx.c | 4 ++++
 net/mac80211/tx.c     | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 595c662a61e8..ac4295296514 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -8,6 +8,7 @@
  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  * Copyright 2007-2010, Intel Corporation
  * Copyright(c) 2015-2017 Intel Deutschland GmbH
+ * Copyright (C) 2018 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -970,6 +971,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
 
 		sta->ampdu_mlme.addba_req_num[tid] = 0;
 
+		tid_tx->timeout =
+			le16_to_cpu(mgmt->u.action.u.addba_resp.timeout);
+
 		if (tid_tx->timeout) {
 			mod_timer(&tid_tx->session_timer,
 				  TU_TO_EXP_TIME(tid_tx->timeout));
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 535de3161a78..05a265cd573d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4,6 +4,7 @@
  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
  * Copyright 2007	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Copyright (C) 2018 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -1135,7 +1136,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
 	}
 
 	/* reset session timer */
-	if (reset_agg_timer && tid_tx->timeout)
+	if (reset_agg_timer)
 		tid_tx->last_tx = jiffies;
 
 	return queued;
-- 
2.17.0

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

* [PATCH 3/9] mac80211: Adjust SAE authentication timeout
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
  2018-04-20 10:49 ` [PATCH 1/9] mac80211: rename rtap_vendor_space to rtap_space Luca Coelho
  2018-04-20 10:49 ` [PATCH 2/9] mac80211: use timeout from the AddBA response instead of the request Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 4/9] mac80211: clean up rate info bandwidth setting Luca Coelho
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Ilan Peer, Luca Coelho

From: Ilan Peer <ilan.peer@intel.com>

The IEEE P802.11-REVmd D1.0 specification updated the SAE authentication
timeout to be 2000 milliseconds (see dot11RSNASAERetransPeriod). Update
the SAE timeout setting accordingly.

While at it, reduce some code duplication in the timeout configuration.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/mac80211/mlme.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 69449db7e283..51021d3d2d18 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -36,6 +36,7 @@
 #define IEEE80211_AUTH_TIMEOUT		(HZ / 5)
 #define IEEE80211_AUTH_TIMEOUT_LONG	(HZ / 2)
 #define IEEE80211_AUTH_TIMEOUT_SHORT	(HZ / 10)
+#define IEEE80211_AUTH_TIMEOUT_SAE	(HZ * 2)
 #define IEEE80211_AUTH_MAX_TRIES	3
 #define IEEE80211_AUTH_WAIT_ASSOC	(HZ * 5)
 #define IEEE80211_ASSOC_TIMEOUT		(HZ / 5)
@@ -3814,16 +3815,19 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
 			    tx_flags);
 
 	if (tx_flags == 0) {
-		auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
-		auth_data->timeout_started = true;
-		run_again(sdata, auth_data->timeout);
+		if (auth_data->algorithm == WLAN_AUTH_SAE)
+			auth_data->timeout = jiffies +
+				IEEE80211_AUTH_TIMEOUT_SAE;
+		else
+			auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
 	} else {
 		auth_data->timeout =
 			round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG);
-		auth_data->timeout_started = true;
-		run_again(sdata, auth_data->timeout);
 	}
 
+	auth_data->timeout_started = true;
+	run_again(sdata, auth_data->timeout);
+
 	return 0;
 }
 
@@ -3894,8 +3898,15 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
 		ifmgd->status_received = false;
 		if (ifmgd->auth_data && ieee80211_is_auth(fc)) {
 			if (status_acked) {
-				ifmgd->auth_data->timeout =
-					jiffies + IEEE80211_AUTH_TIMEOUT_SHORT;
+				if (ifmgd->auth_data->algorithm ==
+				    WLAN_AUTH_SAE)
+					ifmgd->auth_data->timeout =
+						jiffies +
+						IEEE80211_AUTH_TIMEOUT_SAE;
+				else
+					ifmgd->auth_data->timeout =
+						jiffies +
+						IEEE80211_AUTH_TIMEOUT_SHORT;
 				run_again(sdata, ifmgd->auth_data->timeout);
 			} else {
 				ifmgd->auth_data->timeout = jiffies - 1;
-- 
2.17.0

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

* [PATCH 4/9] mac80211: clean up rate info bandwidth setting
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
                   ` (2 preceding siblings ...)
  2018-04-20 10:49 ` [PATCH 3/9] mac80211: Adjust SAE authentication timeout Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 5/9] mac80211: ethtool: memset the whole sinfo struct to 0 Luca Coelho
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

There's no need to do the same thing three times in
the different switch cases, pull that out to a single
place.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/util.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 11f9cfc016d9..2d82c88efd0b 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2793,12 +2793,13 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 
 	memset(&ri, 0, sizeof(ri));
 
+	ri.bw = status->bw;
+
 	/* Fill cfg80211 rate info */
 	switch (status->encoding) {
 	case RX_ENC_HT:
 		ri.mcs = status->rate_idx;
 		ri.flags |= RATE_INFO_FLAGS_MCS;
-		ri.bw = status->bw;
 		if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
 			ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
 		break;
@@ -2806,7 +2807,6 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 		ri.flags |= RATE_INFO_FLAGS_VHT_MCS;
 		ri.mcs = status->rate_idx;
 		ri.nss = status->nss;
-		ri.bw = status->bw;
 		if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
 			ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
 		break;
@@ -2818,8 +2818,6 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 		int shift = 0;
 		int bitrate;
 
-		ri.bw = status->bw;
-
 		switch (status->bw) {
 		case RATE_INFO_BW_10:
 			shift = 1;
-- 
2.17.0

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

* [PATCH 5/9] mac80211: ethtool: memset the whole sinfo struct to 0
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
                   ` (3 preceding siblings ...)
  2018-04-20 10:49 ` [PATCH 4/9] mac80211: clean up rate info bandwidth setting Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 6/9] mac80211: remove pointless flags=0 assignment Luca Coelho
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Rather than just setting the valid flags to 0 set the
whole struct to 0 since other places might rely on it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/ethtool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c
index 9cc986deda61..08408520c3f8 100644
--- a/net/mac80211/ethtool.c
+++ b/net/mac80211/ethtool.c
@@ -4,6 +4,7 @@
  * Copied from cfg.c - originally
  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2014	Intel Corporation (Author: Johannes Berg)
+ * Copyright (C) 2018 Intel Corporation
  *
  * This file is GPLv2 as found in COPYING.
  */
@@ -106,7 +107,7 @@ static void ieee80211_get_stats(struct net_device *dev,
 		if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
 			goto do_survey;
 
-		sinfo.filled = 0;
+		memset(&sinfo, 0, sizeof(sinfo));
 		sta_set_sinfo(sta, &sinfo);
 
 		i = 0;
@@ -133,7 +134,7 @@ static void ieee80211_get_stats(struct net_device *dev,
 			if (sta->sdata->dev != dev)
 				continue;
 
-			sinfo.filled = 0;
+			memset(&sinfo, 0, sizeof(sinfo));
 			sta_set_sinfo(sta, &sinfo);
 			i = 0;
 			ADD_STA_STATS(sta);
-- 
2.17.0

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

* [PATCH 6/9] mac80211: remove pointless flags=0 assignment
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
                   ` (4 preceding siblings ...)
  2018-04-20 10:49 ` [PATCH 5/9] mac80211: ethtool: memset the whole sinfo struct to 0 Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 7/9] mac80211: add api to set CSA counter in mac80211 Luca Coelho
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

The data structure is initialized to all zeroes, and
we already rely on that in other places, so remove the
pointless assignment to 0.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/sta_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 655c3d8b0d80..2d5ffb0a16f6 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -3,6 +3,7 @@
  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
+ * Copyright (C) 2018 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -1992,7 +1993,6 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u16 rate,
 		int band = STA_STATS_GET(LEGACY_BAND, rate);
 		int rate_idx = STA_STATS_GET(LEGACY_IDX, rate);
 
-		rinfo->flags = 0;
 		sband = local->hw.wiphy->bands[band];
 		brate = sband->bitrates[rate_idx].bitrate;
 		if (rinfo->bw == RATE_INFO_BW_5)
-- 
2.17.0

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

* [PATCH 7/9] mac80211: add api to set CSA counter in mac80211
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
                   ` (5 preceding siblings ...)
  2018-04-20 10:49 ` [PATCH 6/9] mac80211: remove pointless flags=0 assignment Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 10:49 ` [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback Luca Coelho
  2018-04-20 10:49 ` [PATCH 9/9] nl80211: Add wmm rule attribute to NL80211_CMD_GET_WIPHY dump command Luca Coelho
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Gregory Greenman, Luca Coelho

From: Gregory Greenman <gregory.greenman@intel.com>

Sometimes the most updated CSA counter values are known only
to the device. Add an API to pass this data to mac80211.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 include/net/mac80211.h | 13 +++++++++++++
 net/mac80211/tx.c      | 25 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d2279b2d61aa..52f36c43f35f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4449,6 +4449,19 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
  */
 u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif);
 
+/**
+ * ieee80211_csa_set_counter - request mac80211 to set csa counter
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @counter: the new value for the counter
+ *
+ * The csa counter can be changed by the device, this API should be
+ * used by the device driver to update csa counter in mac80211.
+ *
+ * It should never be used together with ieee80211_csa_update_counter(),
+ * as it will cause a race condition around the counter value.
+ */
+void ieee80211_csa_set_counter(struct ieee80211_vif *vif, u8 counter);
+
 /**
  * ieee80211_csa_finish - notify mac80211 about channel switch
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 05a265cd573d..34499f6300d8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4085,6 +4085,31 @@ u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
 }
 EXPORT_SYMBOL(ieee80211_csa_update_counter);
 
+void ieee80211_csa_set_counter(struct ieee80211_vif *vif, u8 counter)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+	struct beacon_data *beacon = NULL;
+
+	rcu_read_lock();
+
+	if (sdata->vif.type == NL80211_IFTYPE_AP)
+		beacon = rcu_dereference(sdata->u.ap.beacon);
+	else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+		beacon = rcu_dereference(sdata->u.ibss.presp);
+	else if (ieee80211_vif_is_mesh(&sdata->vif))
+		beacon = rcu_dereference(sdata->u.mesh.beacon);
+
+	if (!beacon)
+		goto unlock;
+
+	if (counter < beacon->csa_current_counter)
+		beacon->csa_current_counter = counter;
+
+unlock:
+	rcu_read_unlock();
+}
+EXPORT_SYMBOL(ieee80211_csa_set_counter);
+
 bool ieee80211_csa_is_complete(struct ieee80211_vif *vif)
 {
 	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-- 
2.17.0

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

* [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
                   ` (6 preceding siblings ...)
  2018-04-20 10:49 ` [PATCH 7/9] mac80211: add api to set CSA counter in mac80211 Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  2018-04-20 19:43   ` Peter Oh
  2018-04-20 10:49 ` [PATCH 9/9] nl80211: Add wmm rule attribute to NL80211_CMD_GET_WIPHY dump command Luca Coelho
  8 siblings, 1 reply; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Ilan Peer, Luca Coelho

From: Ilan Peer <ilan.peer@intel.com>

There are specific cases, such as SAE authentication exchange, that
might require long duration to complete. For such cases, add support
for indicating to the driver the required duration of the prepare_tx()
operation, so the driver would still be able to complete the frame
exchange.

Currently, indicate the duration only for SAE authentication exchange,
as SAE authentication can take up to 2000 msec (as defined in IEEE
P802.11-REVmd D1.0 p. 3504).

As the patch modified the prepare_tx() callback API, also modify
the relevant code in iwlwifi.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/ath/ath9k/main.c         |  3 ++-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  6 ++++-
 include/net/mac80211.h                        |  5 +++-
 net/mac80211/driver-ops.h                     |  8 +++---
 net/mac80211/mlme.c                           | 17 ++++++++-----
 net/mac80211/trace.h                          | 25 ++++++++++++++++---
 6 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a3be8add56e1..b6663c80e7dd 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2544,7 +2544,8 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,
 }
 
 static void ath9k_mgd_prepare_tx(struct ieee80211_hw *hw,
-				 struct ieee80211_vif *vif)
+				 struct ieee80211_vif *vif,
+				 u16 duration)
 {
 	struct ath_softc *sc = hw->priv;
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 51b30424575b..4e428427d1ba 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2810,7 +2810,8 @@ static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
 }
 
 static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
-				      struct ieee80211_vif *vif)
+				       struct ieee80211_vif *vif,
+				       u16 req_duration)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 	u32 duration = IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS;
@@ -2823,6 +2824,9 @@ static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
 	if (iwl_mvm_ref_sync(mvm, IWL_MVM_REF_PREPARE_TX))
 		return;
 
+	if (req_duration > duration)
+		duration = req_duration;
+
 	mutex_lock(&mvm->mutex);
 	/* Try really hard to protect the session and hear a beacon */
 	iwl_mvm_protect_session(mvm, vif, duration, min_duration, 500, false);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 52f36c43f35f..cde1db0f6573 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3378,6 +3378,8 @@ enum ieee80211_reconfig_type {
  *	frame in case that no beacon was heard from the AP/P2P GO.
  *	The callback will be called before each transmission and upon return
  *	mac80211 will transmit the frame right away.
+ *      If duration is greater than zero, mac80211 hints to the driver the
+ *      duration for which the operation is requested.
  *	The callback is optional and can (should!) sleep.
  *
  * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
@@ -3697,7 +3699,8 @@ struct ieee80211_ops {
 				  u32 sset, u8 *data);
 
 	void	(*mgd_prepare_tx)(struct ieee80211_hw *hw,
-				  struct ieee80211_vif *vif);
+				  struct ieee80211_vif *vif,
+				  u16 duration);
 
 	void	(*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
 					     struct ieee80211_vif *vif);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 4d82fe7d627c..8f6998091d26 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -2,6 +2,7 @@
 /*
 * Portions of this file
 * Copyright(c) 2016 Intel Deutschland GmbH
+* Copyright (C) 2018 Intel Corporation
 */
 
 #ifndef __MAC80211_DRIVER_OPS
@@ -813,7 +814,8 @@ drv_allow_buffered_frames(struct ieee80211_local *local,
 }
 
 static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
-				      struct ieee80211_sub_if_data *sdata)
+				      struct ieee80211_sub_if_data *sdata,
+				      u16 duration)
 {
 	might_sleep();
 
@@ -821,9 +823,9 @@ static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
 		return;
 	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
 
-	trace_drv_mgd_prepare_tx(local, sdata);
+	trace_drv_mgd_prepare_tx(local, sdata, duration);
 	if (local->ops->mgd_prepare_tx)
-		local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
+		local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, duration);
 	trace_drv_return_void(local);
 }
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 51021d3d2d18..e2d254a85bd3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -864,7 +864,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
 		return;
 	}
 
-	drv_mgd_prepare_tx(local, sdata);
+	drv_mgd_prepare_tx(local, sdata, 0);
 
 	IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 	if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
@@ -2022,7 +2022,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 		 */
 		if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) &&
 		    !ifmgd->have_beacon)
-			drv_mgd_prepare_tx(sdata->local, sdata);
+			drv_mgd_prepare_tx(sdata->local, sdata, 0);
 
 		ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype,
 					       reason, tx, frame_buf);
@@ -2560,7 +2560,7 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
 	if (!elems.challenge)
 		return;
 	auth_data->expected_transaction = 4;
-	drv_mgd_prepare_tx(sdata->local, sdata);
+	drv_mgd_prepare_tx(sdata->local, sdata, 0);
 	if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
 		tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
 			   IEEE80211_TX_INTFL_MLME_CONN_TX;
@@ -3769,6 +3769,7 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
 	u32 tx_flags = 0;
 	u16 trans = 1;
 	u16 status = 0;
+	u16 prepare_tx_duration = 0;
 
 	sdata_assert_lock(sdata);
 
@@ -3790,7 +3791,11 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
 		return -ETIMEDOUT;
 	}
 
-	drv_mgd_prepare_tx(local, sdata);
+	if (auth_data->algorithm == WLAN_AUTH_SAE)
+		prepare_tx_duration =
+			jiffies_to_msecs(IEEE80211_AUTH_TIMEOUT_SAE);
+
+	drv_mgd_prepare_tx(local, sdata, prepare_tx_duration);
 
 	sdata_info(sdata, "send auth to %pM (try %d/%d)\n",
 		   auth_data->bss->bssid, auth_data->tries,
@@ -4994,7 +4999,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
 			   req->bssid, req->reason_code,
 			   ieee80211_get_reason_code_string(req->reason_code));
 
-		drv_mgd_prepare_tx(sdata->local, sdata);
+		drv_mgd_prepare_tx(sdata->local, sdata, 0);
 		ieee80211_send_deauth_disassoc(sdata, req->bssid,
 					       IEEE80211_STYPE_DEAUTH,
 					       req->reason_code, tx,
@@ -5014,7 +5019,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
 			   req->bssid, req->reason_code,
 			   ieee80211_get_reason_code_string(req->reason_code));
 
-		drv_mgd_prepare_tx(sdata->local, sdata);
+		drv_mgd_prepare_tx(sdata->local, sdata, 0);
 		ieee80211_send_deauth_disassoc(sdata, req->bssid,
 					       IEEE80211_STYPE_DEAUTH,
 					       req->reason_code, tx,
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 591ad02e1fa4..80a7edf8d314 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2,6 +2,7 @@
 /*
 * Portions of this file
 * Copyright(c) 2016 Intel Deutschland GmbH
+* Copyright (C) 2018 Intel Corporation
 */
 
 #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
@@ -1413,11 +1414,29 @@ DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
 	TP_ARGS(local, sta, tids, num_frames, reason, more_data)
 );
 
-DEFINE_EVENT(local_sdata_evt, drv_mgd_prepare_tx,
+TRACE_EVENT(drv_mgd_prepare_tx,
 	TP_PROTO(struct ieee80211_local *local,
-		 struct ieee80211_sub_if_data *sdata),
+		 struct ieee80211_sub_if_data *sdata,
+		 u16 duration),
 
-	TP_ARGS(local, sdata)
+	TP_ARGS(local, sdata, duration),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		VIF_ENTRY
+		__field(u32, duration)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		VIF_ASSIGN;
+		__entry->duration = duration;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT VIF_PR_FMT " duration: %u",
+		LOCAL_PR_ARG, VIF_PR_ARG, __entry->duration
+	)
 );
 
 DEFINE_EVENT(local_sdata_evt, drv_mgd_protect_tdls_discover,
-- 
2.17.0

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

* [PATCH 9/9] nl80211: Add wmm rule attribute to NL80211_CMD_GET_WIPHY dump command.
  2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
                   ` (7 preceding siblings ...)
  2018-04-20 10:49 ` [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback Luca Coelho
@ 2018-04-20 10:49 ` Luca Coelho
  8 siblings, 0 replies; 13+ messages in thread
From: Luca Coelho @ 2018-04-20 10:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Haim Dreyfuss, Luca Coelho

From: Haim Dreyfuss <haim.dreyfuss@intel.com>

This will serve userspace entity to maintain its regulatory limitation.
More specifcally APs can use this data to calculate the WMM IE when
building: beacons, probe responses, assoc responses etc...

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 include/uapi/linux/nl80211.h | 28 ++++++++++++++++++
 net/wireless/nl80211.c       | 57 +++++++++++++++++++++++++++++++++---
 2 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 15daf5e2638d..04c9b97aa5fc 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -11,6 +11,7 @@
  * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
  * Copyright 2008 Colin McCabe <colin@cozybit.com>
  * Copyright 2015-2017	Intel Deutschland GmbH
+ * Copyright (C) 2018 Intel Corporation
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -3141,6 +3142,29 @@ enum nl80211_band_attr {
 
 #define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
 
+/**
+ * enum nl80211_wmm_rule - regulatory wmm rule
+ *
+ * @__NL80211_WMMR_INVALID: attribute number 0 is reserved
+ * @NL80211_WMMR_CW_MIN: Minimum contention window slot.
+ * @NL80211_WMMR_CW_MAX: Maximum contention window slot.
+ * @NL80211_WMMR_AIFSN: Arbitration Inter Frame Space.
+ * @NL80211_WMMR_TXOP: Maximum allowed tx operation time.
+ * @nl80211_WMMR_MAX: highest possible wmm rule.
+ * @__NL80211_WMMR_LAST: Internal use.
+ */
+enum nl80211_wmm_rule {
+	__NL80211_WMMR_INVALID,
+	NL80211_WMMR_CW_MIN,
+	NL80211_WMMR_CW_MAX,
+	NL80211_WMMR_AIFSN,
+	NL80211_WMMR_TXOP,
+
+	/* keep last */
+	__NL80211_WMMR_LAST,
+	NL80211_WMMR_MAX = __NL80211_WMMR_LAST - 1
+};
+
 /**
  * enum nl80211_frequency_attr - frequency attributes
  * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved
@@ -3190,6 +3214,9 @@ enum nl80211_band_attr {
  *	on this channel in current regulatory domain.
  * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
  *	on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations.
+ *	This is a nested attribute that contains the wmm limitation per AC.
+ *	(see &enum nl80211_wmm_rule)
  * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
  *	currently defined
  * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -3218,6 +3245,7 @@ enum nl80211_frequency_attr {
 	NL80211_FREQUENCY_ATTR_IR_CONCURRENT,
 	NL80211_FREQUENCY_ATTR_NO_20MHZ,
 	NL80211_FREQUENCY_ATTR_NO_10MHZ,
+	NL80211_FREQUENCY_ATTR_WMM,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ff28f8feeb09..016d0a1de576 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4,6 +4,7 @@
  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright 2015-2017	Intel Deutschland GmbH
+ * Copyright (C) 2018 Intel Corporation
  */
 
 #include <linux/if.h>
@@ -645,7 +646,43 @@ static inline void *nl80211hdr_put(struct sk_buff *skb, u32 portid, u32 seq,
 	return genlmsg_put(skb, portid, seq, &nl80211_fam, flags, cmd);
 }
 
-static int nl80211_msg_put_channel(struct sk_buff *msg,
+static int nl80211_msg_put_wmm_rules(struct sk_buff *msg,
+				     const struct ieee80211_reg_rule *rule)
+{
+	int j;
+	struct nlattr *nl_wmm_rules =
+		nla_nest_start(msg, NL80211_FREQUENCY_ATTR_WMM);
+
+	if (!nl_wmm_rules)
+		goto nla_put_failure;
+
+	for (j = 0; j < IEEE80211_NUM_ACS; j++) {
+		struct nlattr *nl_wmm_rule = nla_nest_start(msg, j);
+
+		if (!nl_wmm_rule)
+			goto nla_put_failure;
+
+		if (nla_put_u16(msg, NL80211_WMMR_CW_MIN,
+				rule->wmm_rule->client[j].cw_min) ||
+		    nla_put_u16(msg, NL80211_WMMR_CW_MAX,
+				rule->wmm_rule->client[j].cw_max) ||
+		    nla_put_u8(msg, NL80211_WMMR_AIFSN,
+			       rule->wmm_rule->client[j].aifsn) ||
+		    nla_put_u8(msg, NL80211_WMMR_TXOP,
+			       rule->wmm_rule->client[j].cot))
+			goto nla_put_failure;
+
+		nla_nest_end(msg, nl_wmm_rule);
+	}
+	nla_nest_end(msg, nl_wmm_rules);
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+
+static int nl80211_msg_put_channel(struct sk_buff *msg, struct wiphy *wiphy,
 				   struct ieee80211_channel *chan,
 				   bool large)
 {
@@ -721,6 +758,16 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
 			DBM_TO_MBM(chan->max_power)))
 		goto nla_put_failure;
 
+	if (large) {
+		const struct ieee80211_reg_rule *rule =
+			freq_reg_info(wiphy, chan->center_freq);
+
+		if (!IS_ERR(rule) && rule->wmm_rule) {
+			if (nl80211_msg_put_wmm_rules(msg, rule))
+				goto nla_put_failure;
+		}
+	}
+
 	return 0;
 
  nla_put_failure:
@@ -1631,7 +1678,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 					chan = &sband->channels[i];
 
 					if (nl80211_msg_put_channel(
-							msg, chan,
+							msg, &rdev->wiphy, chan,
 							state->split))
 						goto nla_put_failure;
 
@@ -14320,7 +14367,8 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
 	nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE);
 	if (!nl_freq)
 		goto nla_put_failure;
-	if (nl80211_msg_put_channel(msg, channel_before, false))
+
+	if (nl80211_msg_put_channel(msg, wiphy, channel_before, false))
 		goto nla_put_failure;
 	nla_nest_end(msg, nl_freq);
 
@@ -14328,7 +14376,8 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
 	nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER);
 	if (!nl_freq)
 		goto nla_put_failure;
-	if (nl80211_msg_put_channel(msg, channel_after, false))
+
+	if (nl80211_msg_put_channel(msg, wiphy, channel_after, false))
 		goto nla_put_failure;
 	nla_nest_end(msg, nl_freq);
 
-- 
2.17.0

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

* Re: [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback
  2018-04-20 10:49 ` [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback Luca Coelho
@ 2018-04-20 19:43   ` Peter Oh
  2018-04-21  6:11     ` Luca Coelho
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Oh @ 2018-04-20 19:43 UTC (permalink / raw)
  To: Luca Coelho, johannes; +Cc: linux-wireless, Ilan Peer, Luca Coelho

where is the 9th patch gone?


On 04/20/2018 03:49 AM, Luca Coelho wrote:
> From: Ilan Peer <ilan.peer@intel.com>
>
> There are specific cases, such as SAE authentication exchange, that
> might require long duration to complete. For such cases, add support
> for indicating to the driver the required duration of the prepare_tx()
> operation, so the driver would still be able to complete the frame
> exchange.
>
> Currently, indicate the duration only for SAE authentication exchange,
> as SAE authentication can take up to 2000 msec (as defined in IEEE
> P802.11-REVmd D1.0 p. 3504).
>
> As the patch modified the prepare_tx() callback API, also modify
> the relevant code in iwlwifi.
>
> Signed-off-by: Ilan Peer <ilan.peer@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> ---
>   drivers/net/wireless/ath/ath9k/main.c         |  3 ++-
>   .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  6 ++++-
>   include/net/mac80211.h                        |  5 +++-
>   net/mac80211/driver-ops.h                     |  8 +++---
>   net/mac80211/mlme.c                           | 17 ++++++++-----
>   net/mac80211/trace.h                          | 25 ++++++++++++++++---
>   6 files changed, 49 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index a3be8add56e1..b6663c80e7dd 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -2544,7 +2544,8 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,
>   }
>   
>   static void ath9k_mgd_prepare_tx(struct ieee80211_hw *hw,
> -				 struct ieee80211_vif *vif)
> +				 struct ieee80211_vif *vif,
> +				 u16 duration)
>   {
>   	struct ath_softc *sc = hw->priv;
>   	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> index 51b30424575b..4e428427d1ba 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> @@ -2810,7 +2810,8 @@ static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
>   }
>   
>   static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
> -				      struct ieee80211_vif *vif)
> +				       struct ieee80211_vif *vif,
> +				       u16 req_duration)
>   {
>   	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
>   	u32 duration = IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS;
> @@ -2823,6 +2824,9 @@ static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
>   	if (iwl_mvm_ref_sync(mvm, IWL_MVM_REF_PREPARE_TX))
>   		return;
>   
> +	if (req_duration > duration)
> +		duration = req_duration;
> +
>   	mutex_lock(&mvm->mutex);
>   	/* Try really hard to protect the session and hear a beacon */
>   	iwl_mvm_protect_session(mvm, vif, duration, min_duration, 500, false);
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 52f36c43f35f..cde1db0f6573 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -3378,6 +3378,8 @@ enum ieee80211_reconfig_type {
>    *	frame in case that no beacon was heard from the AP/P2P GO.
>    *	The callback will be called before each transmission and upon return
>    *	mac80211 will transmit the frame right away.
> + *      If duration is greater than zero, mac80211 hints to the driver the
> + *      duration for which the operation is requested.
>    *	The callback is optional and can (should!) sleep.
>    *
>    * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
> @@ -3697,7 +3699,8 @@ struct ieee80211_ops {
>   				  u32 sset, u8 *data);
>   
>   	void	(*mgd_prepare_tx)(struct ieee80211_hw *hw,
> -				  struct ieee80211_vif *vif);
> +				  struct ieee80211_vif *vif,
> +				  u16 duration);
>   
>   	void	(*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
>   					     struct ieee80211_vif *vif);
> diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
> index 4d82fe7d627c..8f6998091d26 100644
> --- a/net/mac80211/driver-ops.h
> +++ b/net/mac80211/driver-ops.h
> @@ -2,6 +2,7 @@
>   /*
>   * Portions of this file
>   * Copyright(c) 2016 Intel Deutschland GmbH
> +* Copyright (C) 2018 Intel Corporation
>   */
>   
>   #ifndef __MAC80211_DRIVER_OPS
> @@ -813,7 +814,8 @@ drv_allow_buffered_frames(struct ieee80211_local *local,
>   }
>   
>   static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
> -				      struct ieee80211_sub_if_data *sdata)
> +				      struct ieee80211_sub_if_data *sdata,
> +				      u16 duration)
>   {
>   	might_sleep();
>   
> @@ -821,9 +823,9 @@ static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
>   		return;
>   	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
>   
> -	trace_drv_mgd_prepare_tx(local, sdata);
> +	trace_drv_mgd_prepare_tx(local, sdata, duration);
>   	if (local->ops->mgd_prepare_tx)
> -		local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
> +		local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, duration);
>   	trace_drv_return_void(local);
>   }
>   
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 51021d3d2d18..e2d254a85bd3 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -864,7 +864,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
>   		return;
>   	}
>   
> -	drv_mgd_prepare_tx(local, sdata);
> +	drv_mgd_prepare_tx(local, sdata, 0);
>   
>   	IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
>   	if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
> @@ -2022,7 +2022,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
>   		 */
>   		if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) &&
>   		    !ifmgd->have_beacon)
> -			drv_mgd_prepare_tx(sdata->local, sdata);
> +			drv_mgd_prepare_tx(sdata->local, sdata, 0);
>   
>   		ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype,
>   					       reason, tx, frame_buf);
> @@ -2560,7 +2560,7 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
>   	if (!elems.challenge)
>   		return;
>   	auth_data->expected_transaction = 4;
> -	drv_mgd_prepare_tx(sdata->local, sdata);
> +	drv_mgd_prepare_tx(sdata->local, sdata, 0);
>   	if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
>   		tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
>   			   IEEE80211_TX_INTFL_MLME_CONN_TX;
> @@ -3769,6 +3769,7 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
>   	u32 tx_flags = 0;
>   	u16 trans = 1;
>   	u16 status = 0;
> +	u16 prepare_tx_duration = 0;
>   
>   	sdata_assert_lock(sdata);
>   
> @@ -3790,7 +3791,11 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
>   		return -ETIMEDOUT;
>   	}
>   
> -	drv_mgd_prepare_tx(local, sdata);
> +	if (auth_data->algorithm == WLAN_AUTH_SAE)
> +		prepare_tx_duration =
> +			jiffies_to_msecs(IEEE80211_AUTH_TIMEOUT_SAE);
> +
> +	drv_mgd_prepare_tx(local, sdata, prepare_tx_duration);
>   
>   	sdata_info(sdata, "send auth to %pM (try %d/%d)\n",
>   		   auth_data->bss->bssid, auth_data->tries,
> @@ -4994,7 +4999,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
>   			   req->bssid, req->reason_code,
>   			   ieee80211_get_reason_code_string(req->reason_code));
>   
> -		drv_mgd_prepare_tx(sdata->local, sdata);
> +		drv_mgd_prepare_tx(sdata->local, sdata, 0);
>   		ieee80211_send_deauth_disassoc(sdata, req->bssid,
>   					       IEEE80211_STYPE_DEAUTH,
>   					       req->reason_code, tx,
> @@ -5014,7 +5019,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
>   			   req->bssid, req->reason_code,
>   			   ieee80211_get_reason_code_string(req->reason_code));
>   
> -		drv_mgd_prepare_tx(sdata->local, sdata);
> +		drv_mgd_prepare_tx(sdata->local, sdata, 0);
>   		ieee80211_send_deauth_disassoc(sdata, req->bssid,
>   					       IEEE80211_STYPE_DEAUTH,
>   					       req->reason_code, tx,
> diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
> index 591ad02e1fa4..80a7edf8d314 100644
> --- a/net/mac80211/trace.h
> +++ b/net/mac80211/trace.h
> @@ -2,6 +2,7 @@
>   /*
>   * Portions of this file
>   * Copyright(c) 2016 Intel Deutschland GmbH
> +* Copyright (C) 2018 Intel Corporation
>   */
>   
>   #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
> @@ -1413,11 +1414,29 @@ DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
>   	TP_ARGS(local, sta, tids, num_frames, reason, more_data)
>   );
>   
> -DEFINE_EVENT(local_sdata_evt, drv_mgd_prepare_tx,
> +TRACE_EVENT(drv_mgd_prepare_tx,
>   	TP_PROTO(struct ieee80211_local *local,
> -		 struct ieee80211_sub_if_data *sdata),
> +		 struct ieee80211_sub_if_data *sdata,
> +		 u16 duration),
>   
> -	TP_ARGS(local, sdata)
> +	TP_ARGS(local, sdata, duration),
> +
> +	TP_STRUCT__entry(
> +		LOCAL_ENTRY
> +		VIF_ENTRY
> +		__field(u32, duration)
> +	),
> +
> +	TP_fast_assign(
> +		LOCAL_ASSIGN;
> +		VIF_ASSIGN;
> +		__entry->duration = duration;
> +	),
> +
> +	TP_printk(
> +		LOCAL_PR_FMT VIF_PR_FMT " duration: %u",
> +		LOCAL_PR_ARG, VIF_PR_ARG, __entry->duration
> +	)
>   );
>   
>   DEFINE_EVENT(local_sdata_evt, drv_mgd_protect_tdls_discover,

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

* Re: [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback
  2018-04-20 19:43   ` Peter Oh
@ 2018-04-21  6:11     ` Luca Coelho
  2018-04-21  7:56       ` Kalle Valo
  0 siblings, 1 reply; 13+ messages in thread
From: Luca Coelho @ 2018-04-21  6:11 UTC (permalink / raw)
  To: Peter Oh, johannes; +Cc: linux-wireless, Ilan Peer

On Fri, 2018-04-20 at 12:43 -0700, Peter Oh wrote:
> where is the 9th patch gone?

At least patchwork caught it so it must have been delivered to linux-wi
reless@vger.kernel.org:

https://patchwork.kernel.org/patch/10352447/

Did you still not receive it? Has anyone else not received it?

--
Cheers,
Luca.

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

* Re: [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback
  2018-04-21  6:11     ` Luca Coelho
@ 2018-04-21  7:56       ` Kalle Valo
  0 siblings, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2018-04-21  7:56 UTC (permalink / raw)
  To: Luca Coelho; +Cc: Peter Oh, johannes, linux-wireless, Ilan Peer

Luca Coelho <luca@coelho.fi> writes:

> On Fri, 2018-04-20 at 12:43 -0700, Peter Oh wrote:
>> where is the 9th patch gone?
>
> At least patchwork caught it so it must have been delivered to linux-wi
> reless@vger.kernel.org:
>
> https://patchwork.kernel.org/patch/10352447/
>
> Did you still not receive it? Has anyone else not received it?

I received it.

-- 
Kalle Valo

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

end of thread, other threads:[~2018-04-21  7:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 10:49 [PATCH 0/9] cfg80211/mac80211 patches from our internal tree 2018-04-20 Luca Coelho
2018-04-20 10:49 ` [PATCH 1/9] mac80211: rename rtap_vendor_space to rtap_space Luca Coelho
2018-04-20 10:49 ` [PATCH 2/9] mac80211: use timeout from the AddBA response instead of the request Luca Coelho
2018-04-20 10:49 ` [PATCH 3/9] mac80211: Adjust SAE authentication timeout Luca Coelho
2018-04-20 10:49 ` [PATCH 4/9] mac80211: clean up rate info bandwidth setting Luca Coelho
2018-04-20 10:49 ` [PATCH 5/9] mac80211: ethtool: memset the whole sinfo struct to 0 Luca Coelho
2018-04-20 10:49 ` [PATCH 6/9] mac80211: remove pointless flags=0 assignment Luca Coelho
2018-04-20 10:49 ` [PATCH 7/9] mac80211: add api to set CSA counter in mac80211 Luca Coelho
2018-04-20 10:49 ` [PATCH 8/9] mac80211: Support adding duration for prepare_tx() callback Luca Coelho
2018-04-20 19:43   ` Peter Oh
2018-04-21  6:11     ` Luca Coelho
2018-04-21  7:56       ` Kalle Valo
2018-04-20 10:49 ` [PATCH 9/9] nl80211: Add wmm rule attribute to NL80211_CMD_GET_WIPHY dump command Luca Coelho

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.