[BugFix][API-1572]add debug info for API-1572
Affected branch:MR3.0-xx && GSW3.0
Affected module:wifi
Is it addected on both ZXIC and MTK: only MTK
Self-test: YES
Doc Update: No
Change-Id: Ie0684b76df17058bb6e090f7bedc3a4901b57c8c
(cherry picked from commit 3304492db178f062067dd4cec821209551787b5f)
diff --git a/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c b/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c
index 60c4224..5b325fc 100755
--- a/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c
+++ b/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c
@@ -215,6 +215,7 @@
static void notify_service_invoke_fail(int error)
{
struct local_wpa_ctrl *lynq_wpa_ctrl = NULL;
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
if (error == -2) //timeout
{
@@ -244,6 +245,7 @@
}
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
}
static int system_call_v(const char * fmt, ...)
@@ -295,10 +297,12 @@
{
return;
}
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
s_service_invoke_timeout_cnt = FAKE_MAX_INT_VALUE;
pthread_cond_signal(&s_global_check_cond);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
}
static int local_wpa_ctrl_request(struct local_wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
@@ -310,9 +314,11 @@
RLOGE("local_wpa_ctrl_request ctrl is null\n");
return -1;
}
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&ctrl->mutex);
ret = wpa_ctrl_request(ctrl->ctrl, cmd, cmd_len, reply, reply_len, msg_cb);
pthread_mutex_unlock(&ctrl->mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
if (ret != 0)
{
notify_service_invoke_fail(ret);
@@ -323,13 +329,16 @@
static struct local_wpa_ctrl * inner_get_wpa_ctrl(int index) {
int repeat_cnt;
struct local_wpa_ctrl *lynq_wpa_ctrl = NULL;
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
RLOGD("inner_get_wpa_ctrl\n");
for (repeat_cnt = 0; repeat_cnt < 5 && NULL == g_lynq_wpa_ctrl[index]; repeat_cnt++) {
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
// printf("wait enable finish\n");
usleep(500 * 1000);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
}
if (NULL == g_lynq_wpa_ctrl[index]) {
RLOGE("NULL == g_lynq_wpa_ctrl[index]");
@@ -346,6 +355,7 @@
lynq_wpa_ctrl = g_lynq_wpa_ctrl[index];
out_addr:
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return lynq_wpa_ctrl;
}
@@ -490,10 +500,12 @@
static inline void inner_notify_ap_msg(lynq_wifi_ap_status_s status)
{
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_ap_callback_mutex);
if (g_ap_callback_func != NULL)
g_ap_callback_func(g_ap_callback_priv, status);
pthread_mutex_unlock(&s_ap_callback_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
}
static void APWatcherThreadProc() {
@@ -584,11 +596,12 @@
char * p;
const char * try_associat_flag = "Trying to associate";
const char * associated_flag = "Associated with ";
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
if (s_sta_status < INNER_STA_STATUS_CONNECTING || s_sta_status >= INNER_STA_STATUS_CONNECTED) //not in connecting stage, egnore
{
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return;
}
@@ -600,6 +613,7 @@
RLOGD("inner_check_connect_error line: %d, curr state %d, %d %d ------",__LINE__, state, s_sta_status, s_sta_error_number);
pthread_cond_signal(&s_global_check_cond);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return;
}
// youchen@2023-10-17 add for "not notify connect fail directly" end
@@ -632,6 +646,7 @@
pthread_cond_signal(&s_global_check_cond);
}
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
}
static int lynq_split(char * str, int len, char delimiter, char * results[]);
@@ -1263,6 +1278,7 @@
}
static void notify_connect_status(lynq_wifi_sta_status_s state, error_number_s error)
{
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_sta_callback_mutex);
if (g_sta_callback_func != NULL && state != LYNQ_WIFI_STATUS_EGNORE)
{
@@ -1271,9 +1287,11 @@
RLOGD("STAWatcherThreadProc callback end ------> %d %d\n", state, error);
}
pthread_mutex_unlock(&s_sta_callback_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
}
static void notify_auto_connect_status(lynq_wifi_sta_status_s state, error_number_s error,int networkid)
{
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_sta_callback_mutex);
if (g_sta_callback_func != NULL && state != LYNQ_WIFI_STATUS_EGNORE)
{
@@ -1282,6 +1300,7 @@
RLOGD("STAAutoWatcherThreadProc callback end ------> %d %d %d\n", state, error,networkid);
}
pthread_mutex_unlock(&s_sta_callback_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
}
static void STAWatcherThreadProc() {
@@ -1420,11 +1439,13 @@
while (1)
{
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
pthread_cond_wait(&s_global_check_cond,&s_global_check_mutex);
if (s_sta_status == INNER_STA_STATUS_CONNECTED)
{
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
usleep(50*1000);
notify_connect_status(LYNQ_WIFI_STA_STATUS_CONNECT, 0);
continue;
@@ -1466,6 +1487,7 @@
s_service_invoke_timeout_cnt = 0;
}
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
if (service_abnormal == 1)
{
@@ -1530,7 +1552,8 @@
{
int ret = 0;
int i;
- RLOGD("enter lynq_wifi_enable");
+ //RLOGD("enter lynq_wifi_enable");
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
if (g_lynq_wpa_ctrl[0] != NULL && g_lynq_wpa_ctrl[1] != NULL)
@@ -1564,12 +1587,14 @@
memset(g_lynq_wpa_ctrl[1], 0 , sizeof(struct local_wpa_ctrl));
out_enable:
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return ret;
}
int lynq_wifi_disable(void)
{
RLOGD("enter lynq_wifi_disable");
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
g_ap_watcher_stop_flag = 1;
g_sta_watcher_stop_flag = 1;
@@ -1584,6 +1609,7 @@
pthread_join(g_sta_auto_watcher_pid, NULL);
if (g_lynq_wpa_ctrl[0] != NULL)
wpa_ctrl_close(g_lynq_wpa_ctrl[0]);
+
if (g_lynq_wpa_ctrl[1] != NULL)
wpa_ctrl_close(g_lynq_wpa_ctrl[1]);
if (g_ap_tmp_watcher_pid != 0)
@@ -1597,6 +1623,7 @@
g_history_disconnect_valid_num = 0; //clean history_disconenct_list info
system("systemctl stop wg870_drv_insmod.service");
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return 0;
}
@@ -3670,7 +3697,7 @@
}
}
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
if (s_sta_status != INNER_STA_STATUS_INIT)
{
@@ -3678,6 +3705,7 @@
pthread_cond_signal(&s_global_check_cond);
}
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
CHECK_IDX(idx, CTRL_STA);
CHECK_WPA_CTRL(CTRL_STA);
@@ -3698,12 +3726,13 @@
&& strcmp(ap_info.psw, psw) == 0)
{
RLOGD("already connected\n");
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
s_sta_status = INNER_STA_STATUS_CONNECTED;
lynq_sta_removeElement(net_no);
pthread_cond_signal(&s_global_check_cond);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return 0;
}
}
@@ -3755,13 +3784,14 @@
DO_OK_FAIL_REQUEST(cmd_disconnect);
system("echo \"\" > /tmp/wlan0_dhcpcd_router");
usleep(200*1000);
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
lynq_sta_removeElement(net_no);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
ret = inner_sta_start_stop(net_no, 1, 1);
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
s_sta_status = INNER_STA_STATUS_CONNECTING;
g_sta_conncet_status_flag = 1;
@@ -3772,6 +3802,7 @@
s_sta_connect_timeout.tv_nsec = now.tv_usec*1000;
pthread_cond_signal(&s_global_check_cond);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return ret;
}
@@ -3806,10 +3837,11 @@
{
return 0;
}
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
s_sta_status = INNER_STA_STATUS_DISCONNECTING;
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return inner_sta_start_stop(curr_state.net_no, 0, 0);
}
@@ -3842,6 +3874,7 @@
{
return 0;
}
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
s_sta_status = INNER_STA_STATUS_DISCONNECTING;
@@ -3865,6 +3898,7 @@
RLOGD("%s %d",__func__,__LINE__);
print_disconnect_list();
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
return lynq_wifi_sta_stop_network(idx, curr_state.net_no);
}
@@ -3888,10 +3922,12 @@
system(lynq_enable_sta_cmd);
system(lynq_reconnect_cmd);
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
g_history_disconnect_valid_num = 0; //clean history_disconenct_list info
s_sta_status = INNER_STA_STATUS_INIT;
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
RLOGD("end %s %d func",__func__,__LINE__);
return 0;
}
@@ -3909,11 +3945,13 @@
RLOGD("[wifi]enter lynq_wifi_sta_start_auto start");
int tmp_open_idx[128];
int len;
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
s_sta_status = INNER_STA_STATUS_INIT;
lynq_two_arr_merge(g_history_disconnect_net,g_history_disconnect_valid_num,tmp_open_idx,&len);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
if(lynq_tmp_enable_network(idx,tmp_open_idx,len) != 0 )
{
RLOGD("[wifi]lynq_tmp_enable_network error");
@@ -3957,9 +3995,11 @@
RLOGD("lynq_wifi_sta_stop curr state %s %s %d", state,__func__,__LINE__);
usleep(SLEEP_TIME_ON_IDLE);
}
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
g_history_disconnect_valid_num = 0; //clean history_disconenct_list info
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
RLOGD("end %s %d",__func__,__LINE__);
return 0;
// return system("connmanctl disable wifi");
@@ -4193,10 +4233,12 @@
DO_OK_FAIL_REQUEST(lynq_remove_cmd);
RLOGD("WIFI[lynq_sta_forget_ap][check_history_disconenct_ap_list] input net_no is %d",net_no);
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_global_check_mutex);
lynq_sta_removeElement(net_no);
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
RLOGD("%s %d",__func__,__LINE__);
print_disconnect_list();
@@ -4306,12 +4348,13 @@
RLOGE("lynq_reg_ap_event_callback ptr is NULL,plese check!\n");
return -1;
}
-
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_ap_callback_mutex);
g_ap_callback_priv = priv;
g_ap_callback_func = cb;
pthread_mutex_unlock(&s_ap_callback_mutex);
-
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
if (g_ap_watcher_pid == 0 )
{
@@ -4319,30 +4362,32 @@
{
g_ap_watcher_pid = 0;
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
RLOGE("[wifi error]creat APWatcherThreadProc fail");
return -1;
}
}
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
RLOGD("creat APWatcherTheradProc succeed");
return 0;
}
int lynq_unreg_ap_event_callback(void * priv) {
- RLOGD("enter %s %d",__func__,__LINE__);
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_ap_callback_mutex);
if (g_ap_callback_priv == priv)
{
g_ap_callback_func = NULL;
g_ap_callback_priv = NULL;
pthread_mutex_unlock(&s_ap_callback_mutex);
- RLOGD("unreg ap callback pass %s %d",__func__,__LINE__);
+ RLOGD("unreg ap callback pass %s %d mutex_unlock",__func__,__LINE__);
return 0;
}
pthread_mutex_unlock(&s_ap_callback_mutex);
- RLOGE("unreg ap callback fail %s %d",__func__,__LINE__);
+ RLOGE("unreg ap callback fail %s %d mutex_unlock",__func__,__LINE__);
return -1;
}
@@ -4352,41 +4397,43 @@
RLOGE("lynq_reg_sta_event_callback ptr is NULL,plese check!\n");
return -1;
}
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_sta_callback_mutex);
g_sta_callback_priv = priv;
g_sta_callback_func = cb;
pthread_mutex_unlock(&s_sta_callback_mutex);
-
+ RLOGD("enter %s mutex_unlock %d",__func__,__LINE__);
+ RLOGD("enter %s mutex_lock %d",__func__,__LINE__);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
if (g_sta_watcher_pid == 0 ) {
if(pthread_create(&g_sta_watcher_pid,NULL,STAWatcherThreadProc,NULL) < 0)
{
g_sta_watcher_pid = 0;
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
- RLOGE("[wifi error]creat STAWatcherThreadProc fail");
+ RLOGE("[wifi error]creat STAWatcherThreadProc fail mutex_unlock");
return -1;
}
}
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
- RLOGD("creat STAWatcherTheradProc succeed");
+ RLOGD("creat STAWatcherTheradProc succeed mutex_unlock");
return 0;
}
int lynq_unreg_sta_event_callback(void * priv) {
- RLOGD("enter %s %d",__func__,__LINE__);
+ RLOGD("enter %s %d mutex_lock",__func__,__LINE__);
pthread_mutex_lock(&s_sta_callback_mutex);
if (g_sta_callback_priv == priv)
{
g_sta_callback_func = NULL;
g_sta_callback_priv = NULL;
pthread_mutex_unlock(&s_sta_callback_mutex);
- RLOGD("unreg sta callback pass %s %d",__func__,__LINE__);
+ RLOGD("unreg sta callback pass %s %d mutex_unlock",__func__,__LINE__);
return 0;
}
pthread_mutex_unlock(&s_sta_callback_mutex);
- RLOGE("unreg sta callback fail %s %d",__func__,__LINE__);
+ RLOGE("unreg sta callback fail %s %d mutex_unlock",__func__,__LINE__);
return -1;
}
@@ -4396,25 +4443,29 @@
RLOGE("lynq_reg_sta_auto_event_callback ptr is NULL,plese check!\n");
return -1;
}
+ RLOGD("enter %s %d mutex_lock",__func__,__LINE__);
pthread_mutex_lock(&s_sta_auto_callback_mutex);
g_sta_auto_callback_priv = priv;
g_sta_auto_callback_func = cb;
pthread_mutex_unlock(&s_sta_auto_callback_mutex);
+ RLOGD("enter %s %d mutex_unlock",__func__,__LINE__);
+ RLOGD("enter %s %d mutex_lock",__func__,__LINE__);
pthread_mutex_lock(&s_check_wpa_ctrl_mutex);
if (g_sta_auto_watcher_pid == 0 ) {
if(pthread_create(&g_sta_auto_watcher_pid,NULL,STAAutoWatcherThreadProc,NULL) < 0) //create STAAutoWatcherThreadProc
{
g_sta_auto_watcher_pid = 0;
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
- RLOGE("[wifi error]creat STAWatcherThreadProc fail");
+ RLOGE("[wifi error]creat STAWatcherThreadProc fail mutex_unlock");
return -1;
}
}
pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
- RLOGD("creat STAWatcherTheradProc succeed");
+ RLOGD("creat STAWatcherTheradProc succeed mutex_unlock");
return 0;
}
int lynq_unreg_sta_auto_event_callback(void * priv) {
+ RLOGD("enter %s %d mutex_lock",__func__,__LINE__);
pthread_mutex_lock(&s_sta_auto_callback_mutex);
if (g_sta_auto_callback_priv == priv)
{
@@ -4427,9 +4478,11 @@
g_sta_auto_callback_func = NULL;
g_sta_auto_callback_priv = NULL;
pthread_mutex_unlock(&s_sta_auto_callback_mutex);
+ RLOGD("enter %s %d mutex_unlock",__func__,__LINE__);
return 0;
}
pthread_mutex_unlock(&s_sta_auto_callback_mutex);
+ RLOGD("enter %s %d mutex_unlock",__func__,__LINE__);
return -1;
}
int lynq_get_ap_status(lynq_wifi_index_e idx, lynq_wifi_ap_run_status_s * ap_status)