Skip to content

Commit

Permalink
netdev-linux: Fix broken build on Ubuntu 14.04
Browse files Browse the repository at this point in the history
Patch 29cf9c1 ("userspace: Add TCP Segmentation Offload support") uses
__virtio16 which is defined in kernel 3.19.  Ubuntu 14.04 is using 3.13
kernel that lacks the virtio_types definition.  This patch fixes that.

Fixes: 29cf9c1 ("userspace: Add TCP Segmentation Offload support")
Acked-by: Greg Rose <[email protected]>
Signed-off-by: Yi-Hung Wei <[email protected]>
Signed-off-by: William Tu <[email protected]>
  • Loading branch information
YiHungWei authored and williamtu committed Jul 8, 2020
1 parent 4e432d6 commit fd4d477
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ AC_DEFUN([OVS_CHECK_LINUX_SCTP_CT], [
[Define to 1 if SCTP_CONNTRACK_HEARTBEAT_SENT is available.])])
])

dnl OVS_CHECK_LINUX_VIRTIO_TYPES
dnl
dnl Checks for kernels that need virtio_types definition.
AC_DEFUN([OVS_CHECK_LINUX_VIRTIO_TYPES], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <linux/virtio_types.h>], [
__virtio16 x = 0;
])],
[AC_DEFINE([HAVE_VIRTIO_TYPES], [1],
[Define to 1 if __virtio16 is available.])])
])

dnl OVS_FIND_DEPENDENCY(FUNCTION, SEARCH_LIBS, NAME_TO_PRINT)
dnl
dnl Check for a function in a library list.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ OVS_CHECK_LINUX
OVS_CHECK_LINUX_NETLINK
OVS_CHECK_LINUX_TC
OVS_CHECK_LINUX_SCTP_CT
OVS_CHECK_LINUX_VIRTIO_TYPES
OVS_CHECK_DPDK
OVS_CHECK_PRAGMA_MESSAGE
AC_SUBST([OVS_CFLAGS])
Expand Down
8 changes: 8 additions & 0 deletions lib/netdev-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ struct rtnl_link_stats64 {
uint64_t tx_compressed;
};

/* Linux 3.19 introduced virtio_types.h. It might be missing
* if we are using old kernel. */
#ifndef HAVE_VIRTIO_TYPES
typedef __u16 __bitwise__ __virtio16;
typedef __u32 __bitwise__ __virtio32;
typedef __u64 __bitwise__ __virtio64;
#endif

enum {
VALID_IFINDEX = 1 << 0,
VALID_ETHERADDR = 1 << 1,
Expand Down

0 comments on commit fd4d477

Please sign in to comment.