Commit c72c5679 authored by Pietro Fezzardi's avatar Pietro Fezzardi Committed by Alessandro Rubini

sim: last_outgoing_jit_ns moved to pp_sim_net_delay

parent 77db1c77
......@@ -28,6 +28,7 @@ struct pp_sim_time_instance {
struct pp_sim_net_delay {
unsigned int t_prop_ns; // propagation delay on outgoing link
uint64_t jit_ns; // jitter in nsec on outgoing link
uint64_t last_outgoing_jit_ns;
};
/*
......@@ -81,7 +82,6 @@ static inline struct sim_ppg_arch_data *SIM_PPG_ARCH(struct pp_globals *ppg)
struct sim_ppi_arch_data {
struct pp_sim_time_instance time;
struct pp_sim_net_delay n_delay;
uint64_t last_outgoing_jit_ns;
/* servo */
struct pp_servo *servo;
/* Runtime options */
......
......@@ -200,11 +200,11 @@ static int sim_net_send(struct pp_instance *ppi, void *pkt, int len,
* cause the FollowUp to be discarded by the slave state machine when it
* comes earlier then the Sync */
if (((*(Enumeration4 *) (pkt + 0)) & 0x0F) == PPM_FOLLOW_UP) {
jit_ns += data->last_outgoing_jit_ns;
jit_ns += data->n_delay.last_outgoing_jit_ns;
}
jit_ns += (rand() * data->n_delay.jit_ns) / RAND_MAX;
/* store the jitter, used from the next send if it is a FollowUp */
data->last_outgoing_jit_ns = jit_ns;
data->n_delay.last_outgoing_jit_ns = jit_ns;
pending.delay_ns = data->n_delay.t_prop_ns + jit_ns;
insert_pending(SIM_PPG_ARCH(ppi->glbs), &pending);
......
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