Subject: Re: [ovs-dev] [PATCH openvswitch] netlink: Implement & enable memory mapped netlink i/o

From: Ben Pfaff <[email-masked]>
Date: Mon, 25 Nov 2013 15:02:53 -0800

On Thu, Nov 21, 2013 at 07:16:54PM +0100, Thomas Graf wrote:
> Based on the initial patch by Cong Wang posted a couple of months
> ago.
> 
> This is the user space counterpart needed for the kernel patch
> '[PATCH net-next 3/8] openvswitch: Enable memory mapped Netlink i/o'
> 
> Allows the kernel to construct Netlink messages on memory mapped
> buffers and thus avoids copying. The functionality is enabled on
> sockets used for unicast traffic.
> 
> Further optimizations are possible by avoiding the copy into the
> ofpbuf after reading.
> 
> Cc: Cong Wang <[email-masked]>
> Signed-off-by: Thomas Graf <[email-masked]>

Does this depend on other patches or some specific Linux kernel
headers?  It doesn't build here on GCC (similar results with Clang):

../lib/netlink-socket.c: In function 'nl_sock_set_ring':
../lib/netlink-socket.c:101:12: error: variable 'req' has initializer but incomplete type
../lib/netlink-socket.c:102:9: error: unknown field 'nm_block_size' specified in initializer
../lib/netlink-socket.c:102:9: error: excess elements in struct initializer [-Werror]
../lib/netlink-socket.c:102:9: error: (near initialization for 'req') [-Werror]
../lib/netlink-socket.c:103:9: error: unknown field 'nm_block_nr' specified in initializer
../lib/netlink-socket.c:103:9: error: excess elements in struct initializer [-Werror]
../lib/netlink-socket.c:103:9: error: (near initialization for 'req') [-Werror]
../lib/netlink-socket.c:104:9: error: unknown field 'nm_frame_size' specified in initializer
../lib/netlink-socket.c:104:9: error: excess elements in struct initializer [-Werror]
../lib/netlink-socket.c:104:9: error: (near initialization for 'req') [-Werror]
../lib/netlink-socket.c:101:24: error: storage size of 'req' isn't known
../lib/netlink-socket.c:109:43: error: 'NETLINK_RX_RING' undeclared (first use in this function)
../lib/netlink-socket.c:109:43: note: each undeclared identifier is reported only once for each function it appears in
../lib/netlink-socket.c:110:46: error: 'NETLINK_TX_RING' undeclared (first use in this function)
../lib/netlink-socket.c:101:24: error: unused variable 'req' [-Werror=unused-variable]
../lib/netlink-socket.c: In function 'nl_sock_send_mmap':
../lib/netlink-socket.c:369:22: error: 'NL_MMAP_HDRLEN' undeclared (first use in this function)
../lib/netlink-socket.c:374:12: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:374:27: error: 'NL_MMAP_STATUS_UNUSED' undeclared (first use in this function)
../lib/netlink-socket.c:385:8: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:386:8: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:386:23: error: 'NL_MMAP_STATUS_VALID' undeclared (first use in this function)
../lib/netlink-socket.c: In function 'nl_sock_recv_mmap':
../lib/netlink-socket.c:514:16: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:515:10: error: 'NL_MMAP_STATUS_VALID' undeclared (first use in this function)
../lib/netlink-socket.c:516:16: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:518:16: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:518:30: error: 'NL_MMAP_STATUS_UNUSED' undeclared (first use in this function)
../lib/netlink-socket.c:523:40: error: 'NL_MMAP_HDRLEN' undeclared (first use in this function)
../lib/netlink-socket.c:523:59: error: dereferencing pointer to incomplete type
../lib/netlink-socket.c:527:10: error: 'NL_MMAP_STATUS_COPY' undeclared (first use in this function)
../lib/netlink-socket.c:535:10: error: 'NL_MMAP_STATUS_RESERVED' undeclared (first use in this function)
../lib/netlink-socket.c:546:8: error: dereferencing pointer to incomplete type
cc1: all warnings being treated as errors