Skip to content

Commit

Permalink
os/board/rtl8730e: Fix issue of stuck in wifi tx retry count API (#6669)
Browse files Browse the repository at this point in the history
- During aging test, code was stuck in while loop in wifi_get_tx_retry() due to "flag" variable not updated
- Resolve issue by:
a) Optimizing wifi_get_tx_retry API to fix issue of "flag" variable not updated
b) Add timeout counter in while loop to prevent getting stuck in infinite loop (added in PR #6655)
- Fix logic of while loop when try_cnt is == 1

Co-authored-by: quekjianwei <[email protected]>
  • Loading branch information
jwei5 and quekjianwei authored Feb 18, 2025
1 parent c4f2114 commit 8475e75
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
Binary file modified build/tools/amebasmart/gnu_utility/km0_km4_app.bin
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* == "version" + "Realtek git version" + "compile date" + "compile time" == */

== version 2490a58117 2025/02/12-10:36:45 ==
1. Optimize API for getting wifi tx retry count to resolve cache coherency issue

== version f71f367333 2025/02/03-16:19:02 ==
1. Modify implementation for obtaining TX Retry count

Expand Down
20 changes: 10 additions & 10 deletions build/tools/amebasmart/gnu_utility/target_img2.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/media/jw/E/AIDual_KM4/project/realtek_amebaD2_va0_example/GCC-RELEASE/project_hp/asdk/image/target_img2.axf: file format elf32-littlearm
/home/jw/Desktop/AIDual/project/realtek_amebaD2_va0_example/GCC-RELEASE/project_hp/asdk/image/target_img2.axf: file format elf32-littlearm


Disassembly of section .xip_image2.text:
Expand Down Expand Up @@ -109373,20 +109373,20 @@ Disassembly of section .xip_image2.text:

0d0553bc <lib_cmsis_dsp_git_rev>:
d0553bc: 6c20 6269 635f 736d 7369 645f 7073 765f lib_cmsis_dsp_v
d0553cc: 7265 645f 3037 6661 6637 3965 5f66 3032 er_d70af7fe9f_20
d0553dc: 3532 302f 2f31 3332 312d 3a36 3630 323a 25/01/23-16:06:2
d0553ec: 0031 1.
d0553cc: 7265 325f 3934 6130 3835 3131 5f37 3032 er_2490a58117_20
d0553dc: 3532 302f 2f32 3231 312d 3a30 3633 353a 25/02/12-10:36:5
d0553ec: 0032 2.

0d0553ee <lib_user_git_rev>:
d0553ee: 6c20 6269 755f 6573 5f72 6576 5f72 3764 lib_user_ver_d7
d0553fe: 6130 3766 6566 6639 325f 3230 2f35 3130 0af7fe9f_2025/01
d05540e: 322f 2d33 3631 303a 3a36 3831 /23-16:06:18.
d0553ee: 6c20 6269 755f 6573 5f72 6576 5f72 3432 lib_user_ver_24
d0553fe: 3039 3561 3138 3731 325f 3230 2f35 3230 90a58117_2025/02
d05540e: 312f 2d32 3031 333a 3a36 3035 /12-10:36:50.

0d05541b <km4_application_git_rev>:
d05541b: 6b20 346d 615f 7070 696c 6163 6974 6e6f km4_application
d05542b: 765f 7265 645f 3037 6661 6637 3965 5f66 _ver_d70af7fe9f_
d05543b: 3032 3532 302f 2f31 3332 312d 3a36 3630 2025/01/23-16:06
d05544b: 303a 0033 :03.
d05542b: 765f 7265 325f 3934 6130 3835 3131 5f37 _ver_2490a58117_
d05543b: 3032 3532 302f 2f32 3231 312d 3a30 3633 2025/02/12-10:36
d05544b: 343a 0035 :45.

0d05544f <__git_ver_table_end__>:
...
Expand Down
20 changes: 9 additions & 11 deletions os/board/rtl8730e/src/component/wifi/inic/inic_ipc_host_api_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,38 +1080,36 @@ int wifi_get_current_bw(void)
return 20;
}

/* For wifi_get_tx_retry() */
static ALIGNMTO(CACHE_LINE_SIZE) u32 tx_retry_cnt[16];

unsigned int wifi_get_tx_retry(int idx)
{
/* For padding */
ALIGNMTO(CACHE_LINE_SIZE) u8 flag[CACHE_LINE_ALIGMENT(64)];
ALIGNMTO(CACHE_LINE_SIZE) u32 tx_retry_cnt[16];
IPC_MSG_STRUCT ipc_req_msg __attribute__((aligned(64)));
u32 try_cnt = 50000;//wait 100ms
ipc_req_msg.msg_type = IPC_USER_POINT;
ipc_req_msg.msg = (u32)tx_retry_cnt;
ipc_req_msg.msg_len = sizeof(tx_retry_cnt);
ipc_req_msg.rsvd = (u32)flag;

memset(flag, 0, sizeof(flag));
ipc_req_msg.rsvd = 0;
memset(tx_retry_cnt, 0, sizeof(tx_retry_cnt));
/* Indicate wlan idx to get tx retry from */
tx_retry_cnt[0] = idx;
DCache_Clean((u32)tx_retry_cnt, sizeof(tx_retry_cnt));
ipc_send_message(IPC_AP_TO_LP, IPC_A2L_WIFI_FW_INFO, &ipc_req_msg);

while (try_cnt) {
DCache_Invalidate((u32)flag, sizeof(flag));
try_cnt --;
DelayUs(2);
if (flag[0]) {
DCache_Invalidate((u32)tx_retry_cnt, sizeof(tx_retry_cnt));
/* Index 2 is used to indicate if retry count has been obtained */
if (tx_retry_cnt[2]) {
break;
}
try_cnt --;
DelayUs(2);
}
if (try_cnt == 0) {
RTW_API_INFO("Cannot get TX retry\n");
return 0;
}
DCache_Invalidate((u32)tx_retry_cnt, sizeof(tx_retry_cnt));
/* Retry count will be at index 1 */
return tx_retry_cnt[1];
}
Expand Down

0 comments on commit 8475e75

Please sign in to comment.