Skip to content

Update DML if HAL params change when applying#1133

Draft
bmilcz-comcast wants to merge 1 commit into
rdkcentral:developfrom
bmilcz-comcast:dml_cache_updates_fix
Draft

Update DML if HAL params change when applying#1133
bmilcz-comcast wants to merge 1 commit into
rdkcentral:developfrom
bmilcz-comcast:dml_cache_updates_fix

Conversation

@bmilcz-comcast
Copy link
Copy Markdown
Contributor

@bmilcz-comcast bmilcz-comcast commented May 18, 2026

Using WebConfig we are synchronizing the current manager cache with DML cache if params that were passed down to createVAP() change after the funcion finalizes.

Comment thread source/core/wifi_ctrl.c
return TIMER_TASK_COMPLETE;
}

int update_global_cache(wifi_vap_info_map_t *tgt_vap_map, rdk_wifi_vap_info_t *rdk_vap_info)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's being used in other translation units add declaration to one of the headers and include in each translation unit that uses it outside of this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread source/core/services/vap_svc.c Outdated
Comment on lines +195 to +203
webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc(
sizeof(webconfig_subdoc_data_t));

if (dml_cache_update_subdoc == NULL) {
wifi_util_error_print(WIFI_CTRL,
"%s:%d: malloc failed to allocate webconfig_subdoc_data_t, size %d\n", __func__,
__LINE__, sizeof(webconfig_subdoc_data_t));
return -1;
}
Copy link
Copy Markdown
Contributor

@Pavlo-Uvarov Pavlo-Uvarov May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocate memory right before it's used, not here.

Suggested change
webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc(
sizeof(webconfig_subdoc_data_t));
if (dml_cache_update_subdoc == NULL) {
wifi_util_error_print(WIFI_CTRL,
"%s:%d: malloc failed to allocate webconfig_subdoc_data_t, size %d\n", __func__,
__LINE__, sizeof(webconfig_subdoc_data_t));
return -1;
}
webconfig_subdoc_data_t *dml_cache_update_subdoc = NULL;

And remove all those free(dml_cache_update_subdoc); that follow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread source/core/wifi_ctrl_queue_handlers.c Outdated
wifi_vap_info_map_t *tmp_vap_map = NULL;
bool dml_cache_update_needed = false;

webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before - don't allocate memory, until it's being used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread source/core/wifi_ctrl_queue_handlers.c Outdated
char update_status[128];
bool dml_cache_update_needed = false;

webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before - don't allocate memory, until it's being used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread source/core/wifi_ctrl_queue_handlers.c Outdated
char update_status[128], old_sec_mode[32], new_sec_mode[32];
bool dml_cache_update_needed = false;

webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before - don't allocate memory, until it's being used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread source/core/wifi_ctrl_webconfig.c Outdated
int ret = 0;

bool dml_cache_update_needed = false;
webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before - don't allocate memory, until it's being used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +304 to +315
if (dml_cache_update_needed) {
wifi_ctrl_t *ctrl = (wifi_ctrl_t *)get_wifictrl_obj();
ctrl->webconfig_state |= ctrl_webconfig_state_vap_all_cfg_rsp_pending;
if (webconfig_encode(&ctrl->webconfig, dml_cache_update_subdoc,
webconfig_subdoc_type_dml) == webconfig_error_none) {
wifi_util_info_print(WIFI_CTRL, "%s:%d webconfig_encode success\n", __FUNCTION__,
__LINE__);
} else {
wifi_util_error_print(WIFI_CTRL, "%s:%d webconfig_encode failed\n", __FUNCTION__,
__LINE__);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw these chunks of code are repeating. I think you can move them into separate function and call that function instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Using WebConfig we are synchronizing the current manager cache with DML
cache if params that were passed down to createVAP() change after the
function finalizes.
@bmilcz-comcast bmilcz-comcast force-pushed the dml_cache_updates_fix branch from 9641ce3 to d0fcfd4 Compare June 1, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants