mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: Luka Gejak <luka.gejak@linux.dev>,
	Ho Jie Feng <hjf3108@gmail.com>,
	Ping-Ke Shih <pkshih@realtek.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH rtw-next v2 6/7] wifi: rtw88: 88xxa: adapt channel sensing to receiver gain
Date: Fri, 6 Nov 2026 21:46:56 +0200	[thread overview]
Message-ID: <3bd7d396-bb54-41bc-890a-bfeab90dca3a@gmail.com> (raw)
In-Reply-To: <4ada79186cd882a6d3344c43579e5addc4d4e644@linux.dev>

On 06/11/2026 19:34, Luka Gejak wrote:
> Hi Jie Feng and Bitterblue,
> 
> Thanks for fixing the scan latency. A few comments below.
> 
>> diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
>> index 69998c0d7c1f851bb30d2702233d62e14b305bf0..7a04aec9a045f1e308a4c5d331c900e013996bd5 100644
>> --- a/drivers/net/wireless/realtek/rtw88/phy.c
>> +++ b/drivers/net/wireless/realtek/rtw88/phy.c
>> @@ -377,6 +377,10 @@ void rtw_phy_dig_set_max_coverage(struct rtw_dev *rtwdev)
>>               DIG_CVRG_MIN);
>>
>>       rtw_phy_dig_write(rtwdev, DIG_CVRG_MIN);
>> +
>> +     /* EDCCA thresholds can be relative to the IGI */
>> +     if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_ADAPTIVITY))
>> +             rtw_phy_adaptivity(rtwdev);
>>  }
> 
> This and the call in rtw_phy_dig_reset() also reach
> rtw8822b_adaptivity() and rtw8822c_adaptivity() when the firmware
> doesn't handle adaptivity. They use igi_history[0], so as far as I can
> see they just write the same thresholds again, but since this is core
> code it would be good to mention it in the commit message.
> 
> [ ... ]
> 
>> diff --git a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
>> index 851d198f76f3b10d5ba77c7e07e4be9d7fd54e4b..ee72380757721dab7dc409aabc24b2b825969465 100644
>> --- a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
>> +++ b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
> 
> [ ... ]
> 
>> +#define EDCCA_LB_START_88XXA         (EDCCA_L2H_H2L_DIFF - 30)
>> +#define EDCCA_LB_RETRY_88XXA         (EDCCA_LB_START_88XXA + 18)
> 
> Maybe a short comment on where the 18 comes from. As far as I can see it
> is the vendor condition for searching a second time (IGI upper bound of
> 0x26 or lower), worked out for an initial L2H of -17.
> 
> [ ... ]
> 
>> +     rtw_write32(rtwdev, REG_DBGSEL, 0);
>> +     for (i = 0; i < 3 &&
>> +          rtw_read32(rtwdev, REG_DBGRPT) & BIT_DBG_CCA_BUSY; i++)
>> +             usleep_range(3000, 3500);
> 
> The register read in the loop condition is a bit hard to follow. Maybe
> read_poll_timeout() would read easier, like efuse.c uses it:
> 
>         read_poll_timeout(rtw_read32, val, !(val & BIT_DBG_CCA_BUSY),
>                           3000, 9000, false, rtwdev, REG_DBGRPT);
> 
> [ ... ]
> 
>> +void rtw88xxa_adaptivity_init(struct rtw_dev *rtwdev)
>> +{
>> +     struct rtw_dm_info *dm_info = &rtwdev->dm_info;
>> +     u32 dbgsel = rtw_read32(rtwdev, REG_DBGSEL);
>> +     s8 l2h;
>> +
>> +     rtw_write32_clr(rtwdev, REG_TX_PTCL_CTRL, BIT_DIS_EDCCA);
> 
> Bitterblue reported on that "firmware failed to leave lps state" shows
> up a lot more often with this patch and stops when EDCCA is disabled,
> and you replied that it only prints a line in dmesg. On rtw-next it is
> more than a message now. Since dc16902cad9c ("wifi: rtw88: ps: Trigger
> firmware recovery when failing to leave LPS state"), rtw_fw_leave_lps_check() 
> goes on to a firmware recovery after the warning:
> 
>         rtw_warn(rtwdev, "firmware failed to leave lps state\n");
>         rtw_fw_dump_dbg_info(rtwdev);
>         rtw_fw_recovery(rtwdev);
> 
> So a failed leave now ends in a firmware recovery, with a "firmware
> crash, start reset and recover" WARN and ieee80211_restart_hw(). With
> power saving on, rtw_watch_dog_work() calls rtw_leave_lps() every 2
> seconds before the dynamic mechanisms, so I think this needs to be
> solved before the patch can go in.
> 
> About a longer timeout, according to the comment in
> __rtw_fw_leave_lps_check_reg() the firmware restores REG_TCR once the AP
> has acked its null frame, so I think it would mostly hide the problem.
> Leaving this patch out of v3 and sending it again once the cause is
> known sounds fine to me, then the rest of the series doesn't have to
> wait.
> 
> Bitterblue, did you turn EDCCA off through the edcca_enable debugfs file?

Yes, that's what I did.

> With this patch that only switches to RTW_EDCCA_NORMAL, and
> rtw88xxa_adaptivity() then keeps EDCCA on with the higher normal
> thresholds. If that is what made it stop, it would point at the
> thresholds used in adaptivity mode (ETSI and JP regions) rather than at
> EDCCA itself.
> 
> Jie Feng, maybe comparing the IGI in the hardware when the leave fails
> with the IGI the thresholds were computed from would show more.
> 
> [ ... ]
> 
>> +     /* igi_history[0] keeps the pre-scan IGI while scanning */
>> +     u8 igi = rtw_read32_mask(rtwdev, REG_RXIGI_A, 0x7f);
> 
> The comment sits on a line that doesn't use igi_history[0], so it reads
> a bit confusing. Maybe something like "read the IGI in use,
> igi_history[0] still holds the old value while scanning".
> 
> Best regards,
> Luka Gejak


  reply	other threads:[~2026-11-06 19:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261031070950.425176-1-hjf3108@gmail.com>
2026-10-31  7:09 ` [PATCH rtw-next v2 1/7] wifi: rtw88: 8812a, 8814a: enable STBC for HT transmissions Ho Jie Feng
2026-11-06 17:21   ` Luka Gejak
2026-10-31  7:09 ` [PATCH rtw-next v2 2/7] wifi: rtw88: 88xxa: receive VHT SU beamformed transmissions Ho Jie Feng
2026-11-06 17:23   ` Luka Gejak
2026-10-31  7:09 ` [PATCH rtw-next v2 3/7] wifi: rtw88: correctly expose beamformee capabilities Ho Jie Feng
2026-11-06 17:25   ` Luka Gejak
2026-10-31  7:09 ` [PATCH rtw-next v2 4/7] wifi: rtw88: prepare frequency-offset correction for more chips Ho Jie Feng
2026-10-31  7:09 ` [PATCH rtw-next v2 5/7] wifi: rtw88: 88xxa: correct carrier-frequency offset Ho Jie Feng
2026-11-06 17:27   ` Luka Gejak
2026-10-31  7:09 ` [PATCH rtw-next v2 6/7] wifi: rtw88: 88xxa: adapt channel sensing to receiver gain Ho Jie Feng
2026-11-06 17:34   ` Luka Gejak
2026-11-06 19:46     ` Bitterblue Smith [this message]
2026-11-06 20:27       ` Luka Gejak
2026-10-31  7:09 ` [PATCH rtw-next v2 7/7] wifi: rtw88: 8812a, 8821a: respect peer A-MPDU size limits Ho Jie Feng
2026-11-06 17:35   ` Luka Gejak

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=3bd7d396-bb54-41bc-890a-bfeab90dca3a@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=hjf3108@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luka.gejak@linux.dev \
    --cc=pkshih@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

all inboxes | Powered by JetHome®