[dpdk-dev] [PATCH V14 1/3] eal: add uevent monitor api and callback func

Guo, Jia jia.guo at intel.com
Fri Feb 2 11:45:30 CET 2018



On 1/31/2018 8:44 AM, Stephen Hemminger wrote:
> On Tue, 30 Jan 2018 20:20:58 +0800
> Jeff Guo <jia.guo at 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.
if device event monitor only monitor a netlink fd, that might be right 
not need to add extra epoll, let me think about that if it is need to 
restore for future advance or just make it simpler. thanks , stephen.



More information about the dev mailing list