From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v2 02/20] thunderx/nicvf: add pmd skeleton Date: Tue, 31 May 2016 09:53:55 -0700 Message-ID: <20160531095355.7a625ce8@xeon-e3> References: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> <1464540424-12631-1-git-send-email-jerin.jacob@caviumnetworks.com> <1464540424-12631-3-git-send-email-jerin.jacob@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: , , , , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki To: Jerin Jacob Return-path: Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by dpdk.org (Postfix) with ESMTP id BD0FC3239 for ; Tue, 31 May 2016 18:53:42 +0200 (CEST) Received: by mail-pf0-f169.google.com with SMTP id 62so31840309pfd.1 for ; Tue, 31 May 2016 09:53:42 -0700 (PDT) In-Reply-To: <1464540424-12631-3-git-send-email-jerin.jacob@caviumnetworks.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sun, 29 May 2016 22:16:46 +0530 Jerin Jacob 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.