From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 16 Jul 2015 22:48:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,493,1432623600"; d="scan'208";a="764317908" Received: from kmsmsx154.gar.corp.intel.com ([172.21.73.14]) by fmsmga002.fm.intel.com with ESMTP; 16 Jul 2015 22:48:22 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 17 Jul 2015 13:47:14 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.146]) with mapi id 14.03.0224.002; Fri, 17 Jul 2015 13:47:11 +0800 From: "Liang, Cunming" To: Thomas Monjalon Thread-Topic: [PATCH v13 02/14] eal/linux: add rte_epoll_wait/ctl support Thread-Index: AQHQqkSVT2gsajYQFUWZYN5K8WposJ3ZPvyAgAYPLCA= 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> In-Reply-To: <3479933.5lm7YXT529@xps13> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "shemming@brocade.com" , "dev@dpdk.org" , "Wang, Liang-min" Subject: Re: [dpdk-dev] [PATCH v13 02/14] eal/linux: add rte_epoll_wait/ctl support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2015 05:48:26 -0000 > -----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.