From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH v2 02/20] thunderx/nicvf: add pmd skeleton Date: Wed, 1 Jun 2016 14:44:53 +0530 Message-ID: <20160601091450.GA32268@localhost.localdomain> 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> <20160531095355.7a625ce8@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: , , , , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki To: Stephen Hemminger Return-path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0098.outbound.protection.outlook.com [157.56.110.98]) by dpdk.org (Postfix) with ESMTP id 9A3BE569C for ; Wed, 1 Jun 2016 11:15:21 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20160531095355.7a625ce8@xeon-e3> 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 Tue, May 31, 2016 at 09:53:55AM -0700, Stephen Hemminger wrote: > 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. 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.