Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp376846rdb; Tue, 19 Dec 2023 22:28:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyb6ay4zJWXhhLCu7+wvbhw8XLmIIEqdZYn++XCu3SSuYwdg+FojbaaVoha5RceNvOM0hv X-Received: by 2002:a05:620a:ecf:b0:77f:23e:4405 with SMTP id x15-20020a05620a0ecf00b0077f023e4405mr18793768qkm.62.1703053719468; Tue, 19 Dec 2023 22:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703053719; cv=none; d=google.com; s=arc-20160816; b=RZGdXtwO5Fl/W0isMJ1+Pk7VZR8hpy+QAtZ8rLKGlDgZqVUc/TCCWH0sX9hYuPRK4u 4skeUe56kYbN+UJuuFK1GKlat8V6aDbzZX1wQA5N1qiT+dxhs2Vt1Ffc9bdHVucWYgD1 zMVn7ZLo6CR4Nau8hwu2aurBpcEToj4uwhOat9CaviUT8DT3UwdXFkbC7dhkIoVpoT3N b+gW3oQWk+Gw0VdC4Dz1E27wH4yt4yOYu0QuIIZ6IB9U1yDIsHKbpFTyWdcOeT9f+woQ AOoiqsXi9MeCHH4vJJdpnIxxXZM2xfiKw2vt3Q1lCwXhnvTK5slK+RN4PTYFVRal82db /WYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=+Ri4bla8a3PxNF//EvRzaIdOvDz9vf+LEFZuiLHUiRI=; fh=LQGtYe9vP0onFiP/6l3tkQw/DADLCp+GjsQcHD3gn8k=; b=m3jrYsrKLR3jNp+KiijUHbp02o3ih2AYkGXSSbLntLt4GWQG50qqfJbVq13Vgvms4D 0d1sUySfEK+aTo1eG1XEL4wAo0NwCgnqeLZa6U1QGf7VZSTiH0piz8/+2lM72HnNVhwR ceO8kzZwbVdfoEaSOVniB+jl085i3M3YQmvF6/TScK/S6qQoxpFOg3Xl+cXBLgXgVQB7 fABMRQdtVqHxTVVdFA63utWer0z12djD7T8TgLJWQeKyBGEqQvt7RNE0mNdBn3m33jXs rJqfG+/ahXQbZHVY8A3iITnb87CkvX7M0qXsuFmCQ5WazvJr3NhqYKq3Dw+mtFs4dgz4 ltRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1066-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b25-20020a05620a119900b00780ea2cf996si5835125qkk.463.2023.12.19.22.28.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 22:28:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1066-linux.lists.archive=gmail.com@vger.kernel.org" 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 2A67B1C22121 for ; Wed, 20 Dec 2023 06:28:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6CAD11734; Wed, 20 Dec 2023 06:28:35 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 316F111715 for ; Wed, 20 Dec 2023 06:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3BK6SMST0515819, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 3BK6SMST0515819 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Dec 2023 14:28:22 +0800 Received: from RTEXMBS06.realtek.com.tw (172.21.6.99) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Wed, 20 Dec 2023 14:28:22 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 20 Dec 2023 14:28:22 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7]) by RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7%5]) with mapi id 15.01.2375.007; Wed, 20 Dec 2023 14:28:22 +0800 From: Ping-Ke Shih To: Martin Kaistra , "linux-wireless@vger.kernel.org" CC: Jes Sorensen , Kalle Valo , Bitterblue Smith , Sebastian Andrzej Siewior Subject: RE: [PATCH 19/20] wifi: rtl8xxxu: make supporting AP mode only on port 0 transparent Thread-Topic: [PATCH 19/20] wifi: rtl8xxxu: make supporting AP mode only on port 0 transparent Thread-Index: AQHaMb/t7UraxeutE0+U7Z3itK4it7Cxt0zA Date: Wed, 20 Dec 2023 06:28:21 +0000 Message-ID: <56eed6a3e237435f9d21082ca12eeaec@realtek.com> References: <20231218143645.433356-1-martin.kaistra@linutronix.de> <20231218143645.433356-20-martin.kaistra@linutronix.de> In-Reply-To: <20231218143645.433356-20-martin.kaistra@linutronix.de> Accept-Language: en-US, zh-TW Content-Language: zh-TW x-kse-serverinfo: RTEXMBS06.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback > -----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 ; Sebasti= an Andrzej Siewior > > Subject: [PATCH 19/20] wifi: rtl8xxxu: make supporting AP mode only on po= rt 0 transparent >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Martin Kaistra > --- > .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 84 ++++++++++++++++++- > 1 file changed, 82 insertions(+), 2 deletions(-) >=20 > 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 ieee8021= 1_hw *hw) > return ret; > } >=20 > +static void rtl8xxxu_switch_ports(struct rtl8xxxu_priv *priv) > +{ [...] > + > + vif =3D priv->vifs[0]; > + priv->vifs[0] =3D priv->vifs[1]; > + priv->vifs[1] =3D vif; > + rtlvif =3D (struct rtl8xxxu_vif *)priv->vifs[1]->drv_priv; > + rtlvif->port_num =3D 1; nit: Would it be better to swap port_num as well? Currently, port_num of vi= fs[0] will be set to 0 by caller, but not sure if further people could misuse thi= s function. > +} > + > 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 =3D=3D 1) > - return -EOPNOTSUPP; > + if (port_num =3D=3D 1) { > + rtl8xxxu_switch_ports(priv); > + port_num =3D 0; > + } >=20 > rtl8xxxu_write8(priv, REG_BEACON_CTRL, > BEACON_DISABLE_TSF_UPDATE | BEACON_CTRL_M= BSSID); > -- > 2.39.2