mbox series

[v3,00/11] RTW88: Add support for USB variants

Message ID 20221122145226.4065843-1-s.hauer@pengutronix.de (mailing list archive)
Headers show
Series RTW88: Add support for USB variants | expand

Message

Sascha Hauer Nov. 22, 2022, 2:52 p.m. UTC
This is the third round of adding support for the USB variants to the
RTW88 driver. There are a few changes to the last version which make it
worth looking at this version.

First of all RTL8723du and RTL8821cu are tested working now. The issue
here was that the txdesc checksum calculation was wrong. I found the
correct calculation in various downstream drivers found on github.

The second big issue was that TX packet aggregation was wrong. When
aggregating packets each packet start has to be aligned to eight bytes.
The necessary alignment was added to the total URB length before
checking if there is another packet to aggregate, so the URB length
included that padding after the last packet, which is wrong.  Fixing
this makes the driver work much more reliably.

I added all people to Cc: who showed interest in this driver and I want
to welcome you for testing and reviewing.

Sascha


Sascha Hauer (11):
  rtw88: print firmware type in info message
  rtw88: Call rtw_fw_beacon_filter_config() with rtwdev->mutex held
  rtw88: Drop rf_lock
  rtw88: Drop h2c.lock
  rtw88: Drop coex mutex
  rtw88: iterate over vif/sta list non-atomically
  rtw88: Add common USB chip support
  rtw88: Add rtw8821cu chipset support
  rtw88: Add rtw8822bu chipset support
  rtw88: Add rtw8822cu chipset support
  rtw88: Add rtw8723du chipset support

 drivers/net/wireless/realtek/rtw88/Kconfig    |  47 +
 drivers/net/wireless/realtek/rtw88/Makefile   |  14 +
 drivers/net/wireless/realtek/rtw88/coex.c     |   3 +-
 drivers/net/wireless/realtek/rtw88/debug.c    |  15 +
 drivers/net/wireless/realtek/rtw88/fw.c       |  13 +-
 drivers/net/wireless/realtek/rtw88/hci.h      |   9 +-
 drivers/net/wireless/realtek/rtw88/mac.c      |   3 +
 drivers/net/wireless/realtek/rtw88/mac80211.c |   2 +-
 drivers/net/wireless/realtek/rtw88/main.c     |  12 +-
 drivers/net/wireless/realtek/rtw88/main.h     |  12 +-
 drivers/net/wireless/realtek/rtw88/phy.c      |   6 +-
 drivers/net/wireless/realtek/rtw88/ps.c       |   2 +-
 drivers/net/wireless/realtek/rtw88/reg.h      |   1 +
 drivers/net/wireless/realtek/rtw88/rtw8723d.c |  28 +
 drivers/net/wireless/realtek/rtw88/rtw8723d.h |  13 +-
 .../net/wireless/realtek/rtw88/rtw8723du.c    |  36 +
 .../net/wireless/realtek/rtw88/rtw8723du.h    |  10 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.c |  18 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.h |  21 +
 .../net/wireless/realtek/rtw88/rtw8821cu.c    |  50 +
 .../net/wireless/realtek/rtw88/rtw8821cu.h    |  10 +
 drivers/net/wireless/realtek/rtw88/rtw8822b.c |  19 +
 .../net/wireless/realtek/rtw88/rtw8822bu.c    |  90 ++
 .../net/wireless/realtek/rtw88/rtw8822bu.h    |  10 +
 drivers/net/wireless/realtek/rtw88/rtw8822c.c |  24 +
 .../net/wireless/realtek/rtw88/rtw8822cu.c    |  44 +
 .../net/wireless/realtek/rtw88/rtw8822cu.h    |  10 +
 drivers/net/wireless/realtek/rtw88/tx.h       |  31 +
 drivers/net/wireless/realtek/rtw88/usb.c      | 918 ++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/usb.h      | 107 ++
 drivers/net/wireless/realtek/rtw88/util.c     | 103 ++
 drivers/net/wireless/realtek/rtw88/util.h     |  12 +-
 32 files changed, 1655 insertions(+), 38 deletions(-)
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8723du.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8723du.h
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821cu.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821cu.h
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.h
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822cu.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822cu.h
 create mode 100644 drivers/net/wireless/realtek/rtw88/usb.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/usb.h

Comments

Sascha Hauer Nov. 22, 2022, 2:55 p.m. UTC | #1
On Tue, Nov 22, 2022 at 03:52:15PM +0100, Sascha Hauer wrote:
> This is the third round of adding support for the USB variants to the
> RTW88 driver. There are a few changes to the last version which make it
> worth looking at this version.
> 
> First of all RTL8723du and RTL8821cu are tested working now. The issue
> here was that the txdesc checksum calculation was wrong. I found the
> correct calculation in various downstream drivers found on github.
> 
> The second big issue was that TX packet aggregation was wrong. When
> aggregating packets each packet start has to be aligned to eight bytes.
> The necessary alignment was added to the total URB length before
> checking if there is another packet to aggregate, so the URB length
> included that padding after the last packet, which is wrong.  Fixing
> this makes the driver work much more reliably.
> 
> I added all people to Cc: who showed interest in this driver and I want
> to welcome you for testing and reviewing.

There still is a problem with the RTL8822cu chipset I have here.  When
using NetworkManager I immediately lose the connection to the AP after
it has been connected:

[  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
[  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
[  380.091446] wlan0: authenticated
[  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
[  380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1 (capab=0x1411 status=0 aid=2)
[  380.202955] wlan0: associated
[  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost

That doesn't happen when using plain wpa_supplicant. This seems to go
down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
wpa_supplicant seems to go another code patch and doesn't activate
connection quality monitoring.

The connection to the AP works fluently also with NetworkManager though
when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.

Any idea what may be wrong here?

Sascha
Ping-Ke Shih Nov. 24, 2022, 6:48 a.m. UTC | #2
> -----Original Message-----
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Sent: Tuesday, November 22, 2022 10:55 PM
> To: Bernie Huang <phhuang@realtek.com>
> Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih <pkshih@realtek.com>; Hans Ulli Kroll
> <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>; netdev@vger.kernel.org;
> Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>; linux-kernel@vger.kernel.org;
> Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; Bernie Huang <phhuang@realtek.com>;
> kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>;
> Da Xue <da@libre.computer>
> Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> 
> On Tue, Nov 22, 2022 at 03:52:15PM +0100, Sascha Hauer wrote:
> > This is the third round of adding support for the USB variants to the
> > RTW88 driver. There are a few changes to the last version which make it
> > worth looking at this version.
> >
> > First of all RTL8723du and RTL8821cu are tested working now. The issue
> > here was that the txdesc checksum calculation was wrong. I found the
> > correct calculation in various downstream drivers found on github.
> >
> > The second big issue was that TX packet aggregation was wrong. When
> > aggregating packets each packet start has to be aligned to eight bytes.
> > The necessary alignment was added to the total URB length before
> > checking if there is another packet to aggregate, so the URB length
> > included that padding after the last packet, which is wrong.  Fixing
> > this makes the driver work much more reliably.
> >
> > I added all people to Cc: who showed interest in this driver and I want
> > to welcome you for testing and reviewing.
> 
> There still is a problem with the RTL8822cu chipset I have here.  When
> using NetworkManager I immediately lose the connection to the AP after
> it has been connected:
> 
> [  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
> [  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
> [  380.091446] wlan0: authenticated
> [  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
> [  380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1 (capab=0x1411 status=0 aid=2)
> [  380.202955] wlan0: associated
> [  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
> [  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost
> 
> That doesn't happen when using plain wpa_supplicant. This seems to go
> down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
> connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
> wpa_supplicant seems to go another code patch and doesn't activate
> connection quality monitoring.
> 
> The connection to the AP works fluently also with NetworkManager though
> when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.
> 
> Any idea what may be wrong here?
> 

Please reference to below patch to see if it can work to you.

https://lore.kernel.org/linux-wireless/20221124064442.28042-1-pkshih@realtek.com/T/#u

Ping-Ke
Sascha Hauer Nov. 24, 2022, 8:21 a.m. UTC | #3
On Thu, Nov 24, 2022 at 06:48:23AM +0000, Ping-Ke Shih wrote:
> 
> > -----Original Message-----
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Sent: Tuesday, November 22, 2022 10:55 PM
> > To: Bernie Huang <phhuang@realtek.com>
> > Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih <pkshih@realtek.com>; Hans Ulli Kroll
> > <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>; netdev@vger.kernel.org;
> > Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>; linux-kernel@vger.kernel.org;
> > Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; Bernie Huang <phhuang@realtek.com>;
> > kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>;
> > Da Xue <da@libre.computer>
> > Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> > 
> > On Tue, Nov 22, 2022 at 03:52:15PM +0100, Sascha Hauer wrote:
> > > This is the third round of adding support for the USB variants to the
> > > RTW88 driver. There are a few changes to the last version which make it
> > > worth looking at this version.
> > >
> > > First of all RTL8723du and RTL8821cu are tested working now. The issue
> > > here was that the txdesc checksum calculation was wrong. I found the
> > > correct calculation in various downstream drivers found on github.
> > >
> > > The second big issue was that TX packet aggregation was wrong. When
> > > aggregating packets each packet start has to be aligned to eight bytes.
> > > The necessary alignment was added to the total URB length before
> > > checking if there is another packet to aggregate, so the URB length
> > > included that padding after the last packet, which is wrong.  Fixing
> > > this makes the driver work much more reliably.
> > >
> > > I added all people to Cc: who showed interest in this driver and I want
> > > to welcome you for testing and reviewing.
> > 
> > There still is a problem with the RTL8822cu chipset I have here.  When
> > using NetworkManager I immediately lose the connection to the AP after
> > it has been connected:
> > 
> > [  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
> > [  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
> > [  380.091446] wlan0: authenticated
> > [  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
> > [  380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1 (capab=0x1411 status=0 aid=2)
> > [  380.202955] wlan0: associated
> > [  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
> > [  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost
> > 
> > That doesn't happen when using plain wpa_supplicant. This seems to go
> > down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
> > connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
> > wpa_supplicant seems to go another code patch and doesn't activate
> > connection quality monitoring.
> > 
> > The connection to the AP works fluently also with NetworkManager though
> > when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.
> > 
> > Any idea what may be wrong here?
> > 
> 
> Please reference to below patch to see if it can work to you.
> 
> https://lore.kernel.org/linux-wireless/20221124064442.28042-1-pkshih@realtek.com/T/#u

Great! That solves this issue \o/

Sascha
Ping-Ke Shih Nov. 24, 2022, 8:26 a.m. UTC | #4
> -----Original Message-----
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Sent: Thursday, November 24, 2022 4:22 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Bernie Huang <phhuang@realtek.com>; linux-wireless@vger.kernel.org; Hans Ulli Kroll
> <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>; netdev@vger.kernel.org;
> Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>; linux-kernel@vger.kernel.org;
> Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; kernel@pengutronix.de; Johannes Berg
> <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>; Da Xue <da@libre.computer>
> Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> 
> On Thu, Nov 24, 2022 at 06:48:23AM +0000, Ping-Ke Shih wrote:
> >
> > > -----Original Message-----
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > Sent: Tuesday, November 22, 2022 10:55 PM
> > > To: Bernie Huang <phhuang@realtek.com>
> > > Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih <pkshih@realtek.com>; Hans Ulli Kroll
> > > <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>;
> netdev@vger.kernel.org;
> > > Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>;
> linux-kernel@vger.kernel.org;
> > > Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; Bernie Huang <phhuang@realtek.com>;
> > > kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum
> <alex@appudo.com>;
> > > Da Xue <da@libre.computer>
> > > Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> > >
> > > On Tue, Nov 22, 2022 at 03:52:15PM +0100, Sascha Hauer wrote:
> > > > This is the third round of adding support for the USB variants to the
> > > > RTW88 driver. There are a few changes to the last version which make it
> > > > worth looking at this version.
> > > >
> > > > First of all RTL8723du and RTL8821cu are tested working now. The issue
> > > > here was that the txdesc checksum calculation was wrong. I found the
> > > > correct calculation in various downstream drivers found on github.
> > > >
> > > > The second big issue was that TX packet aggregation was wrong. When
> > > > aggregating packets each packet start has to be aligned to eight bytes.
> > > > The necessary alignment was added to the total URB length before
> > > > checking if there is another packet to aggregate, so the URB length
> > > > included that padding after the last packet, which is wrong.  Fixing
> > > > this makes the driver work much more reliably.
> > > >
> > > > I added all people to Cc: who showed interest in this driver and I want
> > > > to welcome you for testing and reviewing.
> > >
> > > There still is a problem with the RTL8822cu chipset I have here.  When
> > > using NetworkManager I immediately lose the connection to the AP after
> > > it has been connected:
> > >
> > > [  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
> > > [  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
> > > [  380.091446] wlan0: authenticated
> > > [  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
> > > [  380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1 (capab=0x1411 status=0 aid=2)
> > > [  380.202955] wlan0: associated
> > > [  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
> > > [  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost
> > >
> > > That doesn't happen when using plain wpa_supplicant. This seems to go
> > > down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
> > > connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
> > > wpa_supplicant seems to go another code patch and doesn't activate
> > > connection quality monitoring.
> > >
> > > The connection to the AP works fluently also with NetworkManager though
> > > when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.
> > >
> > > Any idea what may be wrong here?
> > >
> >
> > Please reference to below patch to see if it can work to you.
> >
> > https://lore.kernel.org/linux-wireless/20221124064442.28042-1-pkshih@realtek.com/T/#u
> 
> Great! That solves this issue \o/
> 

Do you mind to add "Tested-by:" tag to the patch?  :-)

Ping-Ke
Kalle Valo Nov. 24, 2022, 8:33 a.m. UTC | #5
Sascha Hauer <s.hauer@pengutronix.de> writes:

>> > There still is a problem with the RTL8822cu chipset I have here.  When
>> > using NetworkManager I immediately lose the connection to the AP after
>> > it has been connected:
>> > 
>> > [  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
>> > [  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
>> > [  380.091446] wlan0: authenticated
>> > [  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
>> > [ 380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1
>> > (capab=0x1411 status=0 aid=2)
>> > [  380.202955] wlan0: associated
>> > [  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
>> > [  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost
>> > 
>> > That doesn't happen when using plain wpa_supplicant. This seems to go
>> > down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
>> > connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
>> > wpa_supplicant seems to go another code patch and doesn't activate
>> > connection quality monitoring.
>> > 
>> > The connection to the AP works fluently also with NetworkManager though
>> > when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.
>> > 
>> > Any idea what may be wrong here?
>> > 
>> 
>> Please reference to below patch to see if it can work to you.
>> 
>> https://lore.kernel.org/linux-wireless/20221124064442.28042-1-pkshih@realtek.com/T/#u
>
> Great! That solves this issue \o/

Awesome, great work Ping and Ji-Pin!
Sascha Hauer Nov. 24, 2022, 8:36 a.m. UTC | #6
On Thu, Nov 24, 2022 at 08:26:23AM +0000, Ping-Ke Shih wrote:
> 
> 
> > -----Original Message-----
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Sent: Thursday, November 24, 2022 4:22 PM
> > To: Ping-Ke Shih <pkshih@realtek.com>
> > Cc: Bernie Huang <phhuang@realtek.com>; linux-wireless@vger.kernel.org; Hans Ulli Kroll
> > <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>; netdev@vger.kernel.org;
> > Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>; linux-kernel@vger.kernel.org;
> > Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; kernel@pengutronix.de; Johannes Berg
> > <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>; Da Xue <da@libre.computer>
> > Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> > 
> > On Thu, Nov 24, 2022 at 06:48:23AM +0000, Ping-Ke Shih wrote:
> > >
> > > > -----Original Message-----
> > > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > > Sent: Tuesday, November 22, 2022 10:55 PM
> > > > To: Bernie Huang <phhuang@realtek.com>
> > > > Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih <pkshih@realtek.com>; Hans Ulli Kroll
> > > > <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>;
> > netdev@vger.kernel.org;
> > > > Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>;
> > linux-kernel@vger.kernel.org;
> > > > Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; Bernie Huang <phhuang@realtek.com>;
> > > > kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum
> > <alex@appudo.com>;
> > > > Da Xue <da@libre.computer>
> > > > Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> > > >
> > > > On Tue, Nov 22, 2022 at 03:52:15PM +0100, Sascha Hauer wrote:
> > > > > This is the third round of adding support for the USB variants to the
> > > > > RTW88 driver. There are a few changes to the last version which make it
> > > > > worth looking at this version.
> > > > >
> > > > > First of all RTL8723du and RTL8821cu are tested working now. The issue
> > > > > here was that the txdesc checksum calculation was wrong. I found the
> > > > > correct calculation in various downstream drivers found on github.
> > > > >
> > > > > The second big issue was that TX packet aggregation was wrong. When
> > > > > aggregating packets each packet start has to be aligned to eight bytes.
> > > > > The necessary alignment was added to the total URB length before
> > > > > checking if there is another packet to aggregate, so the URB length
> > > > > included that padding after the last packet, which is wrong.  Fixing
> > > > > this makes the driver work much more reliably.
> > > > >
> > > > > I added all people to Cc: who showed interest in this driver and I want
> > > > > to welcome you for testing and reviewing.
> > > >
> > > > There still is a problem with the RTL8822cu chipset I have here.  When
> > > > using NetworkManager I immediately lose the connection to the AP after
> > > > it has been connected:
> > > >
> > > > [  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
> > > > [  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
> > > > [  380.091446] wlan0: authenticated
> > > > [  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
> > > > [  380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1 (capab=0x1411 status=0 aid=2)
> > > > [  380.202955] wlan0: associated
> > > > [  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
> > > > [  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost
> > > >
> > > > That doesn't happen when using plain wpa_supplicant. This seems to go
> > > > down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
> > > > connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
> > > > wpa_supplicant seems to go another code patch and doesn't activate
> > > > connection quality monitoring.
> > > >
> > > > The connection to the AP works fluently also with NetworkManager though
> > > > when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.
> > > >
> > > > Any idea what may be wrong here?
> > > >
> > >
> > > Please reference to below patch to see if it can work to you.
> > >
> > > https://lore.kernel.org/linux-wireless/20221124064442.28042-1-pkshih@realtek.com/T/#u
> > 
> > Great! That solves this issue \o/
> > 
> 
> Do you mind to add "Tested-by:" tag to the patch?  :-)

You should already find it in your inbox. Thank you very much for the
fast response :)

Sascha
Sascha Hauer Nov. 24, 2022, 9:20 a.m. UTC | #7
On Thu, Nov 24, 2022 at 09:21:58AM +0100, Sascha Hauer wrote:
> On Thu, Nov 24, 2022 at 06:48:23AM +0000, Ping-Ke Shih wrote:
> > 
> > > -----Original Message-----
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > Sent: Tuesday, November 22, 2022 10:55 PM
> > > To: Bernie Huang <phhuang@realtek.com>
> > > Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih <pkshih@realtek.com>; Hans Ulli Kroll
> > > <linux@ulli-kroll.de>; Martin Blumenstingl <martin.blumenstingl@googlemail.com>; netdev@vger.kernel.org;
> > > Kalle Valo <kvalo@kernel.org>; Yan-Hsuan Chuang <tony0620emma@gmail.com>; linux-kernel@vger.kernel.org;
> > > Viktor Petrenko <g0000ga@gmail.com>; Neo Jou <neojou@gmail.com>; Bernie Huang <phhuang@realtek.com>;
> > > kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>;
> > > Da Xue <da@libre.computer>
> > > Subject: Re: [PATCH v3 00/11] RTW88: Add support for USB variants
> > > 
> > > On Tue, Nov 22, 2022 at 03:52:15PM +0100, Sascha Hauer wrote:
> > > > This is the third round of adding support for the USB variants to the
> > > > RTW88 driver. There are a few changes to the last version which make it
> > > > worth looking at this version.
> > > >
> > > > First of all RTL8723du and RTL8821cu are tested working now. The issue
> > > > here was that the txdesc checksum calculation was wrong. I found the
> > > > correct calculation in various downstream drivers found on github.
> > > >
> > > > The second big issue was that TX packet aggregation was wrong. When
> > > > aggregating packets each packet start has to be aligned to eight bytes.
> > > > The necessary alignment was added to the total URB length before
> > > > checking if there is another packet to aggregate, so the URB length
> > > > included that padding after the last packet, which is wrong.  Fixing
> > > > this makes the driver work much more reliably.
> > > >
> > > > I added all people to Cc: who showed interest in this driver and I want
> > > > to welcome you for testing and reviewing.
> > > 
> > > There still is a problem with the RTL8822cu chipset I have here.  When
> > > using NetworkManager I immediately lose the connection to the AP after
> > > it has been connected:
> > > 
> > > [  376.213846] wlan0: authenticate with 76:83:c2:ce:81:b1
> > > [  380.085463] wlan0: send auth to 76:83:c2:ce:81:b1 (try 1/3)
> > > [  380.091446] wlan0: authenticated
> > > [  380.108864] wlan0: associate with 76:83:c2:ce:81:b1 (try 1/3)
> > > [  380.136448] wlan0: RX AssocResp from 76:83:c2:ce:81:b1 (capab=0x1411 status=0 aid=2)
> > > [  380.202955] wlan0: associated
> > > [  380.268140] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
> > > [  380.275328] wlan0: Connection to AP 76:83:c2:ce:81:b1 lost
> > > 
> > > That doesn't happen when using plain wpa_supplicant. This seems to go
> > > down to cd96e22bc1da ("rtw88: add beacon filter support"). After being
> > > connected I get a BCN_FILTER_CONNECTION_LOSS beacon. Plain
> > > wpa_supplicant seems to go another code patch and doesn't activate
> > > connection quality monitoring.
> > > 
> > > The connection to the AP works fluently also with NetworkManager though
> > > when I just ignore the BCN_FILTER_CONNECTION_LOSS beacon.
> > > 
> > > Any idea what may be wrong here?
> > > 
> > 
> > Please reference to below patch to see if it can work to you.
> > 
> > https://lore.kernel.org/linux-wireless/20221124064442.28042-1-pkshih@realtek.com/T/#u
> 
> Great! That solves this issue \o/

I am also happy to say that this patch is a real performance boost.
Here are some numbers:

RTL8723DU, no patch
===================
tx [  5]   0.00-10.00  sec  1.08 MBytes   903 Kbits/sec    1 sender
rx [  5]   0.00-10.26  sec  10.3 MBytes  8.41 Mbits/sec    0 sender

RTL8723DU, with patch
=====================
tx [  5]   0.00-10.00  sec  34.7 MBytes  29.1 Mbits/sec    9 sender
rx [  5]   0.00-10.05  sec  34.4 MBytes  28.7 Mbits/sec    5 sender

RTL8821CU, no patch
===================
tx [  5]   0.00-10.00  sec  6.01 MBytes  5.04 Mbits/sec    0 sender
rx [  5]   0.00-10.44  sec  53.4 MBytes  42.9 Mbits/sec    0 sender

RTL8821CU, with patch
===================
tx [  5]   0.00-10.00  sec  57.9 MBytes  48.6 Mbits/sec    0 sender
rx [  5]   0.00-10.15  sec  66.3 MBytes  54.8 Mbits/sec  419 sender

RTL8822CU, no patch
===================
tx [  5]   0.00-10.00  sec  11.8 MBytes  9.91 Mbits/sec    1 sender
rx [  5]   0.00-10.18  sec   105 MBytes  86.3 Mbits/sec  805 sender

RTL8822CU, with patch
===================
tx [  5]   0.00-10.01  sec  80.0 MBytes  67.1 Mbits/sec    0 sender
rx [  5]   0.00-10.12  sec   117 MBytes  97.2 Mbits/sec  658 sender

Tested with:

tx: iperf3 -c 192.168.0.57 -i0
rx: iperf3 -c 192.168.0.57 -i0 -R

Especially the RTL8723DU now starts being useful.

Sascha
Ping-Ke Shih Nov. 28, 2022, 3:45 a.m. UTC | #8
> -----Original Message-----
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Sent: Tuesday, November 22, 2022 10:52 PM
> To: linux-wireless@vger.kernel.org
> Cc: Neo Jou <neojou@gmail.com>; Hans Ulli Kroll <linux@ulli-kroll.de>; Ping-Ke Shih <pkshih@realtek.com>;
> Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org; Martin Blumenstingl <martin.blumenstingl@googlemail.com>;
> kernel@pengutronix.de; Johannes Berg <johannes@sipsolutions.net>; Alexander Hochbaum <alex@appudo.com>;
> Da Xue <da@libre.computer>; Bernie Huang <phhuang@realtek.com>; Viktor Petrenko <g0000ga@gmail.com>;
> Sascha Hauer <s.hauer@pengutronix.de>
> Subject: [PATCH v3 00/11] RTW88: Add support for USB variants
> 
> This is the third round of adding support for the USB variants to the
> RTW88 driver. There are a few changes to the last version which make it
> worth looking at this version.
> 
> First of all RTL8723du and RTL8821cu are tested working now. The issue
> here was that the txdesc checksum calculation was wrong. I found the
> correct calculation in various downstream drivers found on github.
> 
> The second big issue was that TX packet aggregation was wrong. When
> aggregating packets each packet start has to be aligned to eight bytes.
> The necessary alignment was added to the total URB length before
> checking if there is another packet to aggregate, so the URB length
> included that padding after the last packet, which is wrong.  Fixing
> this makes the driver work much more reliably.
> 

Thanks for your finding and fixes on this driver. I have reviewed this 
patchset and written some comments. No big problem.


> 
> Sascha Hauer (11):
>   rtw88: print firmware type in info message
>   rtw88: Call rtw_fw_beacon_filter_config() with rtwdev->mutex held
>   rtw88: Drop rf_lock
>   rtw88: Drop h2c.lock
>   rtw88: Drop coex mutex
>   rtw88: iterate over vif/sta list non-atomically
>   rtw88: Add common USB chip support
>   rtw88: Add rtw8821cu chipset support
>   rtw88: Add rtw8822bu chipset support
>   rtw88: Add rtw8822cu chipset support
>   rtw88: Add rtw8723du chipset support

Please use "wifi: rtw88: " as prefix in next version.

--
Ping-Ke