From patchwork Thu Nov 24 12:45:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Otcheretianski, Andrei" X-Patchwork-Id: 1708707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=xWxieVpo; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Cx45UuNp; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NHydX625tz23nT for ; Thu, 24 Nov 2022 23:55:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q1dp1oZiheoH6LJc4BBZFs/qwr5Zk8m4tKLso79F/bU=; b=xWxieVpoiis8RU JjgH0/KMjYeBgNJrZpqaZZVtiLiYfem72kHO05RKauKarlUeiYLVdGBhneL3vfg/KJNWGkoKJ7rkE xQ/04WkaLqLR0LIirxDx2KkHxehpvVkdODI0j7jOjJDBPJkx/aWZ0iE27EpkWWOt8JNgBAwiHAwmE v87ZD6uTFcldsmXNwu1eW99Fu0NZHOINGaM9rpclU2CUnQanH5k56KmscKuw69j0L7CBmM+ULuvfD gmtpjtfwikvRK7LfzzDY9/tnh3YuNRFNJw43M3W4eigbNfjPCeUZa7w3gb8MHktqAVElVh2lfuU1C WTHhTXX7OwjBD5i3oWjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyBjS-008VTw-SQ; Thu, 24 Nov 2022 12:53:36 +0000 Received: from mga01.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyBbw-008RZf-2U for hostap@lists.infradead.org; Thu, 24 Nov 2022 12:45:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669293948; x=1700829948; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0ABxCPRnZnYXxYwRD55HjsJTi8CAAZucrZ4quBvP1Do=; b=Cx45UuNpmqLsWzFiGk4ArByLJZjmb659kViK36Pbp8WZqGPMgYflEVG1 UQJoxwFP44V/Vd3gbU2b9duvKp+/7+oDE8WYqAOlCvGNXpJuU8+5MpPlw REJTfG/Xgx+b0AxQB/a9ZW0/GIAPyUmIJ85mG0PA6ii8NSBbycDJRC49q 51nQBYcDfqo+7t4DFBW4uUvgRKdXi6rqtJtlAgVrF3LnssfsUMxUu0A+b dDq/O8Tc3Gi/M7FW7DjQXwJY9N62jZB6j8GLYqj4ENqtU04+3TmVbsd0o l5pO+7cCUde3sxEqnAycSR/sQrhL8Va/77FXvORlbl6DwvRvgBygiSml4 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="341185823" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="341185823" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 04:45:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="675083062" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="675083062" Received: from aotchere-desk.jer.intel.com ([10.13.16.84]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 04:45:45 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH 01/13] common: Combine definitions for Multi-Link and per STA profile control Date: Thu, 24 Nov 2022 14:45:21 +0200 Message-Id: <20221124124533.54965-2-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124124533.54965-1-andrei.otcheretianski@intel.com> References: <20221124124533.54965-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221124_044548_176158_03A3263E X-CRM114-Status: GOOD ( 14.67 ) X-Spam-Score: -5.4 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The control fields are 16 bit wide. Combine the per byte definitions to make it more convenient. Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_defs.h | 32 ++++++++++++++ src/drivers/driver_nl80211_event.c | 16 ++++++++++----- 2 fi [...] Content analysis details: (-5.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [192.55.52.88 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.55.52.88 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The control fields are 16 bit wide. Combine the per byte definitions to make it more convenient. Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_defs.h | 32 ++++++++++++++---------------- src/drivers/driver_nl80211_event.c | 16 ++++++++++----- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 310b7660e2..427b284b85 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2539,28 +2539,26 @@ struct ieee80211_eht_capabilities { /* IEEE P802.11be/D2.2, 9.4.2.312.2 - Basic Multi-Link element */ /* Figure 9-1002g: Presence Bitmap subfield of the Basic Multi-Link element */ -#define BASIC_MULTI_LINK_CTRL0_PRES_LINK_ID 0x10 -#define BASIC_MULTI_LINK_CTRL0_PRES_BSS_PARAM_CH_COUNT 0x20 -#define BASIC_MULTI_LINK_CTRL0_PRES_MSD_INFO 0x40 -#define BASIC_MULTI_LINK_CTRL0_PRES_EML_CAPA 0x80 - -#define BASIC_MULTI_LINK_CTRL1_PRES_MLD_CAPA 0x01 -#define BASIC_MULTI_LINK_CTRL1_PRES_AP_MLD_ID 0x02 +#define BASIC_MULTI_LINK_CTRL_PRES_LINK_ID 0x0010 +#define BASIC_MULTI_LINK_CTRL_PRES_BSS_PARAM_CH_COUNT 0x0020 +#define BASIC_MULTI_LINK_CTRL_PRES_MSD_INFO 0x0040 +#define BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA 0x0080 +#define BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA 0x0100 +#define BASIC_MULTI_LINK_CTRL_PRES_AP_MLD_ID 0x0200 /* * STA Control field definitions of Per-STA Profile subelement in Basic * Multi-Link element as described in Figure 9-1002n: STA Control field format. */ -#define BASIC_MLE_STA_CTRL0_LINK_ID_SHIFT 0 -#define BASIC_MLE_STA_CTRL0_LINK_ID_MASK 0x0F -#define BASIC_MLE_STA_CTRL0_COMPLETE_PROFILE 0x10 -#define BASIC_MLE_STA_CTRL0_PRES_STA_MAC 0x20 -#define BASIC_MLE_STA_CTRL0_PRES_BEACON_INT 0x40 -#define BASIC_MLE_STA_CTRL0_PRES_TSF_OFFSET 0x80 -#define BASIC_MLE_STA_CTRL1_PRES_DTIM_INFO 0x01 -#define BASIC_MLE_STA_CTRL1_PRES_NSTR_LINK_PAIR 0x02 -#define BASIC_MLE_STA_CTRL1_NSTR_BITMAP 0x04 -#define BASIC_MLE_STA_CTRL1_PRES_BSS_PARAM_COUNT 0x08 +#define BASIC_MLE_STA_CTRL_LINK_ID_MASK 0x000F +#define BASIC_MLE_STA_CTRL_COMPLETE_PROFILE 0x0010 +#define BASIC_MLE_STA_CTRL_PRES_STA_MAC 0x0020 +#define BASIC_MLE_STA_CTRL_PRES_BEACON_INT 0x0040 +#define BASIC_MLE_STA_CTRL_PRES_TSF_OFFSET 0x0080 +#define BASIC_MLE_STA_CTRL_PRES_DTIM_INFO 0x0100 +#define BASIC_MLE_STA_CTRL_PRES_NSTR_LINK_PAIR 0x0200 +#define BASIC_MLE_STA_CTRL_NSTR_BITMAP 0x0400 +#define BASIC_MLE_STA_CTRL_PRES_BSS_PARAM_COUNT 0x0800 #define BASIC_MLE_STA_PROF_STA_MAC_IDX 3 diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 619670980f..39391f1a45 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -536,18 +536,18 @@ static void nl80211_get_basic_mle_links_info(const u8 *mle, size_t mle_len, if (pos[0] == MULTI_LINK_SUB_ELEM_ID_PER_STA_PROFILE) { u8 link_id; const u8 *sta_profile; + u16 sta_ctrl; if (pos[1] < BASIC_MLE_STA_PROF_STA_MAC_IDX + ETH_ALEN) goto next_subelem; sta_profile = &pos[2]; - link_id = sta_profile[0] & - BASIC_MLE_STA_CTRL0_LINK_ID_MASK; + sta_ctrl = WPA_GET_LE16(sta_profile); + link_id = sta_ctrl & BASIC_MLE_STA_CTRL_LINK_ID_MASK; if (link_id >= MAX_NUM_MLD_LINKS) goto next_subelem; - if (!(sta_profile[0] & - BASIC_MLE_STA_CTRL0_PRES_STA_MAC)) + if (!(sta_ctrl & BASIC_MLE_STA_CTRL_PRES_STA_MAC)) goto next_subelem; info->non_assoc_links |= BIT(link_id); @@ -640,7 +640,13 @@ static int nl80211_update_rejected_links_info(struct driver_sta_mlo_info *mlo, static int nl80211_get_assoc_link_id(const u8 *data, u8 len) { - if (!(data[0] & BASIC_MULTI_LINK_CTRL0_PRES_LINK_ID)) + u16 control; + + if (len < 2) + return -1; + + control = WPA_GET_LE16(data); + if (!(control & BASIC_MULTI_LINK_CTRL_PRES_LINK_ID)) return -1; #define BASIC_ML_IE_COMMON_INFO_LINK_ID_IDX \