[ovs-dev] [PATCH] odp-netlink.h: Autogenerate a version of odp-netlink for windows kernel.

Alin Serdean aserdean at cloudbasesolutions.com
Thu Aug 7 01:17:03 UTC 2014


I was wondering why not generate the #ifdef over the file that already generates a copy of openvswitch.h (odp-netlink.h) needed for the extension?

And as Nithin pointed out I think this can be solved in a more elegant solution.

Thanks,
Alin.

-----Mesaj original-----
De la: dev [mailto:dev-bounces at openvswitch.org] În numele Nithin Raju
Trimis: Thursday, August 7, 2014 3:17 AM
Către: Ankur Sharma
Cc: <dev at openvswitch.org>
Subiect: Re: [ovs-dev] [PATCH] odp-netlink.h: Autogenerate a version of odp-netlink for windows kernel.

hi Ankur,
This is not a perfect solution, but a step in the right direction of auto-generating a file for the Windows DP.

Only comment I had is that we should get rid of definition of ETH_ALEN in OvsTypes.h. You can do that in another patch instead of re-spinning this one.

Unless we change the approach, this patch looks good to me.

Acked-by: Nithin Raju <nithin at vmware.com>

thanks,
Nithin


On Aug 6, 2014, at 4:30 PM, Ankur Sharma <ankursharma at vmware.com>
 wrote:

> odp-netlink.h: Autogenerate a version of odp-netlink for windows kernel.
> 
> Autogenerated odp-netlink.h will not compile with windows kernel, as 
> it refers to some userspace files like openvswitch/types.h and 
> packets.h which hyperv extension does not access. Due to this the 
> windows datapath compilation is broken on tip of tree. This patch 
> intends to fix that.
> 
> In this patch we add a new sed script "extract-odp-netlink-windows-h" 
> to create odp-netlink-windows-dp.h. It works on similar lines as 
> extract-odp-netlink-h, but avoids including the header files which are 
> not available for driver.
> 
> Also, added saurabh's fix to not to include some header files in 
> lib/netlink-protocol.h not needed by windows driver.
> 
> After this fix, a userspace build will be needed before windows kernel 
> datapath can be built.
> 
> Tested that hyperv extension could be built after building the 
> userspace. Verified vxlan tunnel based ping across hypervisors. 
> Verified that odp-netlink-windows-dp.h is not built for linux 
> platform. Ran 'make distcheck' to verify that nothing is broken on 
> linux.
> 
> Signed-off-by: Ankur Sharma <ankursharma at vmware.com>
> Co-authored-by: Saurabh Shah <ssaurabh at vmware.com>
> Tested-by: Ankur Sharma <ankursharma at vmware.com>
> Reported-by: Alin Serdean <aserdean at cloudbasesolutions.com>
> Reported-by: Nithin Raju <nithin at vmware.com>
> Reported-at: 
> https://urldefense.proofpoint.com/v1/url?u=https://github.com/openvswi
> tch/ovs-issues/issues/21&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=ubrOpIW
> avCMqX4l4j1LEVpTfDj%2FD5Qyn8KCoJIBGvzo%3D%0A&m=j8DgXwkf5X0TTs0%2B5C5wB
> eHu5N%2BL38609QgXuIyYlvA%3D%0A&s=08ba33ff599cf904d6adfe602f69b542c6e87
> 57acacc80a2c2cc8074965197c2
> ---
> build-aux/extract-odp-netlink-windows-h | 24 ++++++++++++++++++++++++
> datapath-windows/ovsext/precomp.h       |  2 +-
> include/automake.mk                     | 16 ++++++++++++++++
> lib/netlink-protocol.h                  |  3 ++-
> 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100755 
> build-aux/extract-odp-netlink-windows-h
> 
> diff --git a/build-aux/extract-odp-netlink-windows-h 
> b/build-aux/extract-odp-netlink-windows-h
> new file mode 100755
> index 0000000..dbb2c98
> --- /dev/null
> +++ b/build-aux/extract-odp-netlink-windows-h
> @@ -0,0 +1,24 @@
> +# This is a "sed" script that transforms <linux/openvswitch.h> into a 
> +# form that is suitable for inclusion within the Open vSwitch tree on 
> +# windows system. The transformed header file can be included by 
> +windows # driver modules.
> +
> +# Add a header warning that this is a generated file.
> +1i\
> +/* -*- mode: c; buffer-read-only: t -*- */\
> +/* Generated automatically from <linux/openvswitch.h> -- do not 
> +modify! */\ \ \
> +
> +# Avoid using reserved names in header guards.
> +s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_WINDOWS_DP_H/
> +
> +# and use the appropriate userspace header.
> +s,<linux/types\.h>,"OvsTypes.h",
> +
> +# Add ETH_ADDR_LEN macro to avoid including userspace packet.h 
> +s,#include <linux/if_ether\.h>,\n#ifndef ETH_ADDR_LEN \ #define 
> +ETH_ADDR_LEN  6 \n#endif,
> +
> +# Use OVS's own ETH_ADDR_LEN instead of Linux-specific ETH_ALEN.
> +s/ETH_ALEN/ETH_ADDR_LEN/
> diff --git a/datapath-windows/ovsext/precomp.h 
> b/datapath-windows/ovsext/precomp.h
> index 45e72de..4c81323 100644
> --- a/datapath-windows/ovsext/precomp.h
> +++ b/datapath-windows/ovsext/precomp.h
> @@ -28,4 +28,4 @@
>  * Include openvswitch.h from userspace. Changing the location the 
> file from
>  * include/linux is pending discussion.
>  */
> -#include "include\linux\openvswitch.h"
> +#include "include\odp-netlink-windows-dp.h"
> diff --git a/include/automake.mk b/include/automake.mk index 
> 55cb353..233eb52 100644
> --- a/include/automake.mk
> +++ b/include/automake.mk
> @@ -1,9 +1,25 @@
> BUILT_SOURCES += include/odp-netlink.h
> 
> +if WIN32
> +BUILT_SOURCES += include/odp-netlink-windows-dp.h endif
> +
> include/odp-netlink.h: datapath/linux/compat/include/linux/openvswitch.h \
>                        build-aux/extract-odp-netlink-h
> 	sed -f $(srcdir)/build-aux/extract-odp-netlink-h < $< > $@
> +
> +if WIN32
> +include/odp-netlink-windows-dp.h: datapath/linux/compat/include/linux/openvswitch.h \
> +                                  build-aux/extract-odp-netlink-windows-h
> +	sed -f $(srcdir)/build-aux/extract-odp-netlink-windows-h < $< > $@ 
> +endif
> +
> EXTRA_DIST += build-aux/extract-odp-netlink-h
> +
> +if WIN32
> +EXTRA_DIST += build-aux/extract-odp-netlink-windows-h
> +endif
> +
> CLEANFILES += include/odp-netlink.h
> 
> include include/openflow/automake.mk
> diff --git a/lib/netlink-protocol.h b/lib/netlink-protocol.h index 
> 8938055..3ce18f0 100644
> --- a/lib/netlink-protocol.h
> +++ b/lib/netlink-protocol.h
> @@ -28,10 +28,11 @@
>  * regardless of platform.  On Linux, it includes the proper headers 
> directly;
>  * on other platforms it directly defines the structures and macros itself.
>  */
> -
> +#ifndef OVS_WIN_DP
> #include <stdint.h>
> #include <sys/socket.h>
> #include "util.h"
> +#endif
> 
> #ifdef HAVE_NETLINK
> #include <linux/netlink.h>
> --
> 1.9.1
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mail
> man/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=ubrOpIWavCMqX4l
> 4j1LEVpTfDj%2FD5Qyn8KCoJIBGvzo%3D%0A&m=j8DgXwkf5X0TTs0%2B5C5wBeHu5N%2B
> L38609QgXuIyYlvA%3D%0A&s=fc9e474fcf7c7aeddc0665718843f221c2a35aaf3ee65
> 49845a83e346c435081

_______________________________________________
dev mailing list
dev at openvswitch.org
http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list