From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH V14 1/3] eal: add uevent monitor api and callback func Date: Tue, 30 Jan 2018 16:44:36 -0800 Message-ID: <20180130164436.5d8babcf@xeon-e3> References: <1516938577-27662-3-git-send-email-jia.guo@intel.com> <1517314860-8097-1-git-send-email-jia.guo@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: bruce.richardson@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net, motih@mellanox.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org, helin.zhang@intel.com, harry.van.haaren@intel.com, jianfeng.tan@intel.com To: Jeff Guo Return-path: Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by dpdk.org (Postfix) with ESMTP id 684A51B6EC for ; Wed, 31 Jan 2018 01:44:45 +0100 (CET) Received: by mail-pf0-f195.google.com with SMTP id i66so10819714pfd.7 for ; Tue, 30 Jan 2018 16:44:45 -0800 (PST) In-Reply-To: <1517314860-8097-1-git-send-email-jia.guo@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 30 Jan 2018 20:20:58 +0800 Jeff Guo wrote: > + memset(&ep_kernel, 0, sizeof(struct epoll_event)); > + ep_kernel.events = EPOLLIN | EPOLLPRI | EPOLLRDHUP | EPOLLHUP; > + ep_kernel.data.fd = netlink_fd; > + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, netlink_fd, > + &ep_kernel) < 0) { > + RTE_LOG(ERR, EAL, "error addding fd to epoll: %m\n"); > + goto out; > + } > + > + while (!service_exit) { > + int fdcount; > + struct epoll_event ev[1]; > + > + fdcount = epoll_wait(fd_ep, ev, 1, -1); > + if (fdcount < 0) { > + if (errno != EINTR) > + RTE_LOG(ERR, EAL, "error receiving uevent " > + "message: %m\n"); > + continue; > + } > + > + /* epoll_wait has at least one fd ready to read */ > + if (dev_uev_process(ev, fdcount) < 0) { > + if (errno != EINTR) > + RTE_LOG(ERR, EAL, "error processing uevent " > + "message: %m\n"); > + } > + } What is the point of the extra epoll here? Why not just make netlink_fd blocking and do recv? Rather than having two syscalls per event.