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 <nit...@vmware.com> thanks, Nithin On Aug 6, 2014, at 4:30 PM, Ankur Sharma <ankursha...@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 <ankursha...@vmware.com> > Co-authored-by: Saurabh Shah <ssaur...@vmware.com> > Tested-by: Ankur Sharma <ankursha...@vmware.com> > Reported-by: Alin Serdean <aserd...@cloudbasesolutions.com> > Reported-by: Nithin Raju <nit...@vmware.com> > Reported-at: > https://urldefense.proofpoint.com/v1/url?u=https://github.com/openvswitch/ovs-issues/issues/21&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=ubrOpIWavCMqX4l4j1LEVpTfDj%2FD5Qyn8KCoJIBGvzo%3D%0A&m=j8DgXwkf5X0TTs0%2B5C5wBeHu5N%2BL38609QgXuIyYlvA%3D%0A&s=08ba33ff599cf904d6adfe602f69b542c6e8757acacc80a2c2cc8074965197c2 > --- > 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@openvswitch.org > https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=ubrOpIWavCMqX4l4j1LEVpTfDj%2FD5Qyn8KCoJIBGvzo%3D%0A&m=j8DgXwkf5X0TTs0%2B5C5wBeHu5N%2BL38609QgXuIyYlvA%3D%0A&s=fc9e474fcf7c7aeddc0665718843f221c2a35aaf3ee6549845a83e346c435081 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev