On Thu, 13 Jul 2017 17:24:27 +0100 Reshma Pattan <reshma.pat...@intel.com> wrote:
> diff --git a/lib/librte_ether/rte_ethdev_pci.h > b/lib/librte_ether/rte_ethdev_pci.h > index 69aab03..f829407 100644 > --- a/lib/librte_ether/rte_ethdev_pci.h > +++ b/lib/librte_ether/rte_ethdev_pci.h > @@ -37,6 +37,7 @@ > #include <rte_malloc.h> > #include <rte_pci.h> > #include <rte_ethdev.h> > +#include <rte_cycles.h> > > /** > * Copy pci device info to the Ethernet device data. > @@ -157,6 +158,9 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device > *pci_dev, > > RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL); > ret = dev_init(eth_dev); > + eth_dev->data->sys_up_time_start = rte_rdtsc(); > + eth_dev->data->if_counter_discontinuity_time = 0; > + eth_dev->data->if_last_change = 0; Shouldn't this be in base eth_dev layer rather than the PCI specific code. If you look in rte_eth_dev_data_alloc, the dev_data is already zeroed. Also, DPDK in general does BSD style structure names (ie always putting prefix on structure tags). In BSD, this is a leftover from ancient V6 UNIX where compiler did no real checking of structure tags. My preference is that variables and structure names be as short as possible. The TSC counter is not a good value to use on this anyway. You don't care about sub-microsecond accuracy and it wraps around. Better to figure out a better clock source. Is there a DPDK wrapper of clock_gettime(CLOCK_MONOTONIC)?