Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp588428rdb; Mon, 29 Jan 2024 11:20:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnO0g8KB+4jqe4WHeikTCnzgDri6vs8XJ+Bsl9ygtDe8/UTIcvEOTf8t/AvDxsoftw1nk+ X-Received: by 2002:a05:690c:c1c:b0:5ff:7b4f:5956 with SMTP id cl28-20020a05690c0c1c00b005ff7b4f5956mr4467776ywb.79.1706556056115; Mon, 29 Jan 2024 11:20:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706556056; cv=pass; d=google.com; s=arc-20160816; b=PS9D+MHv29Dn9n6nKK0LVVX9ou0t0bO0rQ1VdNzwRm7TZaIJjHTrXdup40Zo3QPk4Y bXNdfikh6eeiiPzTRX/MYq06kf3z4QVKzLDB6YAqkhdbdW6lJpvdizWnBZklYf7RqmI1 O9CRAGMqHuZq12uKHu2yVWzkIjUEblc6A9CIIFL5gvPtm3JWbfwQszAlrjRt7IScsDeo 2xP4zC9vTLwYlHxUCaEWJHSr9GIvTsoNZwM+035rWV0wp8PykJlLspDg/iEQN2KF2tT8 LVDKCDORJSHwsFA/DJIvMstc54GtDAMihRk1VSrTdH2ipr+lZp++mcB3gRmGScmshXje 766g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gwn0jSCvuoKXHfSYbbLB/Kc9hCT5bvGLXHkUZXSElrs=; fh=/bpX9t6IHtSOzJPH173Axhh10VrxS4PVXipA8TdqehU=; b=qBawP3GYOzB+PrN/hejR+l0rYrwrK5i7R6lxzCJpHGFk6kEWW5oAxl7p82yD5Or4bp Sgk48Go4vxnoqkMZ4sc4x9NP/W3G4LiuYIpeRb4b/sR5Lf8ygOx9NhtPlrKBNoFZP4o2 9R5mwpkfbX7IunqMpLLuR3tC5PVs9YcxlHpy9mn6j//qS4uCowrFtTatZ9zvX2r2Jv5d XtEhWkSup1y79qQi4iOl2FcYC8juz456y/4xDIL8iF6PKU+oSC4aIeUUpixrjkzmLvgK gCZsNWG2ZHezYppIEBsUxeURc0pOjpwtqXGb8g/of+aH0r7WwOVhrHHuAlF9LqbF+rM5 B3RQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=PAmRzbrn; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-2711-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net X-Forwarded-Encrypted: i=1; AJvYcCW+EgvwQiMuXl0V6hP1CsopVWk6GYQ4WJ/E6/RYiTSKXEpWQKuP/hy+rx75tplODrwqnpVPBvAN+xZI56wXnE2dSg0yHhRLZ8kyGipARw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bp30-20020a05622a1b9e00b0042a327d0693si8489447qtb.433.2024.01.29.11.20.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 11:20:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2711-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=PAmRzbrn; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-2711-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C77991C23EA8 for ; Mon, 29 Jan 2024 19:20:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3D684C63A; Mon, 29 Jan 2024 19:20:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="PAmRzbrn" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9D8C48790 for ; Mon, 29 Jan 2024 19:20:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706556050; cv=none; b=A7ILnDsW7YkIqs/Y9D4YOzSrHS+FY1ie4L3xEz//pP4gAt2IeUsN/lBu8R0vSKlXb5kao9oLuSh6kcbyhAbJLVBiVtBBMAkgaMqYegZbdhf2uZgnRLbOxXllASlKc0Lh72eviEBdlr2JnGIYmTlXPhUlxGI4xYNCvEB45Ey/fkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706556050; c=relaxed/simple; bh=Wurws95fm5zL3MFre/KgIlsS2freaecTv6Z9NiTgaqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DGyNmaKurTP9TqCcHAeE+zwDXKf7WYX3vv7hvfW1tDGsvR1Tm+JE7X9SoBJaEJ1w6OBq4FkRYKvhx4o6skvVYZFT3suGD1YWhvaXhY5pE6hElkMa6gULB4cU2jzR08Q+pwm+hE6qDPRbCvQxrMU+vgl6VaMZVSJLSqClPXgil5g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=PAmRzbrn; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=gwn0jSCvuoKXHfSYbbLB/Kc9hCT5bvGLXHkUZXSElrs=; t=1706556047; x=1707765647; b=PAmRzbrnTOtoMcG4+sxkVYJ3Nv16aUNOI41m0Ae9uT7TGHY aVUCmMP8yjD1Yrwo1f+6IgSS5IMFC8aYkf779+TKGq7Fxywk5wIxHLQunBnqKwDqpNCnKXF6LjLnz RKrPDhKw8FeRAcXNzxq/2KYnqZyB6GeOgq8j7nUkXI8t5fWqXlasyEwCPVF4U7I2yaq2Uhwtv61Fz JM/gOFBSguicpiW6rMFoKetdwhNt663CVHi2FLqZDeYXNN7RvYbpjQe5+4jqo/yYhgHoo4IKIigl8 l8+ZyY2Rq/z7wpD77NJvldbHNGFwho5xvodcSFv78oEGTSuYBdl64WDzmW8FgmLw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rUXBU-000000050Z6-1g6w; Mon, 29 Jan 2024 20:20:44 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 01/10] wifi: mac80211: simplify HE/EHT element length functions Date: Mon, 29 Jan 2024 20:19:27 +0100 Message-ID: <20240129202041.5890eb1d4184.Ibce7e5abcc7887630da03ac2263d8004ec541418@changeid> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129192041.58481-12-johannes@sipsolutions.net> References: <20240129192041.58481-12-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg We don't need to pass the iftype there, we already have it in the sdata. Simplify this code. Signed-off-by: Johannes Berg --- net/mac80211/ieee80211_i.h | 4 ++-- net/mac80211/mesh.c | 8 +++----- net/mac80211/mesh_plink.c | 8 +++----- net/mac80211/util.c | 15 ++++++++------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index e11297b4dc63..44400ce9a0b1 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2502,7 +2502,7 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, u32 cap); u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, const struct cfg80211_chan_def *chandef); -u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); +u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata); u8 *ieee80211_ie_build_he_cap(const struct ieee80211_conn_settings *conn, const struct ieee80211_sta_he_cap *he_cap, u8 *pos, u8 *end); @@ -2651,7 +2651,7 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache); void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache); -u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); +u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata); u8 *ieee80211_ie_build_eht_cap(u8 *pos, const struct ieee80211_sta_he_cap *he_cap, const struct ieee80211_sta_eht_cap *eht_cap, diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index e06d9ed2d31b..9fd209e4ca19 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2008, 2009 open80211s Ltd. - * Copyright (C) 2018 - 2023 Intel Corporation + * Copyright (C) 2018 - 2024 Intel Corporation * Authors: Luis Carlos Cobo * Javier Cardona */ @@ -981,10 +981,8 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh) band = chanctx_conf->def.chan->band; rcu_read_unlock(); - ie_len_he_cap = ieee80211_ie_len_he_cap(sdata, - NL80211_IFTYPE_MESH_POINT); - ie_len_eht_cap = ieee80211_ie_len_eht_cap(sdata, - NL80211_IFTYPE_MESH_POINT); + ie_len_he_cap = ieee80211_ie_len_he_cap(sdata); + ie_len_eht_cap = ieee80211_ie_len_eht_cap(sdata); head_len = hdr_len + 2 + /* NULL SSID */ /* Channel Switch Announcement */ diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index e3aad60f68ab..7ba0f01805a4 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2008, 2009 open80211s Ltd. - * Copyright (C) 2019, 2021-2023 Intel Corporation + * Copyright (C) 2019, 2021-2024 Intel Corporation * Author: Luis Carlos Cobo */ #include @@ -226,10 +226,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, int hdr_len = offsetofend(struct ieee80211_mgmt, u.action.u.self_prot); int err = -ENOMEM; - ie_len_he_cap = ieee80211_ie_len_he_cap(sdata, - NL80211_IFTYPE_MESH_POINT); - ie_len_eht_cap = ieee80211_ie_len_eht_cap(sdata, - NL80211_IFTYPE_MESH_POINT); + ie_len_he_cap = ieee80211_ie_len_he_cap(sdata); + ie_len_eht_cap = ieee80211_ie_len_eht_cap(sdata); skb = dev_alloc_skb(local->tx_headroom + hdr_len + 2 + /* capability info */ diff --git a/net/mac80211/util.c b/net/mac80211/util.c index d85a9c5cde26..e9a7978d47d4 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3272,7 +3272,8 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, return pos; } -u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) +/* this may return more than ieee80211_ie_build_he_cap() will need */ +u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata) { const struct ieee80211_sta_he_cap *he_cap; struct ieee80211_supported_band *sband; @@ -3282,7 +3283,7 @@ u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) if (!sband) return 0; - he_cap = ieee80211_get_he_iftype_cap(sband, iftype); + he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); if (!he_cap) return 0; @@ -5065,7 +5066,8 @@ u16 ieee80211_encode_usf(int listen_interval) return (u16) listen_interval; } -u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) +/* this may return more than ieee80211_ie_build_eht_cap() will need */ +u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata) { const struct ieee80211_sta_he_cap *he_cap; const struct ieee80211_sta_eht_cap *eht_cap; @@ -5077,13 +5079,12 @@ u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) if (!sband) return 0; - he_cap = ieee80211_get_he_iftype_cap(sband, iftype); - eht_cap = ieee80211_get_eht_iftype_cap(sband, iftype); + he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); + eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); if (!he_cap || !eht_cap) return 0; - is_ap = iftype == NL80211_IFTYPE_AP || - iftype == NL80211_IFTYPE_P2P_GO; + is_ap = sdata->vif.type == NL80211_IFTYPE_AP; n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, &eht_cap->eht_cap_elem, -- 2.43.0