[dpdk-dev] [PATCH v2 02/20] thunderx/nicvf: add pmd skeleton

Jerin Jacob jerin.jacob at caviumnetworks.com
Wed Jun 1 11:14:53 CEST 2016


On Tue, May 31, 2016 at 09:53:55AM -0700, Stephen Hemminger wrote:
> On Sun, 29 May 2016 22:16:46 +0530
> Jerin Jacob <jerin.jacob at caviumnetworks.com> wrote:
> 
> > +
> > +static struct itimerspec alarm_time = {
> > +	.it_interval = {
> > +		.tv_sec = 0,
> > +		.tv_nsec = NICVF_INTR_POLL_INTERVAL_MS * 1000000,
> > +	},
> > +	.it_value = {
> > +		.tv_sec = 0,
> > +		.tv_nsec = NICVF_INTR_POLL_INTERVAL_MS * 1000000,
> > +	},
> > +};
> > +
> > +static void
> > +nicvf_interrupt(struct rte_intr_handle *hdl __rte_unused, void *arg)
> > +{
> > +	struct nicvf *nic = (struct nicvf *)arg;
> > +
> > +	nicvf_reg_poll_interrupts(nic);
> > +}
> > +
> > +static int
> > +nicvf_periodic_alarm_start(struct nicvf *nic)
> > +{
> > +	int ret = -EBUSY;
> > +
> > +	nic->intr_handle.type = RTE_INTR_HANDLE_ALARM;
> > +	nic->intr_handle.fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
> > +	if (nic->intr_handle.fd == -1)
> > +		goto error;
> > +	ret = rte_intr_callback_register(&nic->intr_handle,
> > +				nicvf_interrupt, nic);
> > +	ret |= timerfd_settime(nic->intr_handle.fd, 0, &alarm_time, NULL);
> > +error:
> > +	return ret;
> > +}
> > +
> > +static int
> > +nicvf_periodic_alarm_stop(struct nicvf *nic)
> > +{
> > +	int ret;
> > +
> > +	ret = rte_intr_callback_unregister(&nic->intr_handle,
> > +				nicvf_interrupt, nic);
> > +	ret |= close(nic->intr_handle.fd);
> > +	return ret;
> > +}
> 
> It would be good to have real link status interrupts or just report that
> device does not support Link State interrupt and let application poll.  Having another
> thing going on (timerfd callback) seems like it would add more complexity to
> the environment of an already complex thread structure with DPDK.

But we would still need some polling infrastructure for some 'async'
mbox events and error events from PF.So, I think I can change to
rte_eal_alarm* infrastructure like bond pmd driver. Will fix it in V3.

> 
> Also, timerfd() doesn't exist on all OS's.


More information about the dev mailing list