Bypass epoll_ctl, epoll_create and epoll_wait functions on MSVC.
Signed-off-by: Alin Gabriel Serdean <[email protected]>
---
lib/dpif-linux.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index bc284ab..7cf6eff 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -411,11 +411,13 @@ vport_add_channels(struct dpif_linux *dpif, odp_port_t
port_no,
for (i = 0; i < dpif->n_handlers; i++) {
struct dpif_handler *handler = &dpif->handlers[i];
+#ifndef _WIN32
if (epoll_ctl(handler->epoll_fd, EPOLL_CTL_ADD, nl_sock_fd(socksp[i]),
&event) < 0) {
error = errno;
goto error;
}
+#endif
dpif->handlers[i].channels[port_idx].sock = socksp[i];
dpif->handlers[i].channels[port_idx].last_poll = LLONG_MIN;
}
@@ -424,8 +426,10 @@ vport_add_channels(struct dpif_linux *dpif, odp_port_t
port_no,
error:
for (j = 0; j < i; j++) {
+#ifndef _WIN32
epoll_ctl(dpif->handlers[j].epoll_fd, EPOLL_CTL_DEL,
nl_sock_fd(socksp[j]), NULL);
+#endif
dpif->handlers[j].channels[port_idx].sock = NULL;
}
@@ -452,8 +456,10 @@ vport_del_channels(struct dpif_linux *dpif, odp_port_t
port_no)
for (i = 0; i < dpif->n_handlers; i++) {
struct dpif_handler *handler = &dpif->handlers[i];
+#ifndef _WIN32
epoll_ctl(handler->epoll_fd, EPOLL_CTL_DEL,
nl_sock_fd(handler->channels[port_idx].sock), NULL);
+#endif
nl_sock_destroy(handler->channels[port_idx].sock);
handler->channels[port_idx].sock = NULL;
handler->event_offset = handler->n_events = 0;
@@ -1533,6 +1539,7 @@ dpif_linux_refresh_channels(struct dpif_linux *dpif,
uint32_t n_handlers)
for (i = 0; i < n_handlers; i++) {
struct dpif_handler *handler = &dpif->handlers[i];
+#ifndef _WIN32
handler->epoll_fd = epoll_create(10);
if (handler->epoll_fd < 0) {
size_t j;
@@ -1545,6 +1552,7 @@ dpif_linux_refresh_channels(struct dpif_linux *dpif,
uint32_t n_handlers)
return errno;
}
+#endif
}
dpif->n_handlers = n_handlers;
}
@@ -1769,6 +1777,7 @@ dpif_linux_recv__(struct dpif_linux *dpif, uint32_t
handler_id,
}
handler = &dpif->handlers[handler_id];
+#ifndef _WIN32
if (handler->event_offset >= handler->n_events) {
int retval;
@@ -1791,6 +1800,12 @@ dpif_linux_recv__(struct dpif_linux *dpif, uint32_t
handler_id,
struct dpif_channel *ch = &dpif->handlers[handler_id].channels[idx];
handler->event_offset++;
+#else
+ for (int idx = 0; idx < dpif->uc_array_size; ++idx)
+ {
+ struct dpif_channel *ch =
&dpif->handlers[handler_id].channels[idx];
+
+#endif
for (;;) {
int dp_ifindex;
--
1.9.0.msysgit.0
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev