[ovs-dev] [PATCH 2/2 v3] lib/dpif-netlink.c: add support for packet receive on Windows

Ben Pfaff blp at nicira.com
Thu Oct 23 20:28:23 UTC 2014


On Thu, Oct 23, 2014 at 08:27:34AM -0700, Nithin Raju wrote:
> In this patch, we add support in dpif-netlink.c to receive packets on
> Windows. Windows does not natively support epoll(). Even though there
> are mechanisms/interfaces that provide functionality similar to epoll(),
> we take a simple approach of using a pool of sockets.
> 
> Here are some details of the implementaion to aid review:
> 1. There's pool of sockets per upcall handler.
> 2. The pool of sockets is initialized while setting up the handler in
> dpif_netlink_refresh_channels() primarily.
> 3. When sockets are to be allocated for a vport, we walk through the
> pool of sockets for all handlers and pick one of the sockets in each of
> the pool. Within a handler's pool, sockets are picked in a round-robin
> fashion.
> 4. We currently support only 1 handler, since there are some kernel
> changes needed for support more than 1 handler per vport.
> 5. The pool size is also set to 1 currently.
> 
> The restructions imposed by #4 and #5 can be removed in the future
> without much code churn.
> 
> Validation:
> 1. With a hacked up kernel which figures out the netlink socket that is
> designated to receive packets, we are cable to perform pings between 2
> VMs on the same Hyper-V host.
> 2. Compiled the code in Linux as well.
> 3. Tested with pool size == 2 as well, though in this patch we set the
> pool size = 1.
> 
> Signed-off-by: Nithin Raju <nithin at vmware.com>

Thanks.

I folded in the following fixes and will apply this soon:

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 9ed7d73..dbcfb33 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -500,7 +500,7 @@ vport_get_pids(struct dpif_netlink *dpif, uint32_t port_idx,
     if (!dpif->handlers[0].channels[port_idx].sock) {
         return false;
     }
-    ovs_assert(!WINDOWS && dpif->n_handlers <= 1);
+    ovs_assert(!WINDOWS || dpif->n_handlers <= 1);
 
     pids = xzalloc(dpif->n_handlers * sizeof *pids);
 
@@ -1823,7 +1823,7 @@ dpif_netlink_handlers_set(struct dpif *dpif_, uint32_t n_handlers)
     int error = 0;
 
 #ifdef _WIN32
-    /* Multiple upcall handlers will be supported once kernel datpaath supports
+    /* Multiple upcall handlers will be supported once kernel datapath supports
      * it. */
     if (n_handlers > 1) {
         return error;



More information about the dev mailing list