diff mbox series

[09/28] mac80211: pass the TWT support bits in extended caps to the driver

Message ID 20180831083130.15525-10-luca@coelho.fi (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show
Series cfg80211/mac80211 patches from our internal tree 2018-08-31 | expand

Commit Message

Luca Coelho Aug. 31, 2018, 8:31 a.m. UTC
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

The Target Wake Time is a feature define in 11ah but has
been enhanced in 802.11ax. 802.11ax D3.0 defines in 9.4.2.27
two bits in the Extended Capabilities IE that the low level
driver needs to be aware of: bits 77 and 78.

Through those bits, the AP can advertise if it supports the
feature. Since those bits are present in the HE Cap as well,
we can set the capability bits in the Extended
Capabilities IE based on what is advertised in the HE Cap IE.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 include/linux/ieee80211.h | 4 ++++
 include/net/mac80211.h    | 6 ++++++
 net/mac80211/cfg.c        | 7 +++++++
 3 files changed, 17 insertions(+)

Comments

Johannes Berg Sept. 3, 2018, 8:52 a.m. UTC | #1
On Fri, 2018-08-31 at 11:31 +0300, Luca Coelho wrote:

> Since those bits are present in the HE Cap as well,
> we can set the capability bits in the Extended
> Capabilities IE based on what is advertised in the HE Cap IE.

It's not clear to me what this is trying to say, you don't seem to do
anything with the HE capabilities in the patch.

johannes
Emmanuel Grumbach Sept. 3, 2018, 9:28 a.m. UTC | #2
> 
> > Since those bits are present in the HE Cap as well, we can set the
> > capability bits in the Extended Capabilities IE based on what is
> > advertised in the HE Cap IE.
> 
> It's not clear to me what this is trying to say, you don't seem to do anything
> with the HE capabilities in the patch.
>

You are right. You can drop this part of the commit log. I guess I wrote that
for the AP mode but in the AP mode this is not relevant since the beacon is
built by hostapd.
For managed mode, the driver will need to check the HE cap along with the
extended capabilities to determine whether AP supports TWT or not.
Johannes Berg Sept. 3, 2018, 9:31 a.m. UTC | #3
On Mon, 2018-09-03 at 09:28 +0000, Grumbach, Emmanuel wrote:
> > 
> For managed mode, the driver will need to check the HE cap along with the
> extended capabilities to determine whether AP supports TWT or not.

Do you have any idea why it's there twice? Sounds like we should resolve
that in mac80211, rather than requiring the driver to check two
places...

johannes
Emmanuel Grumbach Sept. 3, 2018, 9:38 a.m. UTC | #4
> 
> On Mon, 2018-09-03 at 09:28 +0000, Grumbach, Emmanuel wrote:
> > >
> > For managed mode, the driver will need to check the HE cap along with
> > the extended capabilities to determine whether AP supports TWT or not.
> 
> Do you have any idea why it's there twice? Sounds like we should resolve
> that in mac80211, rather than requiring the driver to check two places...
>

I am now looking at table 9-135 in D3.0 and at Table-9-262z. The first describes
the extended caps IE, the second, the HE CAP IE. I can't really find any difference.
Since the driver already has the full HE CAP IE, I thought we'd just reflect what we
had in the extended caps IE so that it has the "raw" data, but I agree that mac80211
could / should aggregate the data.
diff mbox series

Patch

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 17ea51d088ae..0c9d6d0a9d47 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2633,6 +2633,10 @@  enum ieee80211_tdls_actioncode {
  */
 #define WLAN_EXT_CAPA9_FTM_INITIATOR	BIT(7)
 
+/* Defines support for TWT Requester and TWT Responder */
+#define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT	BIT(5)
+#define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT	BIT(6)
+
 /* TDLS specific payload type in the LLC/SNAP header */
 #define WLAN_TDLS_SNAP_RFTYPE	0x2
 
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 03e1dfd311f7..06e596215abc 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1844,6 +1844,10 @@  struct ieee80211_sta_rates {
  *	unlimited.
  * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
  * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
+ * @twt_req_support: indicates whether the STA advertised support for TWT
+ *	requester in the Extended Capabilities element.
+ * @twt_resp_support: indicates whether the STA advertised support for TWT
+ *	responder in the Extended Capabilities element.
  * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that
  *	the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames
  */
@@ -1885,6 +1889,8 @@  struct ieee80211_sta {
 	u16 max_amsdu_len;
 	bool support_p2p_ps;
 	u16 max_rc_amsdu_len;
+	bool twt_req_support;
+	bool twt_resp_support;
 
 	struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 1813c6f148bb..884b2b29d2a2 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1332,6 +1332,13 @@  static int sta_apply_parameters(struct ieee80211_local *local,
 		}
 	}
 
+	if (params->ext_capab_len >= 10) {
+		sta->sta.twt_req_support = params->ext_capab[9] &
+			WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT;
+		sta->sta.twt_resp_support = params->ext_capab[9] &
+			WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT;
+	}
+
 	/*
 	 * cfg80211 validates this (1-2007) and allows setting the AID
 	 * only when creating a new station entry