Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp138403rdh; Mon, 18 Dec 2023 06:37:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwwGUqpBx5Z0RmDnIKUz3707fAmKFSIR1QR8L4JthMl6E5ca/7azqn4KY9wZ2qptbq4+tL X-Received: by 2002:a05:6102:471a:b0:466:9488:89fc with SMTP id ei26-20020a056102471a00b00466948889fcmr748065vsb.26.1702910257044; Mon, 18 Dec 2023 06:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702910257; cv=none; d=google.com; s=arc-20160816; b=t1p1JRSxFWKibjDQBwCU8xVZHHZbki/vaaVGfjGvEQ3UZQpvri4PrDcqpvCf+kj4UJ qWQSSaMIA54Szm2qbbyxA0Nb0tfcLpWeGSm1ZkJ+H1WvxnZ9Rbvv2k9nJwGubs4gd43V u3wI6IMzogsoLUgLaUfrx4tTUF+LRdhz9YUIMIp5VeFHvVYGZn8W/fmCbYZ1fNiqeswR CNAagwx14Y/sgjhXwCK2P0H6ZjwJsSaXYWmO1V9CCBueib4xNFYH3ENT2oI/M7dKz/kG IeA7unxFRklQnt6a05xxn2+lJNy7RxmHX4/+ZhO68nKJOKR+l1O8WGgVRLFhvUmu14Gy 8ybw== 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=k8+CFs8OfHp7k35fgFXjfJ6UW+w61rwD8VdhyTuiwbk=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=nshtgop0Ixad/BMpnSdE4903e75JzDfAZwPr1DfwB5/XnZTfaNbBevgqU2rYu9CbDO Kg5stxMkBO5WDY2zcdPTr4qd11u8Xk8GI7u2A6mOTKT0tD7X0HFjJ2JLlSsBfoAJ8Ih2 C0jnWS2oA16wuljHyGdLClkLoIOTC/+i+2x0pQrHK/PCYiHPbS05+YNDgCKN250Glv40 impGoiGJMmCDXA1Va/qjFtWDCyYxzgJUZKrqkAAZzaAnwZomuthieosz4lcaoTmgRV2a 56mEunbWA2oyiIcdWj9YLARW2pAHIn5FQ4bTG+mAaDexaXrmh4OEkK3k0xI+qC52QhkY vKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=F19d2olF; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4le9jTUe; spf=pass (google.com: domain of linux-wireless+bounces-918-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w7-20020a05610205e700b004669e0015d8si152474vsf.788.2023.12.18.06.37.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 06:37:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-918-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=@linutronix.de header.s=2020 header.b=F19d2olF; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4le9jTUe; spf=pass (google.com: domain of linux-wireless+bounces-918-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-918-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C370C1C238F2 for ; Mon, 18 Dec 2023 14:37:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53D673A1D9; Mon, 18 Dec 2023 14:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="F19d2olF"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4le9jTUe" 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 063F537860 for ; Mon, 18 Dec 2023 14:37:11 +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=1702910228; 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=k8+CFs8OfHp7k35fgFXjfJ6UW+w61rwD8VdhyTuiwbk=; b=F19d2olFdTJ4eUo20sw97sVi9GG5+uraNCubkPx4V0gFW+awAVQY+w3GOg1Q47LI25ISJC a5syKDY85Y8PRpiTaJjSBYDO6Ajhsfalxe56j7B+85hA5oMV74FtffrXd1iNKFAyWAYnVK Ec6A+kADAHWckk4GOY53EuXTxB8CR52G2IBJo1wXtVnYYbA9Xj39ANFIswJ5g8QKiJqZYA R0zNwOu8PmFwEg2n8kjb6mltV7ZfqIde9yGSirncDy9p46dILzug9B1Cy54RsjrCHq684x IEg26XmIJZ8ja/VRtG43zfoA1Gdy5urNxLrH1DGtCe/jnbQp2uX6C1BPUOoTOw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1702910228; 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=k8+CFs8OfHp7k35fgFXjfJ6UW+w61rwD8VdhyTuiwbk=; b=4le9jTUeA+1JefP7Rsz61j8G6qo3BGyvdrvdL+IOQonqWlA1J773k2iUIXHAEPIlXfXqdn LDcrHFNdGJ1ldEAg== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH 08/20] wifi: rtl8xxxu: support setting bssid register for multiple interfaces Date: Mon, 18 Dec 2023 15:36:33 +0100 Message-Id: <20231218143645.433356-9-martin.kaistra@linutronix.de> In-Reply-To: <20231218143645.433356-1-martin.kaistra@linutronix.de> References: <20231218143645.433356-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 To prepare for concurrent mode, enhance rtl8xxxu_set_bssid() to write the BSSID of the respective interface to REG_BSSID or REG_BSSID1. Like done with rtl8xxxu_set_mac(), call rtl8xxxu_set_bssid() with port_num = 0, until the callers also support multiple interfaces. Signed-off-by: Martin Kaistra --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index c3039049e9f5b..2b546bce01237 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -3603,14 +3603,24 @@ static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num) return 0; } -static int rtl8xxxu_set_bssid(struct rtl8xxxu_priv *priv, const u8 *bssid) +static int rtl8xxxu_set_bssid(struct rtl8xxxu_priv *priv, const u8 *bssid, int port_num) { int i; u16 reg; dev_dbg(&priv->udev->dev, "%s: (%pM)\n", __func__, bssid); - reg = REG_BSSID; + switch (port_num) { + case 0: + reg = REG_BSSID; + break; + case 1: + reg = REG_BSSID1; + break; + default: + WARN_ONCE("%s: invalid port_num\n", __func__); + return -EINVAL; + } for (i = 0; i < ETH_ALEN; i++) rtl8xxxu_write8(priv, reg + i, bssid[i]); @@ -5068,7 +5078,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (changed & BSS_CHANGED_BSSID) { dev_dbg(dev, "Changed BSSID!\n"); - rtl8xxxu_set_bssid(priv, bss_conf->bssid); + rtl8xxxu_set_bssid(priv, bss_conf->bssid, 0); } if (changed & BSS_CHANGED_BASIC_RATES) { @@ -5097,7 +5107,7 @@ static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct device *dev = &priv->udev->dev; dev_dbg(dev, "Start AP mode\n"); - rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid); + rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid, 0); rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int); priv->fops->report_connect(priv, RTL8XXXU_BC_MC_MACID, 0, true); -- 2.39.2