From patchwork Mon May 20 11:02:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10950897 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6924E76 for ; Mon, 20 May 2019 11:02:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A9E0287DC for ; Mon, 20 May 2019 11:02:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F2A4287E6; Mon, 20 May 2019 11:02:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D35DB287DC for ; Mon, 20 May 2019 11:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732281AbfETLCS (ORCPT ); Mon, 20 May 2019 07:02:18 -0400 Received: from nbd.name ([46.4.11.11]:47812 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732258AbfETLCQ (ORCPT ); Mon, 20 May 2019 07:02:16 -0400 Received: from p548c87ba.dip0.t-ipconnect.de ([84.140.135.186] helo=bertha.datto.lan) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1hSg3Y-0003rt-7R; Mon, 20 May 2019 13:02:12 +0200 From: John Crispin To: Johannes Berg , Kalle Valo Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, John Crispin , Shashidhar Lakkavalli Subject: [PATCH 6/7] mac80211: propagate spatial reuse info into ieee80211_sta Date: Mon, 20 May 2019 13:02:03 +0200 Message-Id: <20190520110204.27588-7-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520110204.27588-1-john@phrozen.org> References: <20190520110204.27588-1-john@phrozen.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Upon a successful assoc a station shall store the content of the SPR element inside ieee80211_sta so that the driver can setup the hardware accordingly. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- include/net/mac80211.h | 1 + net/mac80211/he.c | 24 ++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 4 ++++ net/mac80211/mlme.c | 1 + 4 files changed, 30 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d81eea9140e5..f73a210b122b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1952,6 +1952,7 @@ struct ieee80211_sta { struct ieee80211_sta_vht_cap vht_cap; struct ieee80211_sta_he_cap he_cap; struct ieee80211_he_operation he_operation; + struct ieee80211_he_obss_pd he_obss_pd; u16 max_rx_aggregation_subframes; bool wme; u8 uapsd_queues; diff --git a/net/mac80211/he.c b/net/mac80211/he.c index 62ef029e5c48..e41ee4a29257 100644 --- a/net/mac80211/he.c +++ b/net/mac80211/he.c @@ -67,3 +67,27 @@ ieee80211_he_op_ie_to_sta_he_op(struct ieee80211_sub_if_data *sdata, } memcpy(he_operation, he_op_ie_elem, sizeof(*he_operation)); } + +void +ieee80211_he_spr_ie_to_sta_he_obss_pd(struct ieee80211_sub_if_data *sdata, + const struct ieee80211_he_spr *he_spr_ie_elem, + struct sta_info *sta) +{ + struct ieee80211_he_obss_pd *he_obss_pd = &sta->sta.he_obss_pd; + const u8 *data = he_spr_ie_elem->optional; + + memset(he_obss_pd, 0, sizeof(*he_obss_pd)); + + if (!he_spr_ie_elem) + return; + + if (he_spr_ie_elem->he_sr_control & + IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) + data++; + if (he_spr_ie_elem->he_sr_control & + IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) { + he_obss_pd->max_offset = *data++; + he_obss_pd->min_offset = *data++; + he_obss_pd->enable = true; + } +} diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index e931e114fba4..d82469754d34 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1870,6 +1870,10 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, struct ieee80211_supported_band *sband, const u8 *he_cap_ie, u8 he_cap_len, struct sta_info *sta); +void +ieee80211_he_spr_ie_to_sta_he_obss_pd(struct ieee80211_sub_if_data *sdata, + const struct ieee80211_he_spr *he_spr_ie_elem, + struct sta_info *sta); void ieee80211_he_op_ie_to_sta_he_op(struct ieee80211_sub_if_data *sdata, diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 996439a288c0..098335f34aa3 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3377,6 +3377,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, bss_conf->uora_ocw_range = elems.uora_element[0]; ieee80211_he_op_ie_to_sta_he_op(sdata, elems.he_operation, sta); + ieee80211_he_spr_ie_to_sta_he_obss_pd(sdata, elems.he_spr, sta); /* TODO: OPEN: what happens if BSS color disable is set? */ }