Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1357618pxj; Fri, 18 Jun 2021 05:33:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdK5JflnHvwD7FywpDv5AfuG3MWPcVxorDlRVWEdEbuZNxz4+/dXU3H18XsdTP1tqh34qQ X-Received: by 2002:a17:907:62a5:: with SMTP id nd37mr10836150ejc.148.1624019609886; Fri, 18 Jun 2021 05:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624019609; cv=none; d=google.com; s=arc-20160816; b=aqokCFyFYYEvdnI+QANu7rSOVXlIzSG9txI/QaOv7yu+1Kd5cQQDWgq4EAB/LybxCD bH22zLKiWA2RqxlWxVv/Heg2ZYjOLsurVSGJSp3E2Gm2qOC0Qkmm9s4bEZmVUBxfMvVv fWjTrJjXRRwKouOoem7IQ0pIPrc9eDEDDCe1DQsRxJQhv6UvbQ7pu1aJRpA2BQsIx31Y xgbrHNKbfH81PUC30C+1whfHcR2uyFJiUGFnylhv5eCSDzcYd8TuI5a2hXmKvgfyl4sM RzxapZSJM0p+topmhvXxauWBudNclnPuAg2hlYs8x06kO56BCJVUJbFxSGdqegPBqQId 5Eow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=HJ750byTnr++qKBqHx8+QgzDt3U4S3Zd7XCftu6NKwA=; b=JBqp9YiJxsLBY6QL2PFExtUDjbh13qWWvsyOpqGGREWzTVDMGbm/+dK80AVcC6tOGq 5Wj1mUnY6PORqUz7IZ9+vgIVw9IfG2EcPYie/U9TMTqfiTYxc2qBfH6Ajb++PiIebCG9 xu+bVt5K+cxTSO+Z4fwionli6/Cl3nOrGcr1oUoSR/0Ev/YlIUM3i9tWIsEfgtwz4pUl oI0evpE5ALTGDlrWS/b+gsaAV0oAt6Z7QKhGN5ncJRrHrb7GOK53n6fF4FAnDbiU2EJ1 uzoQnEuV+K2QC4Ck9QaT906Qg57HGCFqqsmtEjWshIwx2jdQlu1mdRq8+HRHoI7fSYo9 jbFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si2649996edx.445.2021.06.18.05.33.06; Fri, 18 Jun 2021 05:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233826AbhFRKoZ (ORCPT + 99 others); Fri, 18 Jun 2021 06:44:25 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:48176 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233147AbhFRKoV (ORCPT ); Fri, 18 Jun 2021 06:44:21 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=kveik.lan) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1luBwu-001YXx-Va; Fri, 18 Jun 2021 13:42:10 +0300 From: Luca Coelho To: johannes@sipsolutions.net Cc: luca@coelho.fi, linux-wireless@vger.kernel.org Date: Fri, 18 Jun 2021 13:41:35 +0300 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618104156.747775-1-luca@coelho.fi> References: <20210618104156.747775-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.5-pre1 Subject: [PATCH 10/31] mac80211: add to bss_conf if broadcast TWT is supported Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Shaul Triebitz Add to struct ieee80211_bss_conf a twt_broadcast field. Set it to true if both STA and AP support broadcast TWT. Signed-off-by: Shaul Triebitz Signed-off-by: Luca Coelho --- include/net/mac80211.h | 4 +++- net/mac80211/mlme.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 445b66c6eb7e..c575240b02c8 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -7,7 +7,7 @@ * Copyright 2007-2010 Johannes Berg * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH - * Copyright (C) 2018 - 2020 Intel Corporation + * Copyright (C) 2018 - 2021 Intel Corporation */ #ifndef MAC80211_H @@ -526,6 +526,7 @@ struct ieee80211_fils_discovery { * @twt_responder: does this BSS support TWT requester (relevant for managed * mode only, set if the AP advertises TWT responder role) * @twt_protected: does this BSS support protected TWT frames + * @twt_broadcast: does this BSS support broadcast TWT * @assoc: association status * @ibss_joined: indicates whether this station is part of an IBSS * or not @@ -642,6 +643,7 @@ struct ieee80211_bss_conf { bool twt_requester; bool twt_responder; bool twt_protected; + bool twt_broadcast; /* association related data */ bool assoc, ibss_joined; bool ibss_creator; diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index cc9bb4b9f8dc..6457415e4797 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3227,6 +3227,21 @@ static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata, return 0; } +static bool ieee80211_twt_bcast_support(struct ieee80211_bss_conf *bss_conf, + struct ieee80211_supported_band *sband, + struct sta_info *sta) +{ + const struct ieee80211_sta_he_cap *own_he_cap = + ieee80211_get_he_sta_cap(sband); + + return bss_conf->he_support && + (sta->sta.he_cap.he_cap_elem.mac_cap_info[2] & + IEEE80211_HE_MAC_CAP2_BCAST_TWT) && + own_he_cap && + (own_he_cap->he_cap_elem.mac_cap_info[2] & + IEEE80211_HE_MAC_CAP2_BCAST_TWT); +} + static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, struct cfg80211_bss *cbss, struct ieee80211_mgmt *mgmt, size_t len, @@ -3442,6 +3457,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, bss_conf->twt_protected = false; } + bss_conf->twt_broadcast = + ieee80211_twt_bcast_support(bss_conf, sband, sta); + if (bss_conf->he_support) { bss_conf->he_bss_color.color = le32_get_bits(elems->he_operation->he_oper_params, -- 2.32.0