From patchwork Thu Jun 4 07:09:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11587033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49EEB1392 for ; Thu, 4 Jun 2020 07:10:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 281BA206DC for ; Thu, 4 Jun 2020 07:10:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tmAibGqF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 281BA206DC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dUSKR22JrBdkMjSwJyw/CmmTwv56mbXdEwpsyc0wJoU=; b=tmAibGqF7rX48S D5WXLNXEPd4p17tGGT8PfFVgGlHvGgYEgklBUz/ynFwZoKVoisTqFJjJBxriXDrJZC8Udf/yOlzTx DFNl7IvkwpDCWOXg10tbtVUKi8Gp7hVi7nzJwDUKG+L32pe+gxr2OpNWfKtBNmXMLvO5YS8z+I2ar FMNSIkyTdljazpeSeAqzDPyNrH2Y6eBPa1Gw5OzvMkYSFkUDdUnF0QjJX0QnaztLoLdTeObwOQPnP G0YzLvI4U5UQ+WpCvONaOUrQduBdGuahmdxYDsTdT4wBoyA1Psfx99hTSru+hoiFzUXeQSPWb/1Gc O90YwVp19usgNtOhsDHw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgk13-0002Ot-Q6; Thu, 04 Jun 2020 07:10:17 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgk0p-0000GO-LK for ath11k@lists.infradead.org; Thu, 04 Jun 2020 07:10:06 +0000 Received: from [46.59.202.224] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1jgk0l-0001P3-Fi; Thu, 04 Jun 2020 09:09:59 +0200 From: John Crispin To: Johannes Berg Subject: [PATCH 05/12] mac80211: add multiple bssid IE parsing Date: Thu, 4 Jun 2020 09:09:45 +0200 Message-Id: <20200604070952.15481-6-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200604070952.15481-1-john@phrozen.org> References: <20200604070952.15481-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200604_001003_849782_8234A826 X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org Drivers might need to know the offset and length of the IE. Add parsing code and propagate the values to the driver using the mutable struct. Signed-off-by: John Crispin --- include/net/mac80211.h | 5 +++++ net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/tx.c | 10 ++++++++++ net/mac80211/util.c | 4 ++++ 4 files changed, 21 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index bb2edace71a9..1a98b3907aa7 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4717,12 +4717,17 @@ void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); * @csa_counter_offs: array of IEEE80211_MAX_CSA_COUNTERS_NUM offsets * to CSA counters. This array can contain zero values which * should be ignored. + * @mbssid_offset: position of mbssid_offset + * @mbssid_length: position of mbssid_offset */ struct ieee80211_mutable_offsets { u16 tim_offset; u16 tim_length; u16 csa_counter_offs[IEEE80211_MAX_CSA_COUNTERS_NUM]; + + u16 multiple_bssid_offset; + u16 multiple_bssid_length; }; /** diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 2502726d0a58..abe488424287 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1520,6 +1520,7 @@ struct ieee802_11_elems { u8 dtim_count; u8 dtim_period; const struct ieee80211_addba_ext_ie *addba_ext_ie; + u16 multiple_bssid_offset; /* length of them, respectively */ u8 ext_capab_len; @@ -1540,6 +1541,7 @@ struct ieee802_11_elems { u8 perr_len; u8 country_elem_len; u8 bssid_index_len; + u8 multiple_bssid_len; /* whether a parse error occurred while retrieving these elements */ bool parse_error; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 49d35936cc9d..5e2879cd24b0 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -4747,11 +4747,21 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, is_template); if (offs) { + struct ieee802_11_elems elems; + offs->tim_offset = beacon->head_len; offs->tim_length = skb->len - beacon->head_len; /* for AP the csa offsets are from tail */ csa_off_base = skb->len; + + ieee802_11_parse_elems(skb->head, skb->len, true, &elems, + sdata->wdev.address, NULL); + if (!elems.parse_error) + goto out; + + offs->multiple_bssid_offset = elems.multiple_bssid_offset; + offs->multiple_bssid_length = elems.multiple_bssid_len; } if (beacon->tail) diff --git a/net/mac80211/util.c b/net/mac80211/util.c index a7c4d6a44e21..bbe2f1d9166c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1311,6 +1311,10 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, &crc : NULL, elem, elems); break; + case WLAN_EID_MULTIPLE_BSSID: + elems->multiple_bssid_offset = pos - start; + elems->multiple_bssid_len = elen; + break; default: break; }