Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp273092rdb; Thu, 21 Dec 2023 08:45:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtkbSwWZLFOvhDrTqe8tiSaJchkh/IvDOCufWYSKEbgq5AJKttyXIWbYsIRBO6z18pApr+ X-Received: by 2002:a17:90a:ea88:b0:28c:191:132a with SMTP id h8-20020a17090aea8800b0028c0191132amr365621pjz.7.1703177132205; Thu, 21 Dec 2023 08:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703177132; cv=none; d=google.com; s=arc-20160816; b=MxtbpubJMnuTrnrpsAcmRVdT2h6hE9rcBTe169M2j7mbYhUxnt05Fb9xMMTQmlATvW /phMw4MwVsRwx12xuYk2bn7j+10iB4xzCR2kdhU/wTe0IvRh/gV2TXKUnx/jf9rBGsPz rcm0mypZOjlLPgZHjaly5Ngl6bA+m7v/hPDYaAZPW0dvcNo14oupHrm2q3lGLoXeSKp1 p/9qcpXddly9xYNa9JqMoY6gpJBeU2MUVRw0Oi9vIbMV9LT1RFnxZRqOh1lyQ+AZ4NZD OI/haP8tbOHZ+HVmPY27AaOeurzCUWV/5BV6xBXknXH5LhDWvw5DzKNBf7xg4UvYiP09 8pZQ== 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=jbPBCL8asc0tD7whYSrHIT9BZnwfAuyYIxS588VM4fE=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=D4Z3yKY0Gq5Tgx5Kn4YggPgfXT3YpqtisiGB8ZYbPIE8J8P2BX1VeUMFG1gRl7eY1F gI6OKfZcgbBnsY0RFavBKH4fstB9jHpLzP6LFa1P7MV6+HCDivVuKqNUjF/siYn9fi0t CkE0rnhdEtS5zr8+88gIotZQnMgxyKxYWcylR3vV3jwisXfn5EXcqsmVqFrB/qqGPmjN ozIh32UEq+Ch+UZ2BMRWKjESLkaAQ2wM6JIU2kyPVtrjbUog1RQaijUNhgWDaFOha+Ku 0yPXHPYAy58ZPlpggy4Wc87X4sdz1a9oVEOPwLc1QUEXUr4SRIqDOkQXsDMbrBS9HiCg y58A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=x6+yi+iI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1168-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 p5-20020a17090ab90500b0028bbf3d667asi4604869pjr.71.2023.12.21.08.45.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:45:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1168-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=x6+yi+iI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1168-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 D77A9286295 for ; Thu, 21 Dec 2023 16:45:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3564F634FB; Thu, 21 Dec 2023 16:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x6+yi+iI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="i7LFpfmf" 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 C6EDD62815 for ; Thu, 21 Dec 2023 16:44:16 +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=1703177045; 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=jbPBCL8asc0tD7whYSrHIT9BZnwfAuyYIxS588VM4fE=; b=x6+yi+iIRRq4KOr4/nhWqVi+rCTU/HH7obCDWxKvpEALZIrbS66WLXqV0sfe+TsluU0jq6 IjNsENBh6fqWGNY/eFlGnywKfSDoC22sjSB5atUdJ4KbGla1nl5pSj1CeUNjElUHYIoeBC b05+/mnZz1Ne7IJ+rR3VO2SVcAy/xMtRtl82MUvc3/wlYYJTTY52/OweTMy66DfgRYZfLB IlzMPIYNRJ4oJVOcqvTr/MMZyWqzNPDYmYFYKbzU2Ob0gGAfQvbA+cu8et+PQRfH/vURGu mtHbcedXoHRMbbxrAp7onJygPGmmtPm3kjxuwnnbTu+zR5D0rjoLY03etpAHrg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703177045; 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=jbPBCL8asc0tD7whYSrHIT9BZnwfAuyYIxS588VM4fE=; b=i7LFpfmfxIu5ckT0XldwLGrZcPYJamiwlK3rf2r54vnfASg4WMwd7esvaGWNYnTC/mbdbP gilRSIyPqtkrQUBA== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v2 17/21] wifi: rtl8xxxu: add macids for STA mode Date: Thu, 21 Dec 2023 17:43:49 +0100 Message-Id: <20231221164353.603258-18-martin.kaistra@linutronix.de> In-Reply-To: <20231221164353.603258-1-martin.kaistra@linutronix.de> References: <20231221164353.603258-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 Until now, the driver only assigned a dedicated macid for connections made in AP mode, in STA mode the return value of rtl8xxxu_get_macid() was simply 0. To differentiate between port 0 and 1, when both are in STA mode, allocate a second macid (with value 1) and set sta_info->macid according to the used port_num in rtl8xxxu_sta_add(). Signed-off-by: Martin Kaistra --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 9d272da373a3c..6a58897446f4c 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1774,6 +1774,7 @@ struct rtl8xxxu_cfo_tracking { #define RTL8XXXU_HW_LED_CONTROL 2 #define RTL8XXXU_MAX_MAC_ID_NUM 128 #define RTL8XXXU_BC_MC_MACID 0 +#define RTL8XXXU_BC_MC_MACID1 1 struct rtl8xxxu_priv { struct ieee80211_hw *hw; diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 5e4e6c006cc1f..0b6eac14f60e5 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4053,10 +4053,13 @@ static inline u8 rtl8xxxu_get_macid(struct rtl8xxxu_priv *priv, { struct rtl8xxxu_sta_info *sta_info; - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION || !sta) + if (!sta) return 0; sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; + if (!sta_info) + return 0; + return sta_info->macid; } @@ -4536,6 +4539,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) rtl8188e_ra_info_init_all(&priv->ra_info); set_bit(RTL8XXXU_BC_MC_MACID, priv->mac_id_map); + set_bit(RTL8XXXU_BC_MC_MACID1, priv->mac_id_map); exit: return ret; @@ -7375,6 +7379,7 @@ static int rtl8xxxu_sta_add(struct ieee80211_hw *hw, struct ieee80211_sta *sta) { struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; + struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; struct rtl8xxxu_priv *priv = hw->priv; if (vif->type == NL80211_IFTYPE_AP) { @@ -7384,6 +7389,17 @@ static int rtl8xxxu_sta_add(struct ieee80211_hw *hw, rtl8xxxu_refresh_rate_mask(priv, 0, sta, true); priv->fops->report_connect(priv, sta_info->macid, H2C_MACID_ROLE_STA, true); + } else { + switch (rtlvif->port_num) { + case 0: + sta_info->macid = RTL8XXXU_BC_MC_MACID; + break; + case 1: + sta_info->macid = RTL8XXXU_BC_MC_MACID1; + break; + default: + break; + } } return 0; -- 2.39.2