Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp152854rdb; Wed, 20 Dec 2023 08:34:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHv9jPZch+tYpEdsLeaRK91sHYQ0AXS+Uy0SpKZM0DbBHDtk00UJmTyRZ6180Y0nE8ldYZ8 X-Received: by 2002:ac2:5fec:0:b0:50e:3d69:69a7 with SMTP id s12-20020ac25fec000000b0050e3d6969a7mr2152968lfg.42.1703090079429; Wed, 20 Dec 2023 08:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703090079; cv=none; d=google.com; s=arc-20160816; b=BkhdH61otQY4JH3ItCaUj/EGUjglcAVu8x48mEYP7Vw21J07VxeqIfwbdmowQqS76S 8g+w1sqUMC/bXpIwv9AUaOH9BY8C+BT+9cUCkdVPwfBQXICBxAGSdbRFhqkiLliWD324 7RnGEfKD1qysA1F9C+dj7oDSFhbE3HR00ug6SNwciZDLCGiPA7+fkCdtD1eWC3fceAhw TaRtCtqRsGDr051DdvjG5+50VlIfddoyNR2N7lnaSyeitO7vKkKhPfKgQj2FlwrNxU59 PKAqRfezpwdHC8CxJAOIEPnitvg+fhJD4v6B5GkaHdkNmvtFpqG87v7ZzVhc3IV1WxLF 3GDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature :dkim-signature:message-id; bh=8vI3SMn+F4CvpUEkd9qs/NQGLMpxsSEtKPBCudnJFao=; fh=B8o+z0BrKEPgpj9MKmYUFYnGwr+ws6ED0wqC2zV4cSs=; b=Z6234+Ka1+qme7taAlYEUMxumECFtzQZ6KmF06Arc4vESuqQjFFbkgKhvQY7ykTSq6 iFtgyQJiTNqfub1JVEaeS2+GcYoczeAGld1ynEQv5gsZrfYQdoBmOor5nLBgSCqj1Kn5 YJdZqW5d2OnPoIZlHqQIGeXIbWT1gBW2xk4ghDniiOYhCpbpRN+we6jVGQsXTVxqDYUN m5R+VDsaOpFAKB7AwfT206vc1DFRqLm4YkqW3blMXs53VCLeflGQLpJcg/DK6T511xmJ u9oJrPy2UVVrOnESNIoOqKsUJjFU+tFfA9mp+OUHKh1nAGRfkc2S/k4s9cI6vUHd5AJx Rl7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=c0MQywCI; dkim=neutral (no key) header.i=@linutronix.de header.b=ksfdwTXA; spf=pass (google.com: domain of linux-wireless+bounces-1106-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1106-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a7-20020a170906684700b00a2359ea8952si2682762ejs.898.2023.12.20.08.34.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 08:34:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1106-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=c0MQywCI; dkim=neutral (no key) header.i=@linutronix.de header.b=ksfdwTXA; spf=pass (google.com: domain of linux-wireless+bounces-1106-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1106-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 053831F24BBE for ; Wed, 20 Dec 2023 16:34:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AADF3E477; Wed, 20 Dec 2023 16:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="c0MQywCI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ksfdwTXA" 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 812562BB0C for ; Wed, 20 Dec 2023 16:34:32 +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 Message-ID: <797e4962-2ff3-4ae5-a1a7-d4d964fb768d@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703090070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8vI3SMn+F4CvpUEkd9qs/NQGLMpxsSEtKPBCudnJFao=; b=c0MQywCIfZRB9c3QLsyiOKvRVFxTX6Sa14IvkXURLgC3ghePSzb34TaZ90LWu/LnkuB7kW uJmRclWOILd33LWaH6PLQYFKGnp7MnSHkf4fM6ttgUOFk1c1PvAXCwCdalG2TJ5gEmxb1M hXUFwl/eap8j4+yWMBazxjCgy+J0TW8qojXLkuifpGJnqyomyA2gZH/0IP/dRc3y3Zb6V3 pvWKojxyLTb9PGrtWrJY+D7GJWW5gbEnItBZ822b07Gcyw5yoQRsuoouylNdNBLrIGOsGD /mHIZ8849nqFtdw0w53f86KYHJDPboX3y6uKmb43vaj3muTFJVcka65M0mVShA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703090070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8vI3SMn+F4CvpUEkd9qs/NQGLMpxsSEtKPBCudnJFao=; b=ksfdwTXADXfao5Xws+9C5cV7KiwVxGfKHT0yB7qtduUH9oNPuhsVKgplvuhfY0rA5eydVw xEhVh/sIK6Sag7Bw== Date: Wed, 20 Dec 2023 17:34:29 +0100 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 19/20] wifi: rtl8xxxu: make supporting AP mode only on port 0 transparent To: Ping-Ke Shih , "linux-wireless@vger.kernel.org" Cc: Jes Sorensen , Kalle Valo , Bitterblue Smith , Sebastian Andrzej Siewior References: <20231218143645.433356-1-martin.kaistra@linutronix.de> <20231218143645.433356-20-martin.kaistra@linutronix.de> <56eed6a3e237435f9d21082ca12eeaec@realtek.com> Content-Language: de-DE From: Martin Kaistra In-Reply-To: <56eed6a3e237435f9d21082ca12eeaec@realtek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Am 20.12.23 um 07:28 schrieb Ping-Ke Shih: > > >> -----Original Message----- >> From: Martin Kaistra >> Sent: Monday, December 18, 2023 10:37 PM >> To: linux-wireless@vger.kernel.org >> Cc: Jes Sorensen ; Kalle Valo ; Ping-Ke Shih >> ; Bitterblue Smith ; Sebastian Andrzej Siewior >> >> Subject: [PATCH 19/20] wifi: rtl8xxxu: make supporting AP mode only on port 0 transparent >> >> When the driver is used for concurrent mode, both virtual interfaces can >> be set to station or AP mode, though only one can be in AP mode at the >> same time. >> >> In order to keep the code simple, use only hw port 0 for AP mode. When >> an interface is added in AP mode which would be assigned to port 1, use >> a switch_port function to transparently swap the mapping between virtual >> interface and hw port. >> >> Signed-off-by: Martin Kaistra >> --- >> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 84 ++++++++++++++++++- >> 1 file changed, 82 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> index 88730791091a7..595f447874f4d 100644 >> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> @@ -6613,6 +6613,84 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) >> return ret; >> } >> >> +static void rtl8xxxu_switch_ports(struct rtl8xxxu_priv *priv) >> +{ > > [...] > >> + >> + vif = priv->vifs[0]; >> + priv->vifs[0] = priv->vifs[1]; >> + priv->vifs[1] = vif; >> + rtlvif = (struct rtl8xxxu_vif *)priv->vifs[1]->drv_priv; >> + rtlvif->port_num = 1; > > nit: Would it be better to swap port_num as well? Currently, port_num of vifs[0] > will be set to 0 by caller, but not sure if further people could misuse this > function. the main reason, I did not include setting port_num for priv->vifs[0], is that priv->vifs[0] is a NULL pointer in the current way this function is called from rtl8xxxu_add_interface(). do you think it makes sense to add if (priv->vifs[0]) rtlvif = (struct rtl8xxxu_vif *)priv->vifs[0]->drv_priv; rtlvif->port_num = 0; just for completeness sake, even though this code path will currently never get executed? > > >> +} >> + >> static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, >> struct ieee80211_vif *vif) >> { >> @@ -6640,8 +6718,10 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, >> } >> break; >> case NL80211_IFTYPE_AP: >> - if (port_num == 1) >> - return -EOPNOTSUPP; >> + if (port_num == 1) { >> + rtl8xxxu_switch_ports(priv); >> + port_num = 0; >> + } >> >> rtl8xxxu_write8(priv, REG_BEACON_CTRL, >> BEACON_DISABLE_TSF_UPDATE | BEACON_CTRL_MBSSID); >> -- >> 2.39.2 >