Message ID | aea73a7a-e791-4475-bde6-500d9f3cb2ae@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Ping-Ke Shih |
Headers | show |
Series | wifi: rtw88: Add support for RTL8821AU and RTL8812AU | expand |
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote: > The driver is supposed to avoid entering LPS (power saving) when there > is beacon loss, but only RTL8822C detects the beacon loss (because it > has beacon filtering in the firmware). > > Detect beacon loss with the other chips by checking if we received less > than half the expected number of beacons in the last 2-second interval. > > This gets rid of the occasional "failed to get tx report from firmware" > warnings with RTL8821AU. It may also avoid some disconnections. > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> > --- > drivers/net/wireless/realtek/rtw88/main.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c > index 3806e57400fb..62d9abc04a34 100644 > --- a/drivers/net/wireless/realtek/rtw88/main.c > +++ b/drivers/net/wireless/realtek/rtw88/main.c > @@ -254,6 +254,8 @@ static void rtw_watch_dog_work(struct work_struct *work) > if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) > goto unlock; > > + int received_beacons = rtwdev->dm_info.cur_pkt_count.num_bcn_pkt; > + Though currently compiler doesn't warn arbitrarily declare variables, we still should declare it on top of functions. > /* make sure BB/RF is working for dynamic mech */ > rtw_leave_lps(rtwdev); > rtw_coex_wl_status_check(rtwdev); > @@ -270,6 +272,15 @@ static void rtw_watch_dog_work(struct work_struct *work) > */ > rtw_iterate_vifs(rtwdev, rtw_vif_watch_dog_iter, &data); > > + if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER) && > + data.rtwvif) { > + int beacon_int = rtwvif_to_vif(data.rtwvif)->bss_conf.beacon_int; > + int watchdog_delay = 2000000 / 1024; /* TU */ > + int expected_beacons = DIV_ROUND_UP(watchdog_delay, beacon_int); > + > + rtwdev->beacon_loss = received_beacons < expected_beacons / 2; > + } > + Please move to an individual function such as rtw_sw_beacon_loss_check(). > /* fw supports only one station associated to enter lps, if there are > * more than two stations associated to the AP, then we can not enter > * lps, because fw does not handle the overlapped beacon interval > -- > 2.46.0
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 3806e57400fb..62d9abc04a34 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -254,6 +254,8 @@ static void rtw_watch_dog_work(struct work_struct *work) if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) goto unlock; + int received_beacons = rtwdev->dm_info.cur_pkt_count.num_bcn_pkt; + /* make sure BB/RF is working for dynamic mech */ rtw_leave_lps(rtwdev); rtw_coex_wl_status_check(rtwdev); @@ -270,6 +272,15 @@ static void rtw_watch_dog_work(struct work_struct *work) */ rtw_iterate_vifs(rtwdev, rtw_vif_watch_dog_iter, &data); + if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER) && + data.rtwvif) { + int beacon_int = rtwvif_to_vif(data.rtwvif)->bss_conf.beacon_int; + int watchdog_delay = 2000000 / 1024; /* TU */ + int expected_beacons = DIV_ROUND_UP(watchdog_delay, beacon_int); + + rtwdev->beacon_loss = received_beacons < expected_beacons / 2; + } + /* fw supports only one station associated to enter lps, if there are * more than two stations associated to the AP, then we can not enter * lps, because fw does not handle the overlapped beacon interval
The driver is supposed to avoid entering LPS (power saving) when there is beacon loss, but only RTL8822C detects the beacon loss (because it has beacon filtering in the firmware). Detect beacon loss with the other chips by checking if we received less than half the expected number of beacons in the last 2-second interval. This gets rid of the occasional "failed to get tx report from firmware" warnings with RTL8821AU. It may also avoid some disconnections. Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> --- drivers/net/wireless/realtek/rtw88/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)