Hello Team,
I observe that timestamp captured in pcap collected on VPP with below command 
captures the time since VPP started rather than the clock time.

"pcap trace rx tx max 10000 intfc any file rxt.pcap"

Further looking into code(version 20.05), I observe that time since VPP 
restarted is being set.
Code reference below.

static inline void
pcap_add_buffer (pcap_main_t * pm,
struct vlib_main_t *vm, u32 buffer_index,
u32 n_bytes_in_trace)
{
vlib_buffer_t *b = vlib_get_buffer (vm, buffer_index);
u32 n = vlib_buffer_length_in_chain (vm, b);
i32 n_left = clib_min (n_bytes_in_trace, n);
f64 time_now = vlib_time_now (vm);       <<-------------------------------
...
}

After modifying code as below, packets are timestamped with clock time.

src/vppinfra/pcap.h

++#include <vppinfra/time_range.h>

/** Min/Max Packet bytes */
u32 min_packet_bytes, max_packet_bytes;

/** Time */
++  clib_timebase_t timebase;
} pcap_main_t;

src/vppinfra/pcap_funcs.h

pcap_add_packet()
{
++ vlib_main_t *vm = vlib_get_main();

++ if(!(pm->timebase.clib_time))
++{
++    clib_timebase_init (&(pm->timebase), 0 /* GMT */ ,
++                   CLIB_TIMEBASE_DAYLIGHT_NONE,
++                    &vm->clib_time /* share the system clock */ );
++  }

++  time_now = clib_timebase_now(&(pm->timebase));

}

My questions below.
1)Currently in fdio version 20.05 packets captured in pcap are timestamped with 
the time since VPP restarted.
Is this understanding correct?
2) If answer to above question is "YES", then is the fix correct?

Thanks,
Srini
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19213): https://lists.fd.io/g/vpp-dev/message/19213
Mute This Topic: https://lists.fd.io/mt/82117060/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to