-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix the stability issues in controller and agent #221
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,7 @@ dm_orch_type_t dm_bss_list_t::get_dm_orch_type(db_client_t& db_client, const dm_ | |
pbss = get_bss(key); | ||
|
||
if (pbss != NULL) { | ||
if (entry_exists_in_table(db_client, bss_mac_str) == false) { | ||
if (entry_exists_in_table(db_client, key) == false) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a significant change to have the key be different, Has this change been properly tested? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes amarnath. I did test it and it works fine. Issue is while adding an entry key is construction as combination of bss mac haultype but this check uses only mac. |
||
return dm_orch_type_db_insert; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,7 +196,7 @@ int dm_radio_list_t::update_db(db_client_t& db_client, dm_orch_type_t op, void * | |
switch (op) { | ||
case dm_orch_type_db_insert: | ||
ret = insert_row(db_client, key, radio_mac_str, info->enabled, | ||
info->media_data.media_type, info->media_data.band, info->media_data.center_freq_index_1, info->media_data.center_freq_index_1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the band in media_data which was earlier used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. media_data is a new variable introduced recently, not exactly sure on the exact purpose. Band is the variable which is updated in webconfig translator and also on the agent side implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the webconfig translator and the agent needs to change to update media_data.band instead of using info.band? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will discuss with soumya and get the information on media_data struct and update it the right way, but for M2 we have to updated the band variable. |
||
info->media_data.media_type, info->band, info->media_data.center_freq_index_1, info->media_data.center_freq_index_1, | ||
info->number_of_bss, info->number_of_unassoc_sta, info->noise, info->utilization, | ||
info->traffic_sep_combined_fronthaul, | ||
info->traffic_sep_combined_backhaul, info->steering_policy, info->channel_util_threshold, info->rcpi_steering_threshold, | ||
|
@@ -207,7 +207,7 @@ int dm_radio_list_t::update_db(db_client_t& db_client, dm_orch_type_t op, void * | |
|
||
case dm_orch_type_db_update: | ||
ret = update_row(db_client, radio_mac_str, info->enabled, | ||
info->media_data.media_type, info->media_data.band, info->media_data.center_freq_index_1, info->media_data.center_freq_index_1, | ||
info->media_data.media_type, info->band, info->media_data.center_freq_index_1, info->media_data.center_freq_index_1, | ||
info->number_of_bss, info->number_of_unassoc_sta, info->noise, info->utilization, | ||
info->traffic_sep_combined_fronthaul, | ||
info->traffic_sep_combined_backhaul, info->steering_policy, info->channel_util_threshold, info->rcpi_steering_threshold, | ||
|
@@ -261,6 +261,7 @@ int dm_radio_list_t::sync_db(db_client_t& db_client, void *ctx) | |
info.enabled = db_client.get_number(ctx, 3); | ||
info.media_data.media_type = db_client.get_number(ctx, 4); | ||
info.media_data.band = db_client.get_number(ctx, 5); | ||
info.band = (em_freq_band_t) db_client.get_number(ctx, 5); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the need for this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. media_data is not updated because of which frequency band is also not updated. Modified to use band variable which is updated from M1. |
||
info.media_data.center_freq_index_1 = db_client.get_number(ctx, 6); | ||
info.media_data.center_freq_index_2 = db_client.get_number(ctx, 7); | ||
info.number_of_bss = db_client.get_number(ctx, 8); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1723,12 +1723,13 @@ int em_channel_t::handle_channel_sel_req(unsigned char *buff, unsigned int len) | |
get_mgr()->io_process(em_bus_event_type_channel_sel_req, reinterpret_cast<unsigned char *> (&op_class), sizeof(op_class_channel_sel)); | ||
|
||
printf("%s:%d Received channel selection request \n",__func__, __LINE__); | ||
|
||
set_state(em_state_agent_channel_select_configuration_pending); | ||
return 0; | ||
} | ||
|
||
int em_channel_t::handle_channel_sel_rsp(unsigned char *buff, unsigned int len) | ||
{ | ||
printf("%s:%d Received channel selection response \n",__func__, __LINE__); | ||
set_state(em_state_ctrl_channel_selected); | ||
return 0; | ||
} | ||
|
@@ -1756,6 +1757,7 @@ int em_channel_t::handle_operating_channel_rprt(unsigned char *buff, unsigned in | |
tlv_len -= static_cast<int> (sizeof(em_tlv_t) + htons(tlv->len)); | ||
tlv = reinterpret_cast<em_tlv_t *> (reinterpret_cast<unsigned char *> (tlv) + sizeof(em_tlv_t) + htons(tlv->len)); | ||
} | ||
printf("%s:%d Operating channel report recv\n", __func__, __LINE__); | ||
set_state(em_state_ctrl_configured); | ||
|
||
return 0; | ||
|
@@ -1950,7 +1952,9 @@ void em_channel_t::process_msg(unsigned char *data, unsigned int len) | |
break; | ||
|
||
case em_msg_type_channel_sel_rsp: | ||
handle_channel_sel_rsp(data, len); | ||
if (get_service_type() == em_service_type_ctrl) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the understanding that this needs to be processed only in controller? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes thats correct |
||
handle_channel_sel_rsp(data, len); | ||
} | ||
break; | ||
|
||
case em_msg_type_op_channel_rprt: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,7 +237,7 @@ int em_configuration_t::send_autoconfig_renew_msg() | |
tlv = reinterpret_cast<em_tlv_t *> (tmp); | ||
tlv->type = em_tlv_type_al_mac_address; | ||
tlv->len = htons(sizeof(mac_address_t)); | ||
memcpy(tlv->value,get_current_cmd()->get_al_interface_mac(), sizeof(mac_address_t)); | ||
memcpy(tlv->value, dm->get_agent_al_interface_mac(), sizeof(mac_address_t)); | ||
|
||
tmp += (sizeof (em_tlv_t) + sizeof(mac_address_t)); | ||
len += static_cast<unsigned int> (sizeof (em_tlv_t) + sizeof(mac_address_t)); | ||
|
@@ -255,7 +255,7 @@ int em_configuration_t::send_autoconfig_renew_msg() | |
tlv = reinterpret_cast<em_tlv_t *> (tmp); | ||
tlv->type = em_tlv_type_supported_freq_band; | ||
tlv->len = htons(sizeof(unsigned char)); | ||
freq_band = static_cast<em_freq_band_t> (get_band() >> 1); | ||
freq_band = static_cast<em_freq_band_t> (get_band()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a significant change as well. Why is the right shift not required now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. em_tlv_type_supported_freq_band spec shows different mapping RF band is used in some ieee packets so below format is mentioned, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add some documentation to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typedef enum { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, however, based on that reference, someone would think that it is only used for It doesn't hurt, especially when you are using the same enum across two different specs, with two different representations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure Ben, I will add few more details in comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merging this after indicating Aswini to update the comment in the next commit. |
||
memcpy(&tlv->value, &freq_band, sizeof(unsigned char)); | ||
|
||
tmp += (sizeof (em_tlv_t) + 1); | ||
|
@@ -826,7 +826,9 @@ void em_configuration_t::handle_ap_vendor_operational_bss(unsigned char *value, | |
em_ap_vendor_operational_bss_t *bss; | ||
em_ap_vendor_op_bss_t *ap; | ||
unsigned int i, j, all_bss_len = 0; | ||
|
||
dm_bss_t *dm_bss; | ||
dm_easy_mesh_t *dm; | ||
dm = get_data_model(); | ||
ap = reinterpret_cast<em_ap_vendor_op_bss_t *> (value); | ||
radio = ap->radios; | ||
printf("%s:%d Number of radios: %d\n", __func__, __LINE__, ap->radios_num); | ||
|
@@ -838,6 +840,19 @@ void em_configuration_t::handle_ap_vendor_operational_bss(unsigned char *value, | |
for (j = 0; j < radio->bss_num; j++) { | ||
dm_easy_mesh_t::macbytes_to_string(bss->bssid, bss_mac_str); | ||
printf("%s:%d: BSSID=%s haul type=%d\n", __func__, __LINE__, bss_mac_str, bss->haultype); | ||
dm_bss = dm->get_bss(radio->ruid, bss->bssid); | ||
if (dm_bss == NULL) { | ||
dm_bss = &dm->m_bss[dm->m_num_bss]; | ||
dm->set_num_bss(dm->get_num_bss() + 1); | ||
} | ||
// fill up id first | ||
strncpy(dm_bss->m_bss_info.id.net_id, dm->m_device.m_device_info.id.net_id, strlen(dm->m_device.m_device_info.id.net_id) + 1); | ||
memcpy(dm_bss->m_bss_info.id.dev_mac, dm->m_device.m_device_info.intf.mac, sizeof(mac_address_t)); | ||
memcpy(dm_bss->m_bss_info.id.ruid, radio->ruid, sizeof(mac_address_t)); | ||
memcpy(dm_bss->m_bss_info.id.bssid, bss->bssid, sizeof(mac_address_t)); | ||
memcpy(dm_bss->m_bss_info.ruid.mac, radio->ruid, sizeof(mac_address_t)); | ||
memcpy(dm_bss->m_bss_info.bssid.mac, bss->bssid, sizeof(mac_address_t)); | ||
dm_bss->m_bss_info.id.haul_type = (em_haul_type_t) bss->haultype; | ||
bss = reinterpret_cast<em_ap_vendor_operational_bss_t *>(reinterpret_cast<unsigned char *> (bss) + sizeof(em_ap_vendor_operational_bss_t)); | ||
all_bss_len += sizeof(em_ap_vendor_operational_bss_t); | ||
} | ||
|
@@ -1609,7 +1624,19 @@ int em_configuration_t::handle_topology_response(unsigned char *buff, unsigned i | |
|
||
tlv = reinterpret_cast<em_tlv_t *> (buff + sizeof(em_raw_hdr_t) + sizeof(em_cmdu_t)); | ||
tmp_len = len - static_cast<unsigned int> (sizeof(em_raw_hdr_t) + sizeof(em_cmdu_t)); | ||
|
||
|
||
while ((tlv->type != em_tlv_type_eom) && (tmp_len > 0)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like 1628 to 1637 is same as that of 1640 to 1651, why is this while loop repeated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need more comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed the loop is required since we have to process one TLV after another in specific order only |
||
if (tlv->type != em_tlv_type_vendor_operational_bss) { | ||
tmp_len -= static_cast<unsigned int> (sizeof(em_tlv_t) + htons(tlv->len)); | ||
tlv = reinterpret_cast<em_tlv_t *> (reinterpret_cast<unsigned char *> (tlv) + sizeof(em_tlv_t) + htons(tlv->len)); | ||
continue; | ||
} else { | ||
handle_ap_vendor_operational_bss(tlv->value, tlv->len); | ||
break; | ||
} | ||
} | ||
tlv = reinterpret_cast<em_tlv_t *> (buff + sizeof(em_raw_hdr_t) + sizeof(em_cmdu_t)); | ||
tmp_len = len - static_cast<unsigned int> (sizeof(em_raw_hdr_t) + sizeof(em_cmdu_t)); | ||
while ((tlv->type != em_tlv_type_eom) && (tmp_len > 0)) { | ||
if (tlv->type != em_tlv_type_operational_bss) { | ||
tmp_len -= static_cast<unsigned int> (sizeof(em_tlv_t) + htons(tlv->len)); | ||
|
@@ -1656,16 +1683,6 @@ int em_configuration_t::handle_topology_response(unsigned char *buff, unsigned i | |
return -1; | ||
} | ||
|
||
while ((tlv->type != em_tlv_type_eom) && (tmp_len > 0)) { | ||
if (tlv->type != em_tlv_type_vendor_operational_bss) { | ||
tmp_len -= static_cast<unsigned int> (sizeof(em_tlv_t) + htons(tlv->len)); | ||
tlv = reinterpret_cast<em_tlv_t *> (reinterpret_cast<unsigned char *> (tlv) + sizeof(em_tlv_t) + htons(tlv->len)); | ||
continue; | ||
} else { | ||
handle_ap_vendor_operational_bss(tlv->value, tlv->len); | ||
break; | ||
} | ||
} | ||
|
||
dm->set_db_cfg_param(db_cfg_type_policy_list_update, ""); | ||
return ret; | ||
|
@@ -2023,12 +2040,12 @@ unsigned short em_configuration_t::create_m2_msg(unsigned char *buff, em_haul_ty | |
len += static_cast<unsigned short int> (sizeof(data_elem_attr_t) + size); | ||
tmp += (sizeof(data_elem_attr_t) + size); | ||
|
||
// rf bands | ||
// rf bands Table 6.1.3 - RF Band | ||
attr = reinterpret_cast<data_elem_attr_t *> (tmp); | ||
attr->id = htons(attr_id_rf_bands); | ||
size = 1; | ||
attr->len = htons(size); | ||
rf_band = get_band(); | ||
rf_band = static_cast<em_freq_band_t> (1 << get_band()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this change. Need discussion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned before, adhering to spec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine but I think there should be some documentation here to avoid the understandable confusion here on why an Maybe something as simple as "Converting from EM TLV Freq Band representation to RF Freq Band Representation. See There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Will add them |
||
memcpy(attr->val, &rf_band, size); | ||
|
||
len += static_cast<unsigned short int> (sizeof(data_elem_attr_t) + size); | ||
|
@@ -2278,7 +2295,7 @@ unsigned short em_configuration_t::create_m1_msg(unsigned char *buff) | |
len += static_cast<unsigned short int> (sizeof(data_elem_attr_t) + size); | ||
tmp += (sizeof(data_elem_attr_t) + size); | ||
|
||
// rf bands | ||
// rf bands Table 6.1.3 - RF Band | ||
attr = reinterpret_cast<data_elem_attr_t *> (tmp); | ||
attr->id = htons(attr_id_rf_bands); | ||
size = 1; | ||
|
@@ -2891,11 +2908,26 @@ int em_configuration_t::handle_wsc_m1(unsigned char *buff, unsigned int len) | |
mac_addr_str_t mac_str; | ||
em_device_info_t dev_info; | ||
dm_easy_mesh_t *dm; | ||
em_freq_band_t band; | ||
em_freq_band_t band; | ||
dm_radio_t *radio; | ||
unsigned int found = 0, i = 0; | ||
|
||
dm = get_data_model(); | ||
dm = get_data_model(); | ||
memset(&dev_info, 0, sizeof(em_device_info_t)); | ||
|
||
|
||
for (i = 0; i < dm->m_num_radios; i++) { | ||
radio = dm->get_radio(i); | ||
if (memcmp(radio->get_radio_interface_mac(), get_radio_interface_mac(), sizeof(mac_address_t)) != 0) { | ||
continue; | ||
} | ||
found++; | ||
break; | ||
} | ||
|
||
if (found == 0) { | ||
printf("%s:%d Failed to find the radio\n", __func__, __LINE__); | ||
return -1; | ||
} | ||
m_m1_length = len; | ||
memcpy(m_m1_msg, buff, m_m1_length); | ||
|
||
|
@@ -2946,9 +2978,11 @@ int em_configuration_t::handle_wsc_m1(unsigned char *buff, unsigned int len) | |
} else if (id == attr_id_primary_device_type) { | ||
} else if (id == attr_id_device_name) { | ||
} else if (id == attr_id_rf_bands) { | ||
band = static_cast<em_freq_band_t> (attr->val[0]); | ||
band = static_cast<em_freq_band_t> (attr->val[0] >> 1); | ||
printf("%s:%d Freq band = %d \n", __func__, __LINE__,band); | ||
set_band(band); | ||
radio->get_radio_info()->band = band; | ||
dm->set_db_cfg_param(db_cfg_type_radio_list_update, ""); | ||
} else if (id == attr_id_assoc_state) { | ||
} else if (id == attr_id_device_password_id) { | ||
} else if (id == attr_id_cfg_error) { | ||
|
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.
Why is this check removed? Is the check not required?
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.
It does not allow autoconfig renew simultaneously for both 2.4 and 5G
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.
Reverted since its not required