dpif-netlink: Add support for packet receive on Windows.
authorNithin Raju <nithin@vmware.com>
Thu, 23 Oct 2014 15:27:34 +0000 (08:27 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 23 Oct 2014 20:29:23 +0000 (13:29 -0700)
commit09cac43f740b0aef1ef1cb656d952f56bedd7fec
treeeb3b83907765cb2288cf5b895226216a7c4c34fd
parent36791e21782536ab2ecc4aee9956d5333a8450c0
dpif-netlink: Add support for packet receive on Windows.

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@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/dpif-netlink.c