[dpdk-dev] [PATCH v13 02/14] eal/linux: add rte_epoll_wait/ctl support
Thomas Monjalon
thomas.monjalon at 6wind.com
Mon Jul 13 18:56:09 CEST 2015
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 == RTE_EPOLL_PER_THREAD)
> + epfd = rte_intr_tls_epfd();
> +
> + while (1) {
> + rc = epoll_wait(epfd, evs, maxevents, timeout);
> + if (likely(rc > 0)) {
> + /* epoll_wait has at least one fd ready to read */
> + rc = eal_epoll_process_event(evs, rc, events);
> + break;
> + } else if (rc < 0) {
> + if (errno == EINTR)
> + continue;
> + /* epoll_wait fail */
> + RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
> + strerror(errno));
> + rc = -1;
> + break;
> + }
> + }
> +
> + return rc;
> +}
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?
More information about the dev
mailing list