On Tue, 30 Jan 2018 20:20:58 +0800 Jeff Guo <jia....@intel.com> 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.