Skip to content

Commit e686f68

Browse files
debdeep-armDebdeep Saha
authored andcommitted
Reset all stats from wisun_tasklet.c
1 parent 11caebc commit e686f68

File tree

6 files changed

+3
-62
lines changed

6 files changed

+3
-62
lines changed

features/nanostack/mbed-mesh-api/source/wisun_tasklet.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -626,16 +626,12 @@ int wisun_tasklet_statistics_start(void)
626626

627627
int wisun_tasklet_statistics_reset(void)
628628
{
629-
if (!wisun_tasklet_data_ptr || wisun_tasklet_data_ptr->network_interface_id < 0 || !mac_api) {
629+
if (!statistics) {
630630
return -1;
631631
}
632632

633-
if (ns_sw_mac_statistics_reset(mac_api) < 0) {
634-
return -1;
635-
}
636-
if (ws_statistics_reset(wisun_tasklet_data_ptr->network_interface_id) < 0) {
637-
return -1;
638-
}
633+
memset(&statistics->mac_statistics, 0, sizeof(mac_statistics_t));
634+
memset(&statistics->ws_statistics, 0, sizeof(ws_statistics_t));
639635

640636
return 0;
641637
}

features/nanostack/sal-stack-nanostack/nanostack/sw_mac.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ extern struct fhss_api *ns_sw_mac_get_fhss_api(struct mac_api_s *mac_api);
8989
*/
9090
extern int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_s *mac_statistics);
9191

92-
/**
93-
* @brief Reset all statistics from software MAC.
94-
* @param mac_api MAC instance.
95-
* @return 0 on success, -1 on fail.
96-
*/
97-
extern int ns_sw_mac_statistics_reset(struct mac_api_s *mac_api);
98-
9992
/**
10093
* @brief Start collecting statistics from PHY driver.
10194
* @param mac_api MAC instance.

features/nanostack/sal-stack-nanostack/nanostack/ws_management_api.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,16 +727,6 @@ int ws_statistics_start(
727727
int8_t interface_id,
728728
ws_statistics_t *stats_ptr);
729729

730-
/**
731-
* Reset Wi-SUN statistics.
732-
*
733-
* \param interface_id Network interface ID.
734-
*
735-
* \return 0 Success.
736-
* \return <0 Failure.
737-
*/
738-
int ws_statistics_reset(int8_t interface_id);
739-
740730
/**
741731
* Stop collecting Wi-SUN statistics.
742732
*

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_empty_functions.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,6 @@ int ws_statistics_start(int8_t interface_id, ws_statistics_t *stats_ptr)
434434
return -1;
435435
}
436436

437-
int ws_statistics_reset(int8_t interface_id)
438-
{
439-
(void) interface_id;
440-
return -1;
441-
}
442-
443437
int ws_statistics_stop(int8_t interface_id)
444438
{
445439
(void) interface_id;

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ int ws_statistics_stop(int8_t interface_id)
4949
return 0;
5050
}
5151

52-
int ws_statistics_reset(int8_t interface_id)
53-
{
54-
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
55-
if (!cur || !ws_info(cur)) {
56-
return -1;
57-
}
58-
if (cur->ws_info->stored_stats_ptr == NULL) {
59-
/* Wi-SUN statistics is not started */
60-
return 0;
61-
}
62-
cur->ws_info->stored_stats_ptr->asynch_rx_count = 0;
63-
cur->ws_info->stored_stats_ptr->asynch_tx_count = 0;
64-
return 0;
65-
}
66-
6752
void ws_stats_update(protocol_interface_info_entry_t *cur, ws_stats_type_t type, uint32_t update_val)
6853
{
6954
if (!cur || !ws_info(cur)) {

features/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,6 @@ int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_
255255
return 0;
256256
}
257257

258-
int ns_sw_mac_statistics_reset(struct mac_api_s *mac_api)
259-
{
260-
if (!mac_api) {
261-
return -1;
262-
}
263-
protocol_interface_rf_mac_setup_s *mac_setup = get_sw_mac_ptr_by_mac_api(mac_api);
264-
if (!mac_setup) {
265-
return -1;
266-
}
267-
if (mac_setup->mac_statistics == NULL) {
268-
/* MAC statics is not started */
269-
return 0;
270-
}
271-
memset(mac_setup->mac_statistics, 0, sizeof(struct mac_statistics_s));
272-
return 0;
273-
}
274-
275258
static int8_t ns_sw_mac_initialize(mac_api_t *api, mcps_data_confirm *mcps_data_conf_cb,
276259
mcps_data_indication *mcps_data_ind_cb, mcps_purge_confirm *mcps_purge_conf_cb,
277260
mlme_confirm *mlme_conf_callback, mlme_indication *mlme_ind_callback, int8_t parent_id)

0 commit comments

Comments
 (0)