Skip to content

Commit 323119a

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'feature/improve_ps_compatibility_master_2025' into 'master'
feat(wifi): improve ps compatibility Closes WIFI-6757, WIFI-6304, and AUD-4813 See merge request espressif/esp-idf!35960
2 parents b37c882 + 6418d4f commit 323119a

File tree

16 files changed

+214
-32
lines changed

16 files changed

+214
-32
lines changed

components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ lmac_stop_hw_txq = 0x40001df8;
5656
ppTxFragmentProc = 0x40001e08;
5757
esf_buf_setup = 0x40001e0c;
5858
hal_crypto_set_key_entry = 0x40001e18;
59-
pm_start = 0x40001e34;
59+
/*pm_start = 0x40001e34;*/
6060
pm_stop = 0x40001e38;
6161
hal_set_sta_tbtt = 0x40001e4c;
6262
//pm_update_next_tbtt = 0x40001e50;
@@ -65,7 +65,7 @@ pm_set_sleep_type = 0x40001e54;
6565
//pm_tx_data_process = 0x40001eb4;
6666
/*pm_attach = 0x40001eb8;*/
6767
/*pm_coex_schm_process = 0x40001ebc;*/
68-
pm_on_probe_resp_rx = 0x40001ecc;
68+
/*pm_on_probe_resp_rx = 0x40001ecc;*/
6969
pm_send_probe_stop = 0x40001edc;
7070
hal_sniffer_rx_set_promis = 0x40001ef4;
7171
hal_sniffer_set_promis_misc_pkt = 0x40001efc;
@@ -183,34 +183,34 @@ hal_get_time_to_sta_next_tbtt = 0x4000303c;
183183
pm_scale_listen_interval = 0x40003040;
184184
pm_beacon_monitor_tbtt_start = 0x40003044;
185185
pm_beacon_monitor_tbtt_stop = 0x40003048;
186-
pm_beacon_monitor_timeout_process = 0x4000304c;
186+
/*pm_beacon_monitor_timeout_process = 0x4000304c;*/
187187
pm_beacon_monitor_tbtt_timeout_process = 0x40003050;
188188
pm_on_tsf_timer = 0x40003054;
189189
pp_coex_tx_release = 0x40003058;
190190
ppRegressAmpdu = 0x4000305c;
191191
trc_onPPTxDone = 0x40003060;
192192
is_fragmented_pkt = 0x40003064;
193193
pm_tx_null_data_done_quick_wake_process = 0x40003068;
194-
pm_enable_beacon_monitor_timer = 0x4000306c;
194+
/*pm_enable_beacon_monitor_timer = 0x4000306c;*/
195195
pm_disable_beacon_monitor_timer = 0x40003070;
196-
pm_beacon_offset_get_average = 0x40003074;
196+
/*pm_beacon_offset_get_average = 0x40003074;
197197
pm_beacon_offset_get_expect = 0x40003078;
198198
pm_beacon_offset_get_params = 0x4000307c;
199-
pm_beacon_offset_sample_start = 0x40003080;
199+
pm_beacon_offset_sample_start = 0x40003080;*/
200200
pm_beacon_offset_sample = 0x40003084;
201-
pm_beacon_offset_reset = 0x40003088;
201+
/*pm_beacon_offset_reset = 0x40003088;*/
202202
pm_beacon_offset_is_sampling = 0x4000308c;
203203
pm_beacon_offset_is_enabled = 0x40003090;
204-
pm_beacon_offset_configure = 0x40003094;
204+
/*pm_beacon_offset_configure = 0x40003094;*/
205205
pm_beacon_offset_resample_timeout_process = 0x40003098;
206-
pm_beacon_offset_set_rx_beacon_standard = 0x4000309c;
207-
pm_beacon_offset_get_rx_beacon_success_rate = 0x400030a0;
206+
/*pm_beacon_offset_set_rx_beacon_standard = 0x4000309c;*/
207+
/*pm_beacon_offset_get_rx_beacon_success_rate = 0x400030a0;*/
208208
pm_beacon_offset_add_total_counter = 0x400030a4;
209209
pm_beacon_offset_add_loss_counter = 0x400030a8;
210-
pm_beacon_offset_check = 0x400030ac;
211-
pm_beacon_offset_init = 0x400030b0;
210+
/*pm_beacon_offset_check = 0x400030ac;*/
211+
/*pm_beacon_offset_init = 0x400030b0;*/
212212
pm_beacon_offset_deinit = 0x400030b4;
213-
pm_get_tbtt_count = 0x400030b8;
213+
/*pm_get_tbtt_count = 0x400030b8;*/
214214
pm_coex_schm_overall_period_get = 0x400030bc;
215215
pm_coex_pwr_update = 0x400030c0;
216216
/* Data (.data, .bss, .rodata) */

components/esp_rom/esp32c2/ld/esp32c2.rom.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ ppResortTxAMPDU = 0x40001c20;
568568
ppResumeTxAMPDU = 0x40001c24;
569569
/*ppRxFragmentProc = 0x40001c28;*/
570570
/* ppRxPkt = 0x40001c2c; */
571-
ppRxProtoProc = 0x40001c30;
571+
/* ppRxProtoProc = 0x40001c30; */
572572
ppSearchTxQueue = 0x40001c34;
573573
ppSearchTxframe = 0x40001c38;
574574
ppSelectNextQueue = 0x40001c3c;

components/esp_rom/esp32c3/ld/esp32c3.rom.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ ppResortTxAMPDU = 0x400016fc;
755755
ppResumeTxAMPDU = 0x40001700;
756756
/* ppRxFragmentProc = 0x40001704; */
757757
/* ppRxPkt = 0x40001708; */
758-
ppRxProtoProc = 0x4000170c;
758+
/* ppRxProtoProc = 0x4000170c; */
759759
ppSearchTxQueue = 0x40001710;
760760
ppSearchTxframe = 0x40001714;
761761
ppSelectNextQueue = 0x40001718;

components/esp_rom/esp32c5/ld/esp32c5.rom.pp.ld

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ pm_beacon_monitor_tbtt_timeout_process = 0x40000e00;
156156
/*pm_update_next_tbtt = 0x40000e04;*/
157157
pm_twt_disallow_tx = 0x40000e08;
158158
pm_clear_wakeup_signal = 0x40000e0c;
159-
pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10;
159+
/*pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10;
160160
pm_mac_disable_tsf_tbtt_modem_wakeup = 0x40000e14;
161161
pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000e18;
162162
pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000e1c;
163-
pm_mac_modem_params_rt_update = 0x40000e20;
163+
pm_mac_modem_params_rt_update = 0x40000e20;*/
164164
pm_update_at_next_beacon = 0x40000e24;
165165
tbtt_adaptive_setup = 0x40000e28;
166166
tbtt_adaptive_servo = 0x40000e2c;
@@ -187,8 +187,8 @@ ppRecycleRxPkt = 0x40000e7c;
187187
ppResortTxAMPDU = 0x40000e80;
188188
ppResumeTxAMPDU = 0x40000e84;
189189
ppRxFragmentProc = 0x40000e88;
190-
/*ppRxPkt = 0x40000e8c;*/
191-
ppRxProtoProc = 0x40000e90;
190+
/* ppRxPkt = 0x40000e8c; */
191+
/* ppRxProtoProc = 0x40000e90; */
192192
ppSearchTxQueue = 0x40000e94;
193193
ppSearchTxframe = 0x40000e98;
194194
ppSelectNextQueue = 0x40000e9c;
@@ -338,7 +338,7 @@ get_sublen_offset = 0x400010d8;
338338
pm_coex_schm_overall_period_get = 0x40001504;
339339
ppRemoveHEAMPDUflags = 0x4000150c;
340340
tsf_hal_get_tbtt_interval = 0x40001510;
341-
pm_get_tbtt_count = 0x4000151c;
341+
/*pm_get_tbtt_count = 0x4000151c;*/
342342
tsf_hal_get_time = 0x40001520;
343343
tsf_hal_get_counter_value = 0x40001524;
344344
/* Data (.data, .bss, .rodata) */

components/esp_rom/esp32c6/ld/esp32c6.rom.pp.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ppRecycleRxPkt = 0x40000d14;
102102
ppResumeTxAMPDU = 0x40000d1c;
103103
/*ppRxFragmentProc = 0x40000d20;*/
104104
//ppRxPkt = 0x40000d24;
105-
ppRxProtoProc = 0x40000d28;
105+
//ppRxProtoProc = 0x40000d28;
106106
ppSearchTxQueue = 0x40000d2c;
107107
ppSearchTxframe = 0x40000d30;
108108
ppSelectNextQueue = 0x40000d34;

components/esp_rom/esp32c61/ld/esp32c61.rom.pp.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ pm_beacon_monitor_tbtt_timeout_process = 0x40000d6c;
160160
pm_update_next_tbtt = 0x40000d70;
161161
pm_twt_disallow_tx = 0x40000d74;
162162
pm_clear_wakeup_signal = 0x40000d78;
163-
pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000d7c;
163+
/*pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000d7c;
164164
pm_mac_disable_tsf_tbtt_modem_wakeup = 0x40000d80;
165165
pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000d84;
166166
pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000d88;
167-
pm_mac_modem_params_rt_update = 0x40000d8c;
167+
pm_mac_modem_params_rt_update = 0x40000d8c;*/
168168
pm_update_at_next_beacon = 0x40000d90;
169169
pm_get_null_max_tx_time = 0x40000d94;
170170
pm_coex_schm_overall_period_get = 0x40000d98;

components/esp_rom/esp32s3/ld/esp32s3.rom.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ ppResortTxAMPDU = 0x40005634;
10101010
ppResumeTxAMPDU = 0x40005640;
10111011
/* ppRxFragmentProc = 0x4000564c; */
10121012
/* ppRxPkt = 0x40005658; */
1013-
ppRxProtoProc = 0x40005664;
1013+
/* ppRxProtoProc = 0x40005664; */
10141014
ppSearchTxQueue = 0x40005670;
10151015
ppSearchTxframe = 0x4000567c;
10161016
ppSelectNextQueue = 0x40005688;

components/esp_wifi/Kconfig

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,9 @@ menu "Wi-Fi"
462462
default 3
463463
depends on ESP_WIFI_SLP_BEACON_LOST_OPT
464464
help
465-
Maximum number of consecutive lost beacons allowed, WiFi keeps Rx state when
466-
the number of consecutive beacons lost is greater than the given threshold.
465+
Maximum number of consecutive lost beacons allowed, the WiFi Rx state behaviour
466+
will be determined by ESP_WIFI_SLP_BEACON_LOST_OVER_THRESHOLD_POLICY
467+
when the number of consecutive beacons lost is greater than the given threshold.
467468

468469
config ESP_WIFI_SLP_PHY_ON_DELTA_EARLY_TIME
469470
int "Delta early time for RF PHY on"
@@ -483,6 +484,77 @@ menu "Wi-Fi"
483484
Delta timeout time for rf phy off, When the beacon is lost, the next rf phy off will
484485
be delayed for the time specified by the configuration item. Unit: 1024 microsecond.
485486

487+
choice ESP_WIFI_SLP_BEACON_LOST_OVER_THRESHOLD_POLICY
488+
prompt "Beacon strategy when beacon loss exceeds threshold"
489+
depends on ESP_WIFI_SLP_BEACON_LOST_OPT
490+
default ESP_WIFI_SLP_BEACON_LOST_OVER_THRESHOLD_AUTO
491+
help
492+
Select the strategy to apply when the number of lost beacons exceeds the threshold.
493+
494+
- "Receive beacon": Keep RF on until a beacon is successfully received.
495+
496+
- "Drop beacon": Turn off RF and skip beacon reception during this period.
497+
498+
- "Auto": Beacon will been dropped only if ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE enabled
499+
and expected rx beacon probability stays below the standard.
500+
501+
config ESP_WIFI_SLP_BEACON_LOST_OVER_THRESHOLD_RECEIVE
502+
bool "Receive beacon"
503+
config ESP_WIFI_SLP_BEACON_LOST_OVER_THRESHOLD_DROP
504+
bool "Drop beacon"
505+
config ESP_WIFI_SLP_BEACON_LOST_OVER_THRESHOLD_AUTO
506+
bool "Auto"
507+
endchoice
508+
509+
config ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
510+
bool "Sample beacon to calculate beacon offset"
511+
default n
512+
depends on ESP_WIFI_SLP_BEACON_LOST_OPT && !ESP_WIFI_ENHANCED_LIGHT_SLEEP
513+
help
514+
Select to enable feature sampling beacons to calculate beacon offset.
515+
516+
menu "Beacon Sample Configuration Options"
517+
visible if ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
518+
config ESP_WIFI_SLP_SAMPLE_BEACON_COUNT
519+
int "Sample beacons at wifi connected to adjust beacon parameters"
520+
range 100 1200
521+
default 300
522+
depends on ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
523+
help
524+
Numble of sampled beacons at wifi connected to adjust beacon parameters.
525+
526+
config ESP_WIFI_SLP_SAMPLE_BEACON_DIFFERENCE_PERCENT
527+
int "Difference percentage triggers unstable event"
528+
range 0 100
529+
default 20
530+
depends on ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
531+
help
532+
Difference triggers event WIFI_EVENT_STA_BEACON_OFFSET_UNSTABLE
533+
when the actual rx beacon probability continuously falls below
534+
the expected probability by this value.
535+
unit: percentage
536+
537+
config ESP_WIFI_SLP_SAMPLE_BEACON_STANDARD_PERCENT
538+
int "Standard percentage triggers beacon drop"
539+
range 0 100
540+
default 55
541+
depends on ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
542+
help
543+
Standard triggers beacon drop when the expected rx beacon probability
544+
falls below this value under ESP_WIFI_SLP_BEACON_LOST_DROP_BEACON_AUTO mode.
545+
unit: percentage
546+
547+
config ESP_WIFI_SLP_SAMPLE_BEACON_RESAMPLE_PERIOD
548+
int "Resample period"
549+
range 0 255
550+
default 3
551+
depends on ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
552+
help
553+
Resample period if beacon drop is active under ESP_WIFI_SLP_BEACON_LOST_DROP_BEACON_AUTO mode.
554+
It means never resample if setting this value to 0.
555+
unit: hours
556+
endmenu # "Beacon Sample Configuration Options"
557+
486558
config ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM
487559
int "Maximum espnow encrypt peers number"
488560
range 0 4 if IDF_TARGET_ESP32C2

components/esp_wifi/include/esp_private/wifi.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,11 @@ esp_err_t esp_wifi_internal_set_spp_amsdu(wifi_interface_t ifidx, bool spp_cap,
613613
*/
614614
void esp_wifi_internal_update_light_sleep_default_params(int min_freq_mhz, int max_freq_mhz);
615615

616+
/**
617+
* @brief Update WIFI modem sleep default parameters
618+
*/
619+
void esp_wifi_internal_update_modem_sleep_default_params(void);
620+
616621
/**
617622
* @brief Set the min active time for wifi to enter the sleep state when light sleep
618623
*
@@ -785,6 +790,24 @@ esp_err_t esp_wifi_disconnect_internal(void);
785790
*/
786791
uint32_t esp_wifi_internal_get_mac_clock_time(void);
787792

793+
#if CONFIG_ESP_WIFI_SLP_SAMPLE_BEACON_FEATURE
794+
/**
795+
* @brief Configure wifi beacon offset default parameters
796+
*
797+
* @param config: the configuration parameters for wifi beacon offset
798+
*
799+
* @return
800+
* - ESP_OK: succeed
801+
* - others: failed
802+
*/
803+
esp_err_t esp_wifi_beacon_offset_configure(wifi_beacon_offset_config_t *config);
804+
#endif
805+
806+
/**
807+
* @brief empty init pm_beacon_offset.
808+
*/
809+
void pm_beacon_offset_funcs_empty_init(void);
810+
788811
#ifdef __cplusplus
789812
}
790813
#endif

components/esp_wifi/include/esp_private/wifi_types.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -41,6 +41,16 @@ typedef struct {
4141
} data; /**< Configuration of ioctl command */
4242
} wifi_ioctl_config_t;
4343

44+
/**
45+
* @brief Mode for WiFi beacon drop
46+
*
47+
*/
48+
typedef enum {
49+
WIFI_BEACON_DROP_DISABLED,
50+
WIFI_BEACON_DROP_AUTO,
51+
WIFI_BEACON_DROP_FORCED,
52+
} wifi_beacon_drop_t;
53+
4454
/**
4555
* @brief WiFi beacon monitor parameter configuration
4656
*
@@ -59,8 +69,22 @@ typedef struct {
5969
uint16_t modem_state_consecutive; /**< PMU MODEM state consecutive count limit */
6070
uint16_t rf_ctrl_wait_cycle; /**< RF on wait time (unit: Modem APB clock cycle) */
6171
#endif
72+
wifi_beacon_drop_t beacon_drop; /**< Whether to drop the beacon if the beacon lost exceeds loss_threshold */
6273
} wifi_beacon_monitor_config_t;
6374

75+
/**
76+
* @brief WiFi beacon sample parameter configuration
77+
*
78+
*/
79+
typedef struct {
80+
uint16_t sample_period; /**< Sample beacon period, unit: number of beacons */
81+
uint8_t resample_period; /**< Resample period if beacon drop is active under the auto mode, unit: hours */
82+
/**< Standard triggers beacon drop when the expected rx beacon probability falls below this value under the auto mode, unit: percentage */
83+
uint8_t standard;
84+
/**< Difference triggers an unstable event when the actual rx beacon probability continuously falls below the expected probability by this value, unit: percentage */
85+
uint8_t difference;
86+
} wifi_beacon_offset_config_t;
87+
6488
#ifdef __cplusplus
6589
}
6690
#endif

0 commit comments

Comments
 (0)