From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <gary.chang@realtek.com>, <timlee@realtek.com>,
<dian_syuan0116@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 04/10] wifi: rtw89: drop packet offload entry on H2C addition failure to avoid scan issue
Date: Thu, 25 Jun 2026 14:15:39 +0800 [thread overview]
Message-ID: <20260625061545.44808-5-pkshih@realtek.com> (raw)
In-Reply-To: <20260625061545.44808-1-pkshih@realtek.com>
From: Dian-Syuan Yang <dian_syuan0116@realtek.com>
A special case is when C2H done ack has been completed, but the
corresponding packet offload response has not actually been received,
which causes the add packet offload to fail. In this state, firmware
treats the entry as added, so subsequent add requests for the same id
are rejected as duplicates. To recover from this, send a delete packet
offload H2C command to roll back the normal state. It has been tested and
verified to have no functional side effect.
Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/fw.c | 26 ++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index d6a594b75ab2..342f95d41c02 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -6443,8 +6443,8 @@ int rtw89_fw_h2c_del_pkt_offload(struct rtw89_dev *rtwdev, u8 id)
return 0;
}
-int rtw89_fw_h2c_add_pkt_offload(struct rtw89_dev *rtwdev, u8 *id,
- struct sk_buff *skb_ofld)
+static int __rtw89_fw_h2c_add_pkt_offload(struct rtw89_dev *rtwdev, u8 *id,
+ struct sk_buff *skb_ofld)
{
struct rtw89_wait_info *wait = &rtwdev->mac.fw_ofld_wait;
struct sk_buff *skb;
@@ -6486,13 +6486,33 @@ int rtw89_fw_h2c_add_pkt_offload(struct rtw89_dev *rtwdev, u8 *id,
rtw89_debug(rtwdev, RTW89_DBG_FW,
"failed to add pkt ofld: id %d, ret %d\n",
alloc_id, ret);
+ /*
+ * Firmware may consider that it has added this entry
+ * successfully even though the H2C return timeout.
+ * Send a delete H2C command to drop it, and thus the
+ * next add on the same id won't be rejected as duplicate.
+ */
+ rtw89_fw_h2c_del_pkt_offload(rtwdev, alloc_id);
rtw89_core_release_bit_map(rtwdev->pkt_offload, alloc_id);
- return ret;
+
+ return -EAGAIN;
}
return 0;
}
+int rtw89_fw_h2c_add_pkt_offload(struct rtw89_dev *rtwdev, u8 *id,
+ struct sk_buff *skb_ofld)
+{
+ int ret;
+
+ ret = __rtw89_fw_h2c_add_pkt_offload(rtwdev, id, skb_ofld);
+ if (ret == -EAGAIN)
+ ret = __rtw89_fw_h2c_add_pkt_offload(rtwdev, id, skb_ofld);
+
+ return ret;
+}
+
static
int rtw89_fw_h2c_scan_list_offload_ax(struct rtw89_dev *rtwdev, int ch_num,
struct list_head *chan_list)
--
2.25.1
next prev parent reply other threads:[~2026-06-25 6:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 6:15 [PATCH rtw-next 00/10] wifi: rtw89: update some MAC, FW and WoWLAN settings Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 01/10] wifi: rtw89: mac: finish active TX immediately without waiting for DMAC Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 02/10] wifi: rtw89: mac: pass chip version to firmware Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 03/10] wifi: rtw89: fw: lower debug level for UDM1 debug register Ping-Ke Shih
2026-06-25 6:15 ` Ping-Ke Shih [this message]
2026-06-25 6:15 ` [PATCH rtw-next 05/10] wifi: rtw89: disable sniffer mode in RX filter when initialization for Wi-Fi 7 chips Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 06/10] wifi: rtw89: pci: disable phy error flag related to refclk Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 07/10] wifi: rtw89: fw: fix link ID filling for LPS MLO common info Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 08/10] wifi: rtw89: wow: use MLD address in WoWLAN ARP replies for MLO stations Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 09/10] wifi: rtw89: wow: add QoS control field to WoWLAN ARP response for MLO Ping-Ke Shih
2026-06-25 6:15 ` [PATCH rtw-next 10/10] wifi: rtw89: wow: only WiFi 6 chips initialize RF registers in WoWLAN 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=20260625061545.44808-5-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=dian_syuan0116@realtek.com \
--cc=gary.chang@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=timlee@realtek.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