Message ID | 1594162789-129684-1-git-send-email-yihung.wei@gmail.com |
---|---|
State | Accepted |
Commit | fd4d4777600fb420d502b99bf8ce8d93c25d3cd2 |
Headers | show |
Series | [ovs-dev] netdev-linux: Fix broken build on Ubuntu 14.04 | expand |
On 7/7/2020 3:59 PM, Yi-Hung Wei wrote: > Patch 29cf9c1b3b9c ("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: 29cf9c1b3b9c ("userspace: Add TCP Segmentation Offload support") > Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> > --- > Travis CI: https://travis-ci.org/github/YiHungWei/ovs/builds/705960203 > --- > acinclude.m4 | 12 ++++++++++++ > configure.ac | 1 + > lib/netdev-linux.c | 8 ++++++++ > 3 files changed, 21 insertions(+) > > diff --git a/acinclude.m4 b/acinclude.m4 > index 054ec2e3c43f..863a04349373 100644 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -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. > diff --git a/configure.ac b/configure.ac > index 1877aae561d8..5ce510c2032f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -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]) > diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c > index 6269c24acf75..fe7fb9b29c0e 100644 > --- a/lib/netdev-linux.c > +++ b/lib/netdev-linux.c > @@ -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, > LGTM Acked-by: Greg Rose <gvrose8192@gmail.com>
On Wed, Jul 08, 2020 at 09:35:58AM -0700, Gregory Rose wrote: > > On 7/7/2020 3:59 PM, Yi-Hung Wei wrote: > >Patch 29cf9c1b3b9c ("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: 29cf9c1b3b9c ("userspace: Add TCP Segmentation Offload support") > >Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> > >--- snip > LGTM > Acked-by: Greg Rose <gvrose8192@gmail.com> Thanks, applied to master and 2.13.
diff --git a/acinclude.m4 b/acinclude.m4 index 054ec2e3c43f..863a04349373 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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. diff --git a/configure.ac b/configure.ac index 1877aae561d8..5ce510c2032f 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 6269c24acf75..fe7fb9b29c0e 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -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,
Patch 29cf9c1b3b9c ("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: 29cf9c1b3b9c ("userspace: Add TCP Segmentation Offload support") Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> --- Travis CI: https://travis-ci.org/github/YiHungWei/ovs/builds/705960203 --- acinclude.m4 | 12 ++++++++++++ configure.ac | 1 + lib/netdev-linux.c | 8 ++++++++ 3 files changed, 21 insertions(+)