Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp698661rdb; Fri, 22 Dec 2023 02:15:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBRmjf3DWPwmLRL5jze6JA1nj4L/g9JmscfADvmK9rXP2PK5uVZhhy3LUgoCfHBUjtfZQv X-Received: by 2002:a05:6808:1155:b0:3bb:86f5:2dcb with SMTP id u21-20020a056808115500b003bb86f52dcbmr1441296oiu.72.1703240115621; Fri, 22 Dec 2023 02:15:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703240115; cv=none; d=google.com; s=arc-20160816; b=jQ30gxrSxN8hHreOgzJ1uO4dxWi+OB839MxYTwr3VbrdPHEvyPg2PTFbLLHuTqEhFD oyslaivNq+nlzXR1XfqQGkgB/1hycM/fD+gLN7f1aP7kFRc7MMCqSHfPtKwsZHGrjn/Z coJnpOjKSMaiVDOyiH/W3sPqoSgtdvB2mULHN2kxrlSz3hV0RiBtP4nRfSk3exWsFJsA W5Z65EpJXXB64q4IhoOQaGDvNialFAoFFVwsvKTkGnayIggpiidymhVD3IeJAEjEYrcl wU/Zuxd5vo7As973v2DCwzp2K8nPDtJy97lQ+8j4NSO/w/NbggKrRS7wOsZixASGBLWP Ljjg== ARC-Message-Signature: i=1; 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:dkim-signature:dkim-signature:from; bh=8t0lIqToI+GCrOO3Dy/d7o1P1Q/lQmkoeEK94dOQEx4=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=1G++yQ64dyDmJr2l9kwuCdNGdXtwmnwM7/7cUm04omec9FdEwa6vP4k6p57yPcjK6d Vyej1luDHJe9Ld21R2jmY2DPVxrAs008ncncvM1QANfIpuIbBBXP+T4PGhlj+d1SG9uq LYo9bywV8KD3BdaPyxBPsKzlyC2X1mRw3dmQN/melSvP7Uyey2FnDRYwckNkh7mh9/wS ++f7bMyCNZzypVaDopQ7fRXPpZ8bodaIGxVLcYVE9UxSSPBnKH0DPLxyZBjsa9HKAEEi lRaIfarSZFStmGsGgn+mSkqnwpMPJSScEzGfJCzr+V4U5AS9olV/0RY7im3XpdQ/vVag GjFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="hYOd7gO/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IS1l+F5K; spf=pass (google.com: domain of linux-wireless+bounces-1227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n3-20020a634003000000b005cdfc8a73e8si186228pga.287.2023.12.22.02.15.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 02:15:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="hYOd7gO/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IS1l+F5K; spf=pass (google.com: domain of linux-wireless+bounces-1227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E141B287CE9 for ; Fri, 22 Dec 2023 10:15:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE3F91773B; Fri, 22 Dec 2023 10:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hYOd7gO/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IS1l+F5K" X-Original-To: linux-wireless@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 7E79B168DC for ; Fri, 22 Dec 2023 10:14:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703240088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8t0lIqToI+GCrOO3Dy/d7o1P1Q/lQmkoeEK94dOQEx4=; b=hYOd7gO/zIZTJxFBGO9uw4XCWLA4KVwTh2ynegCbPatlkQzHyEkIKbarCqW9qaoyMkA2Wn TapGiRTmWiSkMKayLjTw53El3jDswOr4v0+dfqi8NyIRZ368WDfOLpdktdXoJfnii8rugt Gux0egAe05xTKJRhGBHrUxoLWICEPA68dKSK5qSWrff9gZcsJY5DVOa6dpKoU4ku2ufQXF mrE0o3dFQDwOqAyCHp2Vl9rcyIfFyVIsu3i3heYdUga0sFmkbE4FyJjvzsDaag0vl0TFWU OUJPg7X2b6ZH+GDfFaFcqG+R9PZ8nTEdPMV6AwWkrXtjccQjx9/zX9lPqq4tiw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703240088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8t0lIqToI+GCrOO3Dy/d7o1P1Q/lQmkoeEK94dOQEx4=; b=IS1l+F5KBjG4/D/VKrkT3x0W8SPWhqVDEamP8W2s8YLEgvx23HgW2VGNiWmgMK0phMOiNW 7QA5I2wPwXD0lrAA== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v3 07/21] wifi: rtl8xxxu: extend check for matching bssid to both interfaces Date: Fri, 22 Dec 2023 11:14:28 +0100 Message-Id: <20231222101442.626837-8-martin.kaistra@linutronix.de> In-Reply-To: <20231222101442.626837-1-martin.kaistra@linutronix.de> References: <20231222101442.626837-1-martin.kaistra@linutronix.de> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The driver will support two interfaces soon, which both can be in station mode, so extend the check, whether cfo information should be parsed, to cover both interfaces. For better code readability put the lines with priv->vifs[port_num] in a separate function. Signed-off-by: Martin Kaistra Reviewed-by: Ping-Ke Shih --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index fd6b6e2eba038..ca0d885eabb71 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5706,6 +5706,16 @@ static void rtl8xxxu_update_beacon_work_callback(struct work_struct *work) rtl8xxxu_send_beacon_frame(hw, vif); } +static inline bool rtl8xxxu_is_packet_match_bssid(struct rtl8xxxu_priv *priv, + struct ieee80211_hdr *hdr, + int port_num) +{ + return priv->vifs[port_num] && + priv->vifs[port_num]->type == NL80211_IFTYPE_STATION && + priv->vifs[port_num]->cfg.assoc && + ether_addr_equal(priv->vifs[port_num]->bss_conf.bssid, hdr->addr2); +} + void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv, struct ieee80211_rx_status *rx_status, struct rtl8723au_phy_stats *phy_stats, @@ -5722,12 +5732,10 @@ void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv, rx_status->signal = priv->fops->cck_rssi(priv, phy_stats); } else { bool parse_cfo = priv->fops->set_crystal_cap && - priv->vif && - priv->vif->type == NL80211_IFTYPE_STATION && - priv->vif->cfg.assoc && !crc_icv_err && !ieee80211_is_ctl(hdr->frame_control) && - ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2); + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) || + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1)); if (parse_cfo) { priv->cfo_tracking.cfo_tail[0] = phy_stats->path_cfotail[0]; @@ -5762,12 +5770,10 @@ static void jaguar2_rx_parse_phystats_type1(struct rtl8xxxu_priv *priv, bool crc_icv_err) { bool parse_cfo = priv->fops->set_crystal_cap && - priv->vif && - priv->vif->type == NL80211_IFTYPE_STATION && - priv->vif->cfg.assoc && !crc_icv_err && !ieee80211_is_ctl(hdr->frame_control) && - ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2); + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) || + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1)); u8 pwdb_max = 0; int rx_path; -- 2.39.2