[ovs-dev] [PATCH 1/4 v2] Add extentions to the standard datapath interface

Ben Pfaff blp at nicira.com
Tue Aug 19 17:53:02 UTC 2014


On Tue, Aug 19, 2014 at 02:10:50AM +0000, Saurabh Shah wrote:
> Hi Ben,
> 
> >On Thu, Aug 14, 2014 at 08:35:36PM -0700, Nithin Raju wrote:
> >> The datapath interface defined in odp-netlink.h needs some extensions
> >> that are platform dependent. Some examples are the name of the
> >>communication
> >> device on Windows and a set of commands that are specific to Windows.
> >> 
> >> In this change we define a include/odp-netlink-ext.h to in turn include
> >> any platform specific interface extensions.
> >> For Windows datapath, the extensions are defined in a new header:
> >> datapath-windows/include/OvsDpInterfaceExt.h.
> >> 
> >> The file odp-netlink-ext.h is not an auto-generated file unlke
> >>odp-netlink.h.
> >> In the future, we can possibly auto-generate it based on
> >>OvsDpInterfaceExt.h.
> >> 
> >> Also, we define three ioctls in OvsDpInterfaceExt.h:
> >> read:     provides an output buffer (mimics a recv)
> >> write:    provides an input buffer (mimics a send)
> >> transact: provides an input and optionally an output buffer.
> >>           (mimics a send followed by recv)
> >> 
> >> Signed-off-by: Nithin Raju <nithin at vmware.com>
> >
> >I'm fine with this.  I'd like someone else to review the actual
> >Windows-specific bits.
> 
> Is there any objection if we directly include OvsDpInterfaceExt.h in
> userspace (with the right #ifdefs, of course)? I don't understand why we
> would want to auto-generate a file just to include the kernel header file.
> This is what the auto-generated file is supposed to look like -
> 
> /*
>  * Header file to include platform-specific extensions to the standard
>  * datapath interface defined in odp-netlink.h.
>  */
> #ifdef _WIN32
> #include "OvsDpInterfaceExt.h"
> #endif

We could just put that in the standard odp-netlink.h, e.g. to put it
before the other #includes:

diff --git a/build-aux/extract-odp-netlink-h b/build-aux/extract-odp-netlink-h
index 068fde4..7391704 100755
--- a/build-aux/extract-odp-netlink-h
+++ b/build-aux/extract-odp-netlink-h
@@ -14,6 +14,12 @@
 # Avoid using reserved names in header guards.
 s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_H/
 
+# Include platform extensions header file on Win32.
+1,/^#include .*$/s,,#ifdef _WIN32\
+#include "OvsDpInterfaceExt.h"\
+#endif\
+&,
+
 # Transform most Linux-specific __u<N> types into C99 uint<N>_t types,
 # and most Linux-specific __be<N> into Open vSwitch ovs_be<N>,
 # and use the appropriate userspace header.

or if you need the #include at the end of the file:

diff --git a/build-aux/extract-odp-netlink-h b/build-aux/extract-odp-netlink-h
index 068fde4..9a9d1d5 100755
--- a/build-aux/extract-odp-netlink-h
+++ b/build-aux/extract-odp-netlink-h
@@ -14,6 +14,13 @@
 # Avoid using reserved names in header guards.
 s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_H/
 
+# Include platform extensions header file on Win32.
+$i\
+#ifdef _WIN32\
+#include "OvsDpInterfaceExt.h"\
+#endif\
+
+
 # Transform most Linux-specific __u<N> types into C99 uint<N>_t types,
 # and most Linux-specific __be<N> into Open vSwitch ovs_be<N>,
 # and use the appropriate userspace header.



More information about the dev mailing list