From: Mehmet Fide <mehmet.fide@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
mehmet.fide@screeningeagle.com
Subject: [PATCH rtw-next 1/2] wifi: rtw88: download the beacon the reserved page was built with
Date: Tue, 29 Sep 2026 14:43:59 +0200 [thread overview]
Message-ID: <20260929124400.3856049-2-mehmet.fide@gmail.com> (raw)
In-Reply-To: <20260929124400.3856049-1-mehmet.fide@gmail.com>
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
rtw_fw_download_rsvd_page() downloads the beacon twice: once as part of
the reserved page and once more on its own, so that the firmware ends up
with a TX descriptor that describes the beacon rather than the whole
page. The second download fetched a new beacon from mac80211 instead of
downloading the one the page already holds.
Besides the extra work, every beacon fetch advances the DTIM count and,
while a channel switch is announced, the CSA countdown; doing it twice
per update lets a countdown that starts at 2 reach 0, which mac80211
warns about. Keep the beacon skb from the page build and download that.
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
drivers/net/wireless/realtek/rtw88/fw.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index 945fedcd375b..a4400ff51372 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -1702,11 +1702,13 @@ static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev, u32 *size)
list_for_each_entry(rsvd_pkt, &rtwdev->rsvd_page_list, build_list) {
rtw_rsvd_page_list_to_buf(rtwdev, page_size, page_margin,
page, buf, rsvd_pkt);
- if (page == 0)
+ if (page == 0) {
page += rtw_len_to_page(rsvd_pkt->skb->len +
tx_desc_sz, page_size);
- else
- page += rtw_len_to_page(rsvd_pkt->skb->len, page_size);
+ /* keep the beacon for rtw_download_beacon() */
+ continue;
+ }
+ page += rtw_len_to_page(rsvd_pkt->skb->len, page_size);
kfree_skb(rsvd_pkt->skb);
rsvd_pkt->skb = NULL;
@@ -1725,7 +1727,6 @@ static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev, u32 *size)
static int rtw_download_beacon(struct rtw_dev *rtwdev)
{
- struct ieee80211_hw *hw = rtwdev->hw;
struct rtw_rsvd_page *rsvd_pkt;
struct sk_buff *skb;
int ret = 0;
@@ -1744,25 +1745,25 @@ static int rtw_download_beacon(struct rtw_dev *rtwdev)
return -EINVAL;
}
- skb = rtw_get_rsvd_page_skb(hw, rsvd_pkt);
+ /* the beacon kept by rtw_build_rsvd_page() */
+ skb = rsvd_pkt->skb;
if (!skb) {
rtw_err(rtwdev, "failed to get beacon skb\n");
- return -ENOMEM;
+ return -ENOENT;
}
ret = rtw_download_drv_rsvd_page(rtwdev, skb->data, skb->len);
if (ret)
rtw_err(rtwdev, "failed to download drv rsvd page\n");
- dev_kfree_skb(skb);
-
return ret;
}
int rtw_fw_download_rsvd_page(struct rtw_dev *rtwdev)
{
- u8 *buf;
+ struct rtw_rsvd_page *rsvd_pkt;
u32 size;
+ u8 *buf;
int ret;
buf = rtw_build_rsvd_page(rtwdev, &size);
@@ -1791,6 +1792,12 @@ int rtw_fw_download_rsvd_page(struct rtw_dev *rtwdev)
free:
kfree(buf);
+ /* free the beacon kept by rtw_build_rsvd_page() */
+ rsvd_pkt = list_first_entry(&rtwdev->rsvd_page_list,
+ struct rtw_rsvd_page, build_list);
+ kfree_skb(rsvd_pkt->skb);
+ rsvd_pkt->skb = NULL;
+
return ret;
}
--
2.55.0
next prev parent reply other threads:[~2026-09-29 12:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 12:43 [PATCH rtw-next 0/2] wifi: rtw88: channel switch in AP mode Mehmet Fide
2026-09-29 12:43 ` Mehmet Fide [this message]
2026-09-29 19:11 ` [PATCH rtw-next 1/2] wifi: rtw88: download the beacon the reserved page was built with Luka Gejak
2026-09-29 21:05 ` Mehmet Fide
2026-09-29 12:44 ` [PATCH rtw-next 2/2] wifi: rtw88: support channel switch in AP mode Mehmet Fide
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=20260929124400.3856049-2-mehmet.fide@gmail.com \
--to=mehmet.fide@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mehmet.fide@screeningeagle.com \
--cc=pkshih@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
all inboxes | Powered by JetHome®