From: Ping-Ke Shih <pkshih@realtek.com>
To: Martin Kaistra <martin.kaistra@linutronix.de>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>,
Kalle Valo <kvalo@kernel.org>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Zenm Chen <zenmchen@gmail.com>
Subject: RE: [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode
Date: Tue, 16 Jan 2024 01:25:13 +0000 [thread overview]
Message-ID: <a6f7104243e14894a6638679c0e347b6@realtek.com> (raw)
In-Reply-To: <87e04cfe-f8ed-40da-bb2c-edccfe385b6e@linutronix.de>
> -----Original Message-----
> From: Martin Kaistra <martin.kaistra@linutronix.de>
> Sent: Monday, January 15, 2024 9:13 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Bitterblue Smith
> <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior <bigeasy@linutronix.de>; Zenm Chen
> <zenmchen@gmail.com>
> Subject: Re: [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode
>
> Hi Ping-Ke,
>
> Am 12.01.24 um 07:52 schrieb Ping-Ke Shih:
> > Hi Martin,
> >
> >> -----Original Message-----
> >> From: Martin Kaistra <martin.kaistra@linutronix.de>
> >> Sent: Friday, December 22, 2023 12:44 AM
> >> To: linux-wireless@vger.kernel.org
> >> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih
> >> <pkshih@realtek.com>; Bitterblue Smith <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior
> >> <bigeasy@linutronix.de>
> >> Subject: [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode
> >>
> >
> > [...]
> >
> > Zenm reported [1] his RTL8192EU and RTL8192FU don't work in station mode,
> > and cause is this patch. Please try if you can reproduce the symptom, and
> > apply my suggestion to see if help.
> >
> > [1]
> https://lore.kernel.org/linux-wireless/20240112045104.12282-1-zenmchen@gmail.com/T/#me0940f522249becf4
> 9f25bc281f1992c523673f6
>
> I managed to find two other Realtek USB Wifi devices that are supported by the
> rtl8xxxu driver (RTL8188EU and RTL8192CU) and I can reproduce the issue with
> both of them.
>
> I also tried creating a patch with your suggestions and this seems to help.
>
> Looking at it more closely however, I think the main problem is, that
> fops->max_sec_cam_num is not set for the other variants. Without the additional
> patch, this causes rtl8xxxu_get_free_sec_cam() to return 0 for pairwise and
> group key and so using the same spot for both key entries.
>
> I then created a patch using the numbers suggested by Bitterblue Smith in [1]
> and using 32 for RTL8723AU and RTL8192CU like the rtlwifi driver seems to do.
> This also seems to solve the issue reported, even without reserving the first 4
> slots for group keys.
>
> Do you think we need both patches?
I think you only need the one that fills fops->max_sec_cam_num.
The search rule of hardware security CAM is to find an entry that matches address
and key_idx, and then use it to encrypt/decrypt packets. If no entry found, it
select entry by key_idx (i.e. key_idx=0/1/2/3 use entry=0/1/2/3). As I can
remember, WEP needs to reserve 4 entries, but I believe no one uses it now.
>
> [1]
> https://lore.kernel.org/linux-wireless/f73b5afc-d69f-4a7c-8bf0-877a45327e0b@gmail.com/
>
> >> case DISABLE_KEY:
> >> rtl8xxxu_write32(priv, REG_CAM_WRITE, 0x00000000);
> >> val32 = CAM_CMD_POLLING | CAM_CMD_WRITE |
> >> - key->keyidx << CAM_CMD_KEY_SHIFT;
> >> + key->hw_key_idx << CAM_CMD_KEY_SHIFT;
> >> rtl8xxxu_write32(priv, REG_CAM_CMD, val32);
> >> + rtlvif->hw_key_idx = 0xff;
> >> + clear_bit(key->hw_key_idx, priv->cam_map);
> >
> > Shouldn't swap these two statements? I missed that during reviewing.
>
> I don't think that would make a difference. rtlvif->hw_key_idx is set for use in
> rtl8xxxu_tx() and the second line uses key->hw_key_idx to clear the map entry.
>
Sorry, I misread the "rtlvif->..." and "key->..." that are different.
next prev parent reply other threads:[~2024-01-16 1:25 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 16:43 [PATCH v2 00/21] wifi: rtl8xxxu: Add concurrent mode for 8188f Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 01/21] wifi: rtl8xxxu: remove assignment of priv->vif in rtl8xxxu_bss_info_changed() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 02/21] wifi: rtl8xxxu: prepare supporting two virtual interfaces Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 03/21] wifi: rtl8xxxu: support setting linktype for both interfaces Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 04/21] wifi: rtl8xxxu: 8188e: convert usage of priv->vif to priv->vifs[0] Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 05/21] wifi: rtl8xxxu: support setting mac address register for both interfaces Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 06/21] wifi: rtl8xxxu: extend wifi connected check to " Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 07/21] wifi: rtl8xxxu: extend check for matching bssid " Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 08/21] wifi: rtl8xxxu: don't parse CFO, if both interfaces are connected in STA mode Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 09/21] wifi: rtl8xxxu: support setting bssid register for multiple interfaces Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 10/21] wifi: rtl8xxxu: support multiple interfaces in set_aifs() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 11/21] wifi: rtl8xxxu: support multiple interfaces in update_beacon_work_callback() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 12/21] wifi: rtl8xxxu: support multiple interfaces in configure_filter() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 13/21] wifi: rtl8xxxu: support multiple interfaces in watchdog_callback() Martin Kaistra
[not found] ` <CAKFoaw3o-LkqADNvfE0TXmvr8_LK19mpVQtUZ66CWS=AN5AkJQ@mail.gmail.com>
2023-12-22 1:45 ` Ping-Ke Shih
2023-12-22 8:05 ` Martin Kaistra
2023-12-22 8:25 ` Martin Kaistra
2023-12-22 8:59 ` Ping-Ke Shih
2023-12-22 9:10 ` Martin Kaistra
2023-12-22 10:12 ` Ping-Ke Shih
2023-12-21 16:43 ` [PATCH v2 14/21] wifi: rtl8xxxu: support multiple interfaces in {add,remove}_interface() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 15/21] wifi: rtl8xxxu: support multiple interfaces in bss_info_changed() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 16/21] wifi: rtl8xxxu: support multiple interface in start_ap() Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 17/21] wifi: rtl8xxxu: add macids for STA mode Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 18/21] wifi: rtl8xxxu: remove obsolete priv->vif Martin Kaistra
2023-12-21 16:43 ` [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode Martin Kaistra
2024-01-12 6:52 ` Ping-Ke Shih
2024-01-15 13:12 ` Martin Kaistra
2024-01-16 1:25 ` Ping-Ke Shih [this message]
2023-12-21 16:43 ` [PATCH v2 20/21] wifi: rtl8xxxu: make supporting AP mode only on port 0 transparent Martin Kaistra
2023-12-22 1:54 ` Ping-Ke Shih
2023-12-22 7:49 ` Martin Kaistra
2023-12-22 7:54 ` Ping-Ke Shih
2023-12-21 16:43 ` [PATCH v2 21/21] wifi: rtl8xxxu: declare concurrent mode support for 8188f Martin Kaistra
[not found] ` <CAKFoaw2b3ZB9u+jZ0gCCSrxXr1Viq3-3jsvKAgrpwDxvufYydQ@mail.gmail.com>
2023-12-22 2:02 ` [PATCH v2 00/21] wifi: rtl8xxxu: Add concurrent mode " Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a6f7104243e14894a6638679c0e347b6@realtek.com \
--to=pkshih@realtek.com \
--cc=Jes.Sorensen@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=martin.kaistra@linutronix.de \
--cc=rtl8821cerfe2@gmail.com \
--cc=zenmchen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox