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

Stephen Hemminger stephen at networkplumber.org
Tue May 31 18:53:55 CEST 2016


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.

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


More information about the dev mailing list