-
Notifications
You must be signed in to change notification settings - Fork 117
RDKB-60777: OneWifi sends ACK immediately instead of sending it after enabling it. #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
RDKB-60777: OneWifi sends ACK immediately instead of sending it after enabling it. #492
Conversation
|
sjs889 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
source/core/wifi_ctrl.c
Outdated
| wifi_ctrl_t *ctrl = get_wifictrl_obj(); | ||
|
|
||
| if (subdoc_type != webconfig_subdoc_type_lnf) { | ||
| wifi_util_info_print(WIFI_CTRL,"%s:%d - subdoc_type:%d not supported\n", __func__, __LINE__, subdoc_type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style: more than 100 chars in line, missing space after WIFI_CTRL,
wifi_util_info_print(WIFI_CTRL, "%s:%d - subdoc_type:%d not supported\n", __func__,
__LINE__, subdoc_type);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the change
source/core/wifi_ctrl.c
Outdated
| wifi_sem_param_signal(&ctrl->managed_wifi_sem_param, status); | ||
| } | ||
|
|
||
| bool managed_wifi_cfg_sem_wait_duration(uint32_t time_in_sec, webconfig_subdoc_type_t subdoc_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add function prototype in wifi_ctrl.h if exported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have exported it to wifi_ctr.h file where I have added a prototype.
source/core/wifi_ctrl_webconfig.c
Outdated
| webconfig_analytic_event_data_to_hal_apply(data); | ||
| ret = webconfig_hal_lnf_vap_apply(ctrl, &data->u.decoded); | ||
| bool status = ((ret == RETURN_OK) ? true : false); | ||
| wifi_util_info_print(WIFI_CTRL,":%s:%d lnf blob cfg status:%d\n", __func__, __LINE__, ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style: more than 100 chars in line, missing space after WIFI_CTRL,
redundant ":" at the beggining of log message, ":%s:%d lnf blob cfg status:%d\n" -> "%s:%d lnf blob cfg status:%d\n"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the changes. Can you please have a look at them again?
source/core/wifi_ctrl.c
Outdated
| wifi_ctrl_t *ctrl = NULL; | ||
|
|
||
| ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); | ||
| if (!sem_param->is_init) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check for sem_param not NULL before dereferencing it
source/core/wifi_ctrl.c
Outdated
| pthread_mutex_unlock(&ctrl->hotspot_sem_param.lock); | ||
| static void wifi_sem_param_destroy(wifi_sem_param_t *sem_param) | ||
| { | ||
| if (sem_param->is_init) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above to check the set_param being Not NULL
source/core/wifi_ctrl.c
Outdated
| { | ||
| wifi_ctrl_t *ctrl = get_wifictrl_obj(); | ||
|
|
||
| if (subdoc_type != webconfig_subdoc_type_lnf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for checking of subdoc_type in sem_wait_duration?
| __func__, (subdoc_type == webconfig_subdoc_type_lnf) ? "lnf_psk" : "xfinity"); | ||
| goto done; | ||
| } | ||
| else if(ret == RETURN_TIMEDOUT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix code style
} else if (ret == RETURN_TIMEDOUT) {
|
@amarnathhullur @bogdanbogush2 @narendradandu Can you please review now? Please ignore some debug prints as of now. Can you please check if code syntax and semantics are ok? |
| if (ret_value == false) { | ||
| wifi_util_error_print(WIFI_CTRL, "%s:%d WebConfig blob apply is failed\n", __func__, | ||
| __LINE__); | ||
| wifi_util_dbg_print(WIFI_CTRL, "%s:%d:SREESH Encoded blob:\n%s\n", __func__, __LINE__, str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove SREESH
|
|
||
| if (subdoc_type == webconfig_subdoc_type_lnf) { | ||
| wifi_util_info_print(WIFI_CTRL, | ||
| "%s:%d:SREESH Doing a thread wait for the managed wifi blob for %d seconds\n", __func__, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove SREESH
| webconfig_data_free(data); | ||
| return RETURN_TIMEDOUT; | ||
| } | ||
| } else if(subdoc_type == webconfig_subdoc_type_xfinity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix code style
} else if (subdoc_type == webconfig_subdoc_type_xfinity) {
|
@Srijeyarankesh, no comments from my side apart from the comments provided by @bogdanbogush2 . |
|
Am good with the latest changes. |
| wifi_util_error_print(WIFI_CTRL, "%s: failed to encode %s subdoc\n", \ | ||
| __func__, (subdoc_type == webconfig_subdoc_type_lnf) ? "lnf_psk" : "xfinity"); | ||
| goto done; | ||
| } else if(ret == RETURN_TIMEDOUT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style
} else if (ret == RETURN_TIMEDOUT) {
| bool managed_wifi_sem_wait_duration(uint32_t time_in_sec); | ||
| void managed_wifi_sem_signal(bool status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are definitions for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines 2032 + 2039 in wifi_ctrl.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should name them the same way: managed_wifi_cfg_sem_wait_duration and managed_wifi_cfg_sem_signal
| wifi_sem_param_signal(&ctrl->managed_wifi_sem_param, status); | ||
| } | ||
|
|
||
| bool managed_wifi_cfg_sem_wait_duration(uint32_t time_in_sec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add declaration for this and other function used in other translation nodes to wifi_ctrl.h
| bool status = false; | ||
|
|
||
| wifi_ctrl_t *ctrl = NULL; | ||
| wifi_sem_param_init(sem_param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| wifi_sem_param_init(sem_param); | |
| if (!sem_param->is_init) wifi_sem_param_init(sem_param); |
(together with removal of the if condition from wifi_sem_param_init. )
That way, one unnecessary function call will be spared making the code a bit faster.
| pthread_mutex_lock(&ctrl->hotspot_sem_param.lock); | ||
| ret = pthread_cond_timedwait(&ctrl->hotspot_sem_param.cond, &ctrl->hotspot_sem_param.lock, &ts); | ||
| pthread_mutex_lock(&sem_param->lock); | ||
| ret = pthread_cond_timedwait(&sem_param->cond, &sem_param->lock, &ts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can fail. Will extra info why it help will not be helpful in this case? or is it too rare?
| wifi_ctrl_t *ctrl = NULL; | ||
|
|
||
| ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); | ||
| if (sem_param && !sem_param->is_init) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (sem_param && !sem_param->is_init) { |
move checking if (!sem_param -> is_init) to call place, in 2005 line.
checking whether sem_param exists doesnt make sense, since this is struct being part of object - it will always exist.
| pthread_mutex_unlock(&ctrl->hotspot_sem_param.lock); | ||
| static void wifi_sem_param_destroy(wifi_sem_param_t *sem_param) | ||
| { | ||
| if (sem_param && sem_param->is_init) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above with sem_param_init please.
| ctrl->hotspot_sem_param.is_init = false; | ||
| pthread_mutex_destroy(&ctrl->hotspot_sem_param.lock); | ||
| pthread_cond_destroy(&ctrl->hotspot_sem_param.cond); | ||
| wifi_sem_param_destroy(sem_param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in line 2005:
| wifi_sem_param_destroy(sem_param); | |
| if (sem_param->is_init) wifi_sem_param_destroy(sem_param); |
|
|
||
| static void wifi_sem_param_signal(wifi_sem_param_t *sem_param, bool status) | ||
| { | ||
| if (sem_param && sem_param->is_init) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as with _init and _destroy methods, at least remove first part of condition
| bool managed_wifi_sem_wait_duration(uint32_t time_in_sec); | ||
| void managed_wifi_sem_signal(bool status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines 2032 + 2039 in wifi_ctrl.c
| } else { | ||
| wifi_util_error_print(WIFI_CTRL, "%s:%d Managed wifi blob failed, exiting\n", __func__, | ||
| __LINE__); | ||
| webconfig_data_free(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as there are no special circumstances, please use one exit point from function.
setting int ret_value = return_XX at the end of the block improves readibility significantly.
Make the WebConfig Amenity thread wait and signal it only after appropriately enabling LnF VAPs.