From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH rtw-next v1 11/13] wifi: rtw89: Add usb.{c,h}
Date: Mon, 26 May 2025 03:18:59 +0000 [thread overview]
Message-ID: <5d96c9b2693143f7914dca322e518435@realtek.com> (raw)
In-Reply-To: <f9f205bb-9084-42c0-9942-533d2787fd13@gmail.com>
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 13/05/2025 09:12, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >> Add very basic USB support. No TX/RX aggregation, no TX queues, no
> >> switching to USB 3 mode.
> >>
> >> RTL8851BU and RTL8832BU work.
> >>
> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> >> ---
> >> drivers/net/wireless/realtek/rtw89/usb.c | 1030 ++++++++++++++++++++++
> >> drivers/net/wireless/realtek/rtw89/usb.h | 61 ++
> >> 2 files changed, 1091 insertions(+)
> >> create mode 100644 drivers/net/wireless/realtek/rtw89/usb.c
> >> create mode 100644 drivers/net/wireless/realtek/rtw89/usb.h
> >>
> >> diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
> >> new file mode 100644
> >> index 000000000000..6e8a544b352c
> >> --- /dev/null
> >> +++ b/drivers/net/wireless/realtek/rtw89/usb.c
> >> @@ -0,0 +1,1030 @@
> >> +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> >> +/* Copyright(c) 2025 Realtek Corporation
> >> + */
> >> +
> >> +#include <linux/usb.h>
> >> +#include "debug.h"
> >> +#include "mac.h"
> >> +#include "reg.h"
> >> +#include "txrx.h"
> >> +#include "usb.h"
> >> +
> >> +static void rtw89_usb_vendorreq(struct rtw89_dev *rtwdev, u32 addr,
> >> + void *data, u16 len, u8 reqtype)
> >> +{
> >> + struct rtw89_usb *rtwusb = rtw89_get_usb_priv(rtwdev);
> >> + struct usb_device *udev = rtwusb->udev;
> >> + unsigned int pipe;
> >> + u16 value, index;
> >> + int attempt, ret;
> >> +
> >> + value = addr & 0x0000ffff;
> >> + index = (addr & 0x00ff0000) >> 16;
> >
> > u16_get_bits(addr, GENMASK(23, 16)) ?
> >
> >
> >> +
> >> + mutex_lock(&rtwusb->vendor_req_mutex);
> >
> > rtw89 takes wiphy_lock for control path. Is there any case more than
> > one threads run at the same time?
> >
>
> Maybe not. I just copied this from the vendor driver. How can I be
> sure only one thread runs?
For rtw89, currently all ieee80211_ops take wiphy_lock except to TX related
ops. The works forked by rtw89 use wiphy works basically. Some works still
use ieee80211 works only if they only set a simple flags or so.
Here, I would like to avoid adding unnecessary mutex at development stage,
because it is hard to remove a mutex with simple review. You can see only
one existing mutex is 'struct mutex rf_mutex'. I want to remove it, but
I'm still afraid that I miss something by review.
>
> I added this above the mutex_lock() today:
>
> if (mutex_is_locked(&rtwusb->vendor_req_mutex))
> pr_err("mutex already locked elsewhere\n");
>
> So far it hasn't printed the message.
Not sure if this function depends on lock debugging of kernel options.
By the experiments, this mutex seems to be unnecessary, right?
next prev parent reply other threads:[~2025-05-26 3:19 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-04 20:47 [PATCH rtw-next v1 00/13] wifi: rtw89: Add support for USB devices Bitterblue Smith
2025-05-04 20:49 ` [PATCH rtw-next v1 01/13] wifi: rtw89: 8851b: Accept USB devices and load their MAC address Bitterblue Smith
2025-05-13 2:46 ` Ping-Ke Shih
2025-05-04 20:49 ` [PATCH rtw-next v1 02/13] wifi: rtw89: Get dle_mem via rtw89_hci_dle_mem() Bitterblue Smith
2025-05-13 2:51 ` Ping-Ke Shih
2025-05-14 0:56 ` Ping-Ke Shih
2025-05-25 22:04 ` Bitterblue Smith
2025-05-26 2:52 ` Ping-Ke Shih
2025-05-04 20:49 ` [PATCH rtw-next v1 03/13] wifi: rtw89: Rename hfc_param_ini to hfc_param_ini_pcie Bitterblue Smith
2025-05-13 3:04 ` Ping-Ke Shih
2025-05-04 20:50 ` [PATCH rtw-next v1 04/13] wifi: rtw89: Add dle_mem_usb2 and dle_mem_usb3 Bitterblue Smith
2025-05-13 3:06 ` Ping-Ke Shih
2025-05-04 20:51 ` [PATCH rtw-next v1 05/13] wifi: rtw89: Add hfc_param_ini_usb Bitterblue Smith
2025-05-13 3:12 ` Ping-Ke Shih
2025-05-25 21:55 ` Bitterblue Smith
2025-05-26 1:51 ` Ping-Ke Shih
2025-05-26 6:29 ` Ping-Ke Shih
2025-05-31 20:57 ` Bitterblue Smith
2025-05-31 20:54 ` Bitterblue Smith
2025-05-04 20:51 ` [PATCH rtw-next v1 06/13] wifi: rtw89: Disable some power saving for USB Bitterblue Smith
2025-05-13 3:27 ` Ping-Ke Shih
2025-05-25 21:57 ` Bitterblue Smith
2025-05-26 2:36 ` Ping-Ke Shih
2025-05-04 20:51 ` [PATCH rtw-next v1 07/13] wifi: rtw89: Add extra TX headroom " Bitterblue Smith
2025-05-13 3:28 ` Ping-Ke Shih
2025-05-04 20:52 ` [PATCH rtw-next v1 08/13] wifi: rtw89: Hide some errors when the device is unplugged Bitterblue Smith
2025-05-13 3:43 ` Ping-Ke Shih
2025-05-25 21:58 ` Bitterblue Smith
2025-05-04 20:52 ` [PATCH rtw-next v1 09/13] wifi: rtw89: Fix rtw89_mac_power_switch() for USB Bitterblue Smith
2025-05-13 3:50 ` Ping-Ke Shih
2025-05-25 21:58 ` Bitterblue Smith
2025-05-26 2:45 ` Ping-Ke Shih
2025-05-04 20:53 ` [PATCH rtw-next v1 10/13] wifi: rtw89: Add some definitions " Bitterblue Smith
2025-05-13 3:52 ` Ping-Ke Shih
2025-05-04 20:54 ` [PATCH rtw-next v1 11/13] wifi: rtw89: Add usb.{c,h} Bitterblue Smith
2025-05-13 6:12 ` Ping-Ke Shih
2025-05-25 22:03 ` Bitterblue Smith
2025-05-26 3:18 ` Ping-Ke Shih [this message]
2025-05-31 21:03 ` Bitterblue Smith
2025-05-04 20:54 ` [PATCH rtw-next v1 12/13] wifi: rtw89: Add rtw8851bu.c Bitterblue Smith
2025-05-13 6:14 ` Ping-Ke Shih
2025-05-04 20:55 ` [PATCH rtw-next v1 13/13] wifi: rtw89: Enable the new USB modules Bitterblue Smith
2025-05-13 6:14 ` Ping-Ke Shih
2025-05-13 6:22 ` [PATCH rtw-next v1 00/13] wifi: rtw89: Add support for USB devices Ping-Ke Shih
2025-05-13 7:07 ` Ping-Ke Shih
2025-05-25 22:03 ` Bitterblue Smith
2025-05-26 1:35 ` 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=5d96c9b2693143f7914dca322e518435@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rtl8821cerfe2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.