public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Fedor Pchelkin <pchelkin@ispras.ru>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>
Cc: Zong-Zhe Yang <kevin_yang@realtek.com>,
	Bernie Huang <phhuang@realtek.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>
Subject: RE: [PATCH rtw-next 6/6] wifi: rtw89: forcefully clear TX wait list on HCI reset
Date: Thu, 25 Sep 2025 03:50:37 +0000	[thread overview]
Message-ID: <0c30dbd0d1d243d1a9e4336b979ecb9a@realtek.com> (raw)
In-Reply-To: <20250920132614.277719-7-pchelkin@ispras.ru>

Fedor Pchelkin <pchelkin@ispras.ru> wrote:
> TX status reporting based on firmware messages does not necessarily happen
> when an HCI reset occurs, in contrast to RPP based one where pending skbs
> are forcefully flushed, see rtw89_pci_release_txwd_skb().

Is it possible that USB implement HCI reset as the same behavior? So flow can
be common and people can be easier to understand the driver.

Any limitation of USB subsystem in TX path?

> 
> So for the former case, if completion from the firmware doesn't happen, TX
> wait objects are wastefully piled up in the list and not released.
> Forcefully clear TX wait list on HCI reset then.
> 
> It's okay since wiphy lock is held during HCI reset.  For the RPP case,
> all pending completions were done just before in ->reset callback and no
> new ones can appear.  For the C2H message case, RCU access to the list
> helps.
> 
> Found by Linux Verification Center (linuxtesting.org).
> 
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> ---
>  drivers/net/wireless/realtek/rtw89/core.c | 2 +-
>  drivers/net/wireless/realtek/rtw89/core.h | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index e76f04736502..3a0388d3acbf 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -1140,7 +1140,7 @@ static void rtw89_tx_wait_work(struct wiphy *wiphy, struct wiphy_work *work)
>         struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
>                                                 tx_wait_work.work);
> 
> -       rtw89_tx_wait_list_clear(rtwdev);
> +       rtw89_tx_wait_list_clear(rtwdev, false);
>  }
> 
>  void rtw89_core_tx_kick_off(struct rtw89_dev *rtwdev, u8 qsel)
> diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
> index e7948bd0bdf6..0ad871472e79 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.h
> +++ b/drivers/net/wireless/realtek/rtw89/core.h
> @@ -6282,14 +6282,14 @@ static inline void rtw89_tx_wait_release(struct rtw89_tx_wait_info *wait)
>         kfree_rcu(wait, rcu_head);
>  }
> 
> -static inline void rtw89_tx_wait_list_clear(struct rtw89_dev *rtwdev)
> +static inline void rtw89_tx_wait_list_clear(struct rtw89_dev *rtwdev, bool force)
>  {
>         struct rtw89_tx_wait_info *wait, *tmp;
> 
>         lockdep_assert_wiphy(rtwdev->hw->wiphy);
> 
>         list_for_each_entry_safe(wait, tmp, &rtwdev->tx_waits, list) {
> -               if (!completion_done(&wait->completion))
> +               if (!force && !completion_done(&wait->completion))
>                         continue;
>                 list_del_rcu(&wait->list);
>                 rtw89_tx_wait_release(wait);
> @@ -6305,7 +6305,7 @@ static inline int rtw89_hci_tx_write(struct rtw89_dev *rtwdev,
>  static inline void rtw89_hci_reset(struct rtw89_dev *rtwdev)
>  {
>         rtwdev->hci.ops->reset(rtwdev);
> -       rtw89_tx_wait_list_clear(rtwdev);
> +       rtw89_tx_wait_list_clear(rtwdev, true);
>         skb_queue_purge(&rtwdev->tx_rpt_queue);
>  }
> 
> --
> 2.51.0
> 


  reply	other threads:[~2025-09-25  3:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-20 13:26 [PATCH rtw-next 0/6] wifi: rtw89: improvements for USB part Fedor Pchelkin
2025-09-20 13:26 ` [PATCH rtw-next 1/6] wifi: rtw89: usb: fix leak in rtw89_usb_rx_handler() Fedor Pchelkin
2025-09-24  8:49   ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 2/6] wifi: rtw89: usb: fix leak in rtw89_usb_write_port() Fedor Pchelkin
2025-09-24  9:03   ` Ping-Ke Shih
2025-09-29  9:12     ` Fedor Pchelkin
2025-09-30  2:03       ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 3/6] wifi: rtw89: implement C2H TX report handler Fedor Pchelkin
2025-09-23 22:12   ` Bitterblue Smith
2025-09-24 19:16     ` Bitterblue Smith
2025-09-29  9:46       ` Fedor Pchelkin
2025-09-24  9:18   ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 4/6] wifi: rtw89: handle IEEE80211_TX_CTL_REQ_TX_STATUS frames for USB Fedor Pchelkin
2025-09-25  2:05   ` Ping-Ke Shih
2025-09-29 14:16     ` Fedor Pchelkin
2025-09-30  1:55       ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 5/6] wifi: rtw89: process TX wait skbs for USB via C2H handler Fedor Pchelkin
2025-09-25  3:39   ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 6/6] wifi: rtw89: forcefully clear TX wait list on HCI reset Fedor Pchelkin
2025-09-25  3:50   ` Ping-Ke Shih [this message]
2025-09-22  5:45 ` [PATCH rtw-next 0/6] wifi: rtw89: improvements for USB part 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=0c30dbd0d1d243d1a9e4336b979ecb9a@realtek.com \
    --to=pkshih@realtek.com \
    --cc=kevin_yang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=pchelkin@ispras.ru \
    --cc=phhuang@realtek.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox