Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp272667rdb; Thu, 21 Dec 2023 08:44:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJiMuUwTo9br2Rwho74M8qrLqhw6Im012mniQxdpZzdnYg/ZDQbjLmc91qFk2aXk/qYNNK X-Received: by 2002:a05:6214:1023:b0:67a:bce4:e2e3 with SMTP id k3-20020a056214102300b0067abce4e2e3mr18369678qvr.5.1703177087773; Thu, 21 Dec 2023 08:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703177087; cv=none; d=google.com; s=arc-20160816; b=ELurPnAPBTAbis/Qql4AhU/g38PRPT337547ZBtd/rRMWztMZXZiBB4LQcxhx3t6bT lBCP6sSBtIY64VkhWDAEn2MaY2qgvwHwzXX6+bPTVgKYo419gMBH3fM2PAwngDsZYChL CuNoINT5IRyXJO4pyGMJW7Gki96BIdT9NqqCHKyi+yLzfL4D++cY88j6iQsguj/TFDQY 7rPCRFwYSeTFfti+sFmGBLSq95HTcQOpIIgEuovTfBgujylRwGEOJl0f55VvIakUocRG jtl32uLueFO83cHOqQDfPVBHt/NhpxgB67sjcDU+pPXOIQ49eQ52BHLOi0Tj0op/Kk0L n9lw== 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=43NbwlNaFzVIc5XSe7laQbDtYbGsuzb24fzj9Y2JK7c=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=I+s4JdESJY3LZDyz1XGXX6rXdTRQIAnshL2ixzAd7GRkR07SNbRNh9jdeqUKARvW5y 0yJa+OH6iIkq8Jq1LtIBA7kjACiBHJfyKUSdu4KiwQTVhPe36OxlJrFr4m/sG+8MXXap T6SLmgEFsZzlFISR9KFY6jHZ6ly+cs79a+ah4snl7IOdtqLP2usAzlSSK4Rz2sJ/mh+I me9BnHo5yWJeylXzQ4Vg29Ym3ipxQG93kPgwtmjMLpYfE/0E9VogUIfPMfbk9qJKwB5s vk6SevJNFn7Y3+MGfRGKmJJZQs1ihJm8q3T7iEsYA87t7jdK+4kLgKXuLQdICp6vTzeV fyXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BXVG4kW4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1157-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1157-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 bi41-20020a05620a31a900b0077f03b587d5si2701894qkb.533.2023.12.21.08.44.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:44:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1157-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=BXVG4kW4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1157-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1157-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 74FB81C25849 for ; Thu, 21 Dec 2023 16:44:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BD2959923; Thu, 21 Dec 2023 16:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BXVG4kW4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5KgBtM6Q" 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 F015459913 for ; Thu, 21 Dec 2023 16:44:13 +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=1703177044; 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=43NbwlNaFzVIc5XSe7laQbDtYbGsuzb24fzj9Y2JK7c=; b=BXVG4kW4l4sA47u8Aoixs4AHERtlAmQ19532OfzxpT1YC9+p73VNiqPm5YNBloBfvQnn2E 6L87QCnF5vtgbPqXNoxhcLaCRqUn4rhnfc0VL7OK9Gu3drlLsmwFLRs0zS/jNNyu8ohXT5 0IXlBUka5/Wp6SsAhkz/KPiyEQIBxm9oK9UET5XFQxVwpFwqgO8/uxCsqS59+v2X/BmeG7 L7Oi0DSqnXwdevZuRft/y/EB1+q1nBYiotbOtZYzbW7v0JZU5zKfG1NQXUGDRGjVFYBVLo gulnk37hhyumJ7LPOR5i3ACx81YCR3XLOS10EzlzV9I9poz+zE8Zj6fqtTftbA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703177044; 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=43NbwlNaFzVIc5XSe7laQbDtYbGsuzb24fzj9Y2JK7c=; b=5KgBtM6Qyji2vk/g7SQM2+LaiXrJ04glW91eXkiZzAaEaW9lhQIHgty1N2ZnEWby4UyyP4 ykxXedCkU0pTnMDA== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v2 09/21] wifi: rtl8xxxu: support setting bssid register for multiple interfaces Date: Thu, 21 Dec 2023 17:43:41 +0100 Message-Id: <20231221164353.603258-10-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 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 Reviewed-by: Ping-Ke Shih --- .../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 6fff982f65253..490f35d0d6199 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