Skip to content
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 for freq_band in controller and freq_band in agent mismatch​ and … #95

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions inc/em.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ class em_t :
void set_primary_device_type(char *type) { m_data_model->set_primary_device_type(type); }
em_freq_band_t get_band() { return m_band; }
void set_band(em_freq_band_t band) { m_band = band; }
em_rd_freq_band_t map_freq_band_to_rf_band(em_freq_band_t band);
static em_freq_band_t convert_freq_band(em_freq_band_t band);

static void *em_func(void *);
static const char *get_band_type_str(em_freq_band_t band);
Expand Down
7 changes: 0 additions & 7 deletions inc/em_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,6 @@ typedef enum {
em_freq_band_unknown
} em_freq_band_t;

typedef enum {
em_rd_freq_band_unknown, //rf band based on Wi-Fi Simple Configuration Technical Specification v2 table 44
em_rd_freq_band_24,
em_rd_freq_band_5,
em_rd_freq_band_60 = 0x4,
} em_rd_freq_band_t;

typedef struct {
unsigned int bit_map;
mac_address_t enrollee_mac;
Expand Down
2 changes: 0 additions & 2 deletions inc/em_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ class em_configuration_t {
virtual em_freq_band_t get_band() = 0;
virtual void set_band(em_freq_band_t band) = 0;
virtual em_network_ssid_info_t *get_network_ssid_info_by_haul_type(em_haul_type_t haul_type) = 0;
virtual em_rd_freq_band_t map_freq_band_to_rf_band(em_freq_band_t band) = 0;
em_freq_band_t convert_freq_band(em_freq_band_t band);

private:
em_profile_type_t m_peer_profile;
Expand Down
2 changes: 0 additions & 2 deletions inc/em_orch_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class em_orch_agent_t : public em_orch_t {
bool is_em_ready_for_orch_fini(em_cmd_t *pcmd, em_t *em);
void orch_transient(em_cmd_t *pcmd, em_t *em);

em_freq_band_t convert_freq_band(em_freq_band_t band);

public:
em_orch_agent_t(em_mgr_t *mgr);
};
Expand Down
3 changes: 2 additions & 1 deletion src/agent/dm_easy_mesh_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@ int dm_easy_mesh_agent_t::analyze_autoconfig_renew(em_bus_event_t *evt, em_cmd_t
em_event_t bus;
dm_easy_mesh_agent_t dm = *this;
int num = 0;
unsigned int index = 0;
em_cmd_t *tmp;

raw = (em_bus_event_type_cfg_renew_params_t *)evt->u.raw_buff;
memcpy(dm.get_controller_interface_mac(), raw->ctrl_src, sizeof(mac_address_t));

memcpy(dm.get_radio(index)->get_radio_info()->id.mac,raw->radio, sizeof(mac_address_t));
pcmd[num] = new em_cmd_cfg_renew_t(em_service_type_agent, evt->params, dm);
tmp = pcmd[num];
num++;
Expand Down
10 changes: 5 additions & 5 deletions src/em/config/em_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int em_configuration_t::send_autoconfig_renew_msg()
tlv = (em_tlv_t *)tmp;
tlv->type = em_tlv_type_supported_freq_band;
tlv->len = htons(sizeof(unsigned char));
freq_band = em_t::convert_freq_band(get_band());
freq_band = (em_freq_band_t)(get_band() >> 1);
memcpy(&tlv->value, &freq_band, sizeof(unsigned char));

tmp += (sizeof (em_tlv_t) + 1);
Expand Down Expand Up @@ -1203,7 +1203,7 @@ short em_configuration_t::create_m2_msg(unsigned char *buff, em_haul_type_t haul
unsigned short size;
unsigned char *tmp;
tmp = buff;
em_rd_freq_band_t rf_band;
em_freq_band_t rf_band;

// version
attr = (data_elem_attr_t *)tmp;
Expand Down Expand Up @@ -1350,7 +1350,7 @@ short em_configuration_t::create_m2_msg(unsigned char *buff, em_haul_type_t haul
attr->id = htons(attr_id_rf_bands);
size = 1;
attr->len = htons(size);
rf_band = (em_rd_freq_band_t)get_band();
rf_band = get_band();
memcpy(attr->val, &rf_band, size);

len += (sizeof(data_elem_attr_t) + size);
Expand Down Expand Up @@ -1418,7 +1418,7 @@ short em_configuration_t::create_m1_msg(unsigned char *buff)
short len = 0;
unsigned short size;
unsigned char *tmp;
em_rd_freq_band_t rf_band;
em_freq_band_t rf_band;

tmp = buff;

Expand Down Expand Up @@ -1597,7 +1597,7 @@ short em_configuration_t::create_m1_msg(unsigned char *buff)
attr->id = htons(attr_id_rf_bands);
size = 1;
attr->len = htons(size);
rf_band = map_freq_band_to_rf_band(get_band());
rf_band = (em_freq_band_t)(1 << get_band());
memcpy(attr->val, &rf_band, size);

len += (sizeof(data_elem_attr_t) + size);
Expand Down
34 changes: 0 additions & 34 deletions src/em/em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,40 +547,6 @@ dm_sta_t *em_t::find_sta(mac_address_t sta_mac, bssid_t bssid)
return NULL;
}

// Used to convert freq band from Onewifi to IEEE-1905-1-2013 table 6-23 & IEEE-1905-1-2013 table 6-23 to Wi-Fi Simple Configuration Technical Specification v2 table 44
em_freq_band_t em_t::convert_freq_band(em_freq_band_t band)
{
unsigned int int_band;
int_band = (int)band;

if (int_band == 1) {
return em_freq_band_24; // Return 2.4 GHz band
} else if (int_band == 2) {
return em_freq_band_5; // Return 5 GHz band
} else if (int_band == 32 || band == 4) {
return em_freq_band_60; // Return 60 GHz band
} else {
return em_freq_band_unknown; // Return unknown for other values
}
}

// Used to convert freq band from Wi-Fi Simple Configuration Technical Specification v2 table 44 to IEEE-1905-1-2013 table 6-23
em_rd_freq_band_t em_t::map_freq_band_to_rf_band(em_freq_band_t band)
{
unsigned int int_band;
int_band = (int)band;

if (int_band == 0) {
return em_rd_freq_band_24; // Return 2.4 GHz band
} else if (int_band == 1) {
return em_rd_freq_band_5; // Return 5 GHz band
} else if (int_band == 2) {
return em_rd_freq_band_60; // Return 60 GHz band
} else {
return em_rd_freq_band_unknown; // Return unknown for other values
}
}

dm_radio_t *em_t::get_radio_from_dm(bool command_dm)
{
dm_easy_mesh_t *dm;
Expand Down
7 changes: 3 additions & 4 deletions src/orch/em_orch_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool em_orch_agent_t::pre_process_orch_op(em_cmd_t *pcmd)
em_long_string_t key;
mac_addr_str_t sta_mac_str, bss_mac_str, radio_mac_str;
mac_address_t radio_mac;
em_freq_band_t band, freq_band;
em_freq_band_t band;

ctx = pcmd->m_data_model.get_cmd_ctx();

Expand Down Expand Up @@ -180,9 +180,8 @@ bool em_orch_agent_t::pre_process_orch_op(em_cmd_t *pcmd)
config.type = em_commit_target_bss;
dm->commit_config(pcmd->m_data_model, config);
band = pcmd->get_radio(i)->get_radio_info()->band;
freq_band = em_t::convert_freq_band(band);
printf("%s:%d: calling create_node freq_band=%d\n", __func__, __LINE__, freq_band);
if ((em = m_mgr->create_node(intf, freq_band, dm, 0, em_profile_type_3, em_service_type_agent)) == NULL) {
printf("%s:%d: calling create_node band=%d\n", __func__, __LINE__, band);
if ((em = m_mgr->create_node(intf, band, dm, 0, em_profile_type_3, em_service_type_agent)) == NULL) {
printf("%s:%d: Failed to create node\n", __func__, __LINE__);

}
Expand Down
Loading