From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Liang, Cunming" Subject: Re: [PATCH v13 02/14] eal/linux: add rte_epoll_wait/ctl support Date: Fri, 17 Jul 2015 05:47:11 +0000 Message-ID: References: <1433741351-27005-1-git-send-email-cunming.liang@intel.com> <1434686442-578-1-git-send-email-cunming.liang@intel.com> <1434686442-578-3-git-send-email-cunming.liang@intel.com> <3479933.5lm7YXT529@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "shemming@brocade.com" , "dev@dpdk.org" , "Wang, Liang-min" To: Thomas Monjalon Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7D3F75921 for ; Fri, 17 Jul 2015 07:48:25 +0200 (CEST) In-Reply-To: <3479933.5lm7YXT529@xps13> Content-Language: en-US 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" > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Tuesday, July 14, 2015 12:56 AM > To: Liang, Cunming > Cc: dev@dpdk.org; shemming@brocade.com; david.marchand@6wind.com; > Zhou, Danny; Wang, Liang-min; Richardson, Bruce; Liu, Yong; > nhorman@tuxdriver.com > Subject: Re: [PATCH v13 02/14] eal/linux: add rte_epoll_wait/ctl support >=20 > 2015-06-19 12:00, Cunming Liang: > > +int > > +rte_epoll_wait(int epfd, struct rte_epoll_event *events, > > + int maxevents, int timeout) > > +{ > > + struct epoll_event evs[maxevents]; > > + int rc; > > + > > + if (!events) { > > + RTE_LOG(ERR, EAL, "rte_epoll_event can't be NULL\n"); > > + return -1; > > + } > > + > > + /* using per thread epoll fd */ > > + if (epfd =3D=3D RTE_EPOLL_PER_THREAD) > > + epfd =3D rte_intr_tls_epfd(); > > + > > + while (1) { > > + rc =3D epoll_wait(epfd, evs, maxevents, timeout); > > + if (likely(rc > 0)) { > > + /* epoll_wait has at least one fd ready to read */ > > + rc =3D eal_epoll_process_event(evs, rc, events); > > + break; > > + } else if (rc < 0) { > > + if (errno =3D=3D EINTR) > > + continue; > > + /* epoll_wait fail */ > > + RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n", > > + strerror(errno)); > > + rc =3D -1; > > + break; > > + } > > + } > > + > > + return rc; > > +} >=20 > In general, such loop is application-level. > What is the added value of rte_epoll_wait()? > Do we need some wrappers to libc in DPDK? Some motivations to do it, 1) 'epoll_event' takes either fd or a data point. However we require more t= o cover both rx interrupt and other user's events. 2) Some errno processing can be addressed commonly, it's helpful to focus o= n the real event we're interested in. 3) Usually there's one epoll instance per lcore to serve the events. Here g= ives a default one if it isn't assigned.