Commit f5d69067 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

add simple statistics of packet errors and servo restarts

parent dc1c7d26
......@@ -217,6 +217,10 @@ int wrc_ptp_start()
pp_printf("PTP Start!\n");
ppi->stats.sync_errors = 0;
ppi->stats.followup_errors = 0;
ppi->stats.servo_restarts = 0;
pp_init_globals(&ppg_static, &__pp_default_rt_opts);
/* Call the state machine. Being it in "Initializing" state, make
......
......@@ -178,6 +178,13 @@ struct pp_instance {
unsigned long ptp_tx_count;
unsigned long ptp_rx_count;
struct
{
int sync_errors;
int followup_errors;
int servo_restarts;
} stats;
};
/* The following things used to be bit fields. Other flags are now enums */
#define PPI_FLAG_FROM_CURRENT_PARENT 0x01
......
......@@ -163,6 +163,8 @@ void wr_servo_reset(struct pp_instance *ppi)
/* shmem unlock */
wrs_shm_write(ppsi_head, WRS_SHM_WRITE_END);
ppi->stats.servo_restarts++;
}
static inline int32_t delta_to_ps(struct FixedDelta d)
......
......@@ -252,18 +252,21 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
if (!(ppi->flags & PPI_FLAG_FROM_CURRENT_PARENT)) {
pp_error("%s: Follow up message is not from current parent\n",
__func__);
ppi->stats.followup_errors++;
return 0;
}
if (!(ppi->flags & PPI_FLAG_WAITING_FOR_F_UP)) {
pp_error("%s: Slave was not waiting a follow up message\n",
__func__);
ppi->stats.followup_errors++;
return 0;
}
if (ppi->recv_sync_sequence_id != hdr->sequenceId) {
pp_error("%s: SequenceID %d doesn't match last Sync message %d\n",
__func__, hdr->sequenceId, ppi->recv_sync_sequence_id);
ppi->stats.followup_errors++;
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment