diff mbox series

[v3,21/21] wifi: rtl8xxxu: declare concurrent mode support for 8188f

Message ID 20231222101442.626837-22-martin.kaistra@linutronix.de (mailing list archive)
State Accepted
Commit 1cd165adf314f6bf25cde58f02f4ff51d01730b0
Delegated to: Kalle Valo
Headers show
Series wifi: rtl8xxxu: Add concurrent mode for 8188f | expand

Commit Message

Martin Kaistra Dec. 22, 2023, 10:14 a.m. UTC
Everything is in place now for concurrent mode, we can tell the system
that we support it.
We will allow a maximum of 2 virtual interfaces, one of them can be in
AP mode.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
---
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h  |  1 +
 .../realtek/rtl8xxxu/rtl8xxxu_8188f.c         |  1 +
 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+)

Comments

Zenm Chen Jan. 11, 2024, 4:36 p.m. UTC | #1
Hi,

The rtl8xxxu driver can't establish the connection after applying this series
of the patches. Please help me, thanks!

OS: Arch Linux (kernel version: 6.6.10-arch1-1)
devices tested: MERCUSYS MW300UM (RTL8192EU)
                MERCURY MW310UH  (RTL8192FU)

dmesg:
[  161.984182] usb 1-4: new high-speed USB device number 3 using ehci-pci
[  162.131919] usb 1-4: New USB device found, idVendor=0bda, idProduct=818b, bcdDevice= 2.00
[  162.131930] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  162.131935] usb 1-4: Product: 802.11n NIC 
[  162.131938] usb 1-4: Manufacturer: Realtek 
[  162.131941] usb 1-4: SerialNumber: 00e04c000001
[  162.355271] usb 1-4: RTL8192EU rev B (SMIC) romver 0, 2T2R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[  162.355288] usb 1-4: RTL8192EU MAC: 00:eb:d8:76:23:92
[  162.355294] usb 1-4: rtl8xxxu: Loading firmware rtlwifi/rtl8192eu_nic.bin
[  162.356370] usb 1-4: Firmware revision 35.7 (signature 0x92e1)
[  163.453122] usb 1-4: Enabling HT_20_40 on the 2.4GHz band
[  163.455327] usbcore: registered new interface driver rtl8xxxu
[  163.475365] rtl8xxxu 1-4:1.0 wlp0s18f2u4: renamed from wlan0
[  186.034061] wlp0s18f2u4: authenticate with bc:e6:3f:5f:9c:cd
[  186.045683] wlp0s18f2u4: send auth to bc:e6:3f:5f:9c:cd (try 1/3)
[  186.050060] wlp0s18f2u4: authenticated
[  186.054184] wlp0s18f2u4: associate with bc:e6:3f:5f:9c:cd (try 1/3)
[  186.077089] wlp0s18f2u4: RX AssocResp from bc:e6:3f:5f:9c:cd (capab=0x411 status=0 aid=1)
[  186.078853] usb 1-4: rtl8xxxu_bss_info_changed: HT supported
[  186.081741] wlp0s18f2u4: associated
[  186.218451] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
[  195.553755] warning: `ThreadPoolForeg' uses wireless extensions which will stop working for Wi-Fi 7 hardware; use nl80211
[  231.035382] wlp0s18f2u4: deauthenticating from bc:e6:3f:5f:9c:cd by local choice (Reason: 3=DEAUTH_LEAVING)
[  233.770396] wlp0s18f2u4: authenticate with bc:e6:3f:5f:9c:cd
[  233.782081] wlp0s18f2u4: send auth to bc:e6:3f:5f:9c:cd (try 1/3)
[  233.784161] wlp0s18f2u4: authenticated
[  233.787506] wlp0s18f2u4: associate with bc:e6:3f:5f:9c:cd (try 1/3)
[  233.803705] wlp0s18f2u4: RX AssocResp from bc:e6:3f:5f:9c:cd (capab=0x411 status=0 aid=1)
[  233.805501] usb 1-4: rtl8xxxu_bss_info_changed: HT supported
[  233.808383] wlp0s18f2u4: associated
[  233.836597] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
[  279.032159] wlp0s18f2u4: deauthenticating from bc:e6:3f:5f:9c:cd by local choice (Reason: 3=DEAUTH_LEAVING)
[  280.657559] wlp0s18f2u4: authenticate with bc:e6:3f:5f:9c:cd
[  280.669301] wlp0s18f2u4: send auth to bc:e6:3f:5f:9c:cd (try 1/3)
[  280.671303] wlp0s18f2u4: authenticated
[  280.674082] wlp0s18f2u4: associate with bc:e6:3f:5f:9c:cd (try 1/3)
[  280.688088] wlp0s18f2u4: RX AssocResp from bc:e6:3f:5f:9c:cd (capab=0x411 status=0 aid=1)
[  280.689881] usb 1-4: rtl8xxxu_bss_info_changed: HT supported
[  280.692761] wlp0s18f2u4: associated
[  280.743720] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
[  326.035411] wlp0s18f2u4: deauthenticating from bc:e6:3f:5f:9c:cd by local choice (Reason: 3=DEAUTH_LEAVING)
[  328.697827] wlp0s18f2u4: authenticate with bc:e6:3f:5f:9c:cd
[  328.709441] wlp0s18f2u4: send auth to bc:e6:3f:5f:9c:cd (try 1/3)
[  328.716384] wlp0s18f2u4: authenticated
[  328.720811] wlp0s18f2u4: associate with bc:e6:3f:5f:9c:cd (try 1/3)
[  328.739267] wlp0s18f2u4: RX AssocResp from bc:e6:3f:5f:9c:cd (capab=0x411 status=0 aid=1)
[  328.741111] usb 1-4: rtl8xxxu_bss_info_changed: HT supported
[  328.744014] wlp0s18f2u4: associated
[  328.765823] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
[  374.035605] wlp0s18f2u4: deauthenticating from bc:e6:3f:5f:9c:cd by local choice (Reason: 3=DEAUTH_LEAVING)
[  675.415603] wlp0s18f2u4: authenticate with bc:e6:3f:5f:9c:cd
[  675.427238] wlp0s18f2u4: send auth to bc:e6:3f:5f:9c:cd (try 1/3)
[  675.434465] wlp0s18f2u4: authenticated
[  675.437328] wlp0s18f2u4: associate with bc:e6:3f:5f:9c:cd (try 1/3)
[  675.451227] wlp0s18f2u4: RX AssocResp from bc:e6:3f:5f:9c:cd (capab=0x411 status=0 aid=1)
[  675.453061] usb 1-4: rtl8xxxu_bss_info_changed: HT supported
[  675.455938] wlp0s18f2u4: associated
[  675.508092] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
[  721.037516] wlp0s18f2u4: deauthenticating from bc:e6:3f:5f:9c:cd by local choice (Reason: 3=DEAUTH_LEAVING)
[  723.744620] wlp0s18f2u4: authenticate with bc:e6:3f:5f:9c:cd
[  723.756204] wlp0s18f2u4: send auth to bc:e6:3f:5f:9c:cd (try 1/3)
[  723.758400] wlp0s18f2u4: authenticated
[  723.760735] wlp0s18f2u4: associate with bc:e6:3f:5f:9c:cd (try 1/3)
[  723.774653] wlp0s18f2u4: RX AssocResp from bc:e6:3f:5f:9c:cd (capab=0x411 status=0 aid=1)
[  723.776369] usb 1-4: rtl8xxxu_bss_info_changed: HT supported
[  723.779249] wlp0s18f2u4: associated
[  723.847090] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
Ping-Ke Shih Jan. 12, 2024, 12:33 a.m. UTC | #2
> -----Original Message-----
> From: Zenm Chen <zenmchen@gmail.com>
> Sent: Friday, January 12, 2024 12:36 AM
> To: martin.kaistra@linutronix.de
> Cc: Jes.Sorensen@gmail.com; bigeasy@linutronix.de; kvalo@kernel.org; linux-wireless@vger.kernel.org;
> Ping-Ke Shih <pkshih@realtek.com>; rtl8821cerfe2@gmail.com
> Subject: [PATCH v3 21/21] wifi: rtl8xxxu: declare concurrent mode support for 8188f
> 
> Hi,
> 
> The rtl8xxxu driver can't establish the connection after applying this series
> of the patches. Please help me, thanks!
> 
> OS: Arch Linux (kernel version: 6.6.10-arch1-1)
> devices tested: MERCUSYS MW300UM (RTL8192EU)
>                 MERCURY MW310UH  (RTL8192FU)
> 

[...]

> [  186.081741] wlp0s18f2u4: associated
> [  186.218451] wlp0s18f2u4: Limiting TX power to 30 (30 - 0) dBm as advertised by bc:e6:3f:5f:9c:cd
> [  195.553755] warning: `ThreadPoolForeg' uses wireless extensions which will stop working for Wi-Fi 7
> hardware; use nl80211
> [  231.035382] wlp0s18f2u4: deauthenticating from bc:e6:3f:5f:9c:cd by local choice (Reason:
> 3=DEAUTH_LEAVING)

Locally trying to disconnect after 30 seconds. Can you try non-secure
connection and specify static IP to see if it can work? 

I reviewed the patchset again, no obvious change if you are using a vif with
station mode only. The only one I'm not very sure is a commit related to
security CAM:
    Fixes: b837f78fbffa ("wifi: rtl8xxxu: add hw crypto support for AP mode")

Since each patch can be seen as individual one, could you help to bisect
the cause? 

Ping-Ke
Zenm Chen Jan. 12, 2024, 4:51 a.m. UTC | #3
Hi Ping-Ke,

> Locally trying to disconnect after 30 seconds. Can you try non-secure
> connection and specify static IP to see if it can work? 

I tried using a non-secure connection and keeping the DHCP enabled and it 
can work.

> 
> I reviewed the patchset again, no obvious change if you are using a vif with
> station mode only. The only one I'm not very sure is a commit related to
> security CAM:
>     Fixes: b837f78fbffa ("wifi: rtl8xxxu: add hw crypto support for AP mode")

I tried applying all the patches except this one, it works as usual now. I
think we find the one which caused this issue, thank you very much! :)

> 
> Since each patch can be seen as individual one, could you help to bisect
> the cause? 
> 
> Ping-Ke
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 62e6318bc0924..803c76b3209c4 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1992,6 +1992,7 @@  struct rtl8xxxu_fileops {
 	u8 init_reg_rxfltmap:1;
 	u8 init_reg_pkt_life_time:1;
 	u8 init_reg_hmtfr:1;
+	u8 supports_concurrent:1;
 	u8 ampdu_max_time;
 	u8 ustime_tsf_edca;
 	u16 max_aggr_num;
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
index 574a5fe951543..464216d007ce8 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
@@ -1752,6 +1752,7 @@  struct rtl8xxxu_fileops rtl8188fu_fops = {
 	.supports_ap = 1,
 	.max_macid_num = 16,
 	.max_sec_cam_num = 16,
+	.supports_concurrent = 1,
 	.adda_1t_init = 0x03c00014,
 	.adda_1t_path_on = 0x03c00014,
 	.trxff_boundary = 0x3f7f,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 0178b441dce53..5fddbd6594a24 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -7665,6 +7665,20 @@  static void rtl8xxxu_deinit_led(struct rtl8xxxu_priv *priv)
 	led_classdev_unregister(led);
 }
 
+struct ieee80211_iface_limit rtl8xxxu_limits[] = {
+	{ .max = 2, .types = BIT(NL80211_IFTYPE_STATION), },
+	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP), },
+};
+
+struct ieee80211_iface_combination rtl8xxxu_combinations[] = {
+	{
+		.limits = rtl8xxxu_limits,
+		.n_limits = ARRAY_SIZE(rtl8xxxu_limits),
+		.max_interfaces = 2,
+		.num_different_channels = 1,
+	},
+};
+
 static int rtl8xxxu_probe(struct usb_interface *interface,
 			  const struct usb_device_id *id)
 {
@@ -7811,6 +7825,11 @@  static int rtl8xxxu_probe(struct usb_interface *interface,
 		hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);
 	hw->queues = 4;
 
+	if (priv->fops->supports_concurrent) {
+		hw->wiphy->iface_combinations = rtl8xxxu_combinations;
+		hw->wiphy->n_iface_combinations = ARRAY_SIZE(rtl8xxxu_combinations);
+	}
+
 	sband = &rtl8xxxu_supported_band;
 	sband->ht_cap.ht_supported = true;
 	sband->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;