Skip to content

Commit

Permalink
Reset all stats from wisun_tasklet.c
Browse files Browse the repository at this point in the history
  • Loading branch information
debdeep-arm committed Mar 18, 2021
1 parent 267ec78 commit 2895628
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 62 deletions.
10 changes: 3 additions & 7 deletions features/nanostack/mbed-mesh-api/source/wisun_tasklet.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,16 +626,12 @@ int wisun_tasklet_statistics_start(void)

int wisun_tasklet_statistics_reset(void)
{
if (!wisun_tasklet_data_ptr || wisun_tasklet_data_ptr->network_interface_id < 0 || !mac_api) {
if (!statistics) {
return -1;
}

if (ns_sw_mac_statistics_reset(mac_api) < 0) {
return -1;
}
if (ws_statistics_reset(wisun_tasklet_data_ptr->network_interface_id) < 0) {
return -1;
}
memset(statistics->mac_statistics, 0, sizeof(mac_statistics_t));
memset(statistics->ws_statistics, 0, sizeof(ws_statistics_t));

return 0;
}
Expand Down
7 changes: 0 additions & 7 deletions features/nanostack/sal-stack-nanostack/nanostack/sw_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ extern struct fhss_api *ns_sw_mac_get_fhss_api(struct mac_api_s *mac_api);
*/
extern int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_s *mac_statistics);

/**
* @brief Reset all statistics from software MAC.
* @param mac_api MAC instance.
* @return 0 on success, -1 on fail.
*/
extern int ns_sw_mac_statistics_reset(struct mac_api_s *mac_api);

/**
* @brief Start collecting statistics from PHY driver.
* @param mac_api MAC instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,16 +727,6 @@ int ws_statistics_start(
int8_t interface_id,
ws_statistics_t *stats_ptr);

/**
* Reset Wi-SUN statistics.
*
* \param interface_id Network interface ID.
*
* \return 0 Success.
* \return <0 Failure.
*/
int ws_statistics_reset(int8_t interface_id);

/**
* Stop collecting Wi-SUN statistics.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,6 @@ int ws_statistics_start(int8_t interface_id, ws_statistics_t *stats_ptr)
return -1;
}

int ws_statistics_reset(int8_t interface_id)
{
(void) interface_id;
return -1;
}

int ws_statistics_stop(int8_t interface_id)
{
(void) interface_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ int ws_statistics_stop(int8_t interface_id)
return 0;
}

int ws_statistics_reset(int8_t interface_id)
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
if (!cur || !ws_info(cur)) {
return -1;
}
if (cur->ws_info->stored_stats_ptr == NULL) {
/* Wi-SUN statistics is not started */
return 0;
}
cur->ws_info->stored_stats_ptr->asynch_rx_count = 0;
cur->ws_info->stored_stats_ptr->asynch_tx_count = 0;
return 0;
}

void ws_stats_update(protocol_interface_info_entry_t *cur, ws_stats_type_t type, uint32_t update_val)
{
if (!cur || !ws_info(cur)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,6 @@ int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_
return 0;
}

int ns_sw_mac_statistics_reset(struct mac_api_s *mac_api)
{
if (!mac_api) {
return -1;
}
protocol_interface_rf_mac_setup_s *mac_setup = get_sw_mac_ptr_by_mac_api(mac_api);
if (!mac_setup) {
return -1;
}
if (mac_setup->mac_statistics == NULL) {
/* MAC statics is not started */
return 0;
}
memset(mac_setup->mac_statistics, 0, sizeof(struct mac_statistics_s));
return 0;
}

static int8_t ns_sw_mac_initialize(mac_api_t *api, mcps_data_confirm *mcps_data_conf_cb,
mcps_data_indication *mcps_data_ind_cb, mcps_purge_confirm *mcps_purge_conf_cb,
mlme_confirm *mlme_conf_callback, mlme_indication *mlme_ind_callback, int8_t parent_id)
Expand Down

0 comments on commit 2895628

Please sign in to comment.