> -----Original Message-----
> From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Nithin Raju
> Sent: Wednesday, August 13, 2014 7:12 PM
> To: dev@openvswitch.org
> Subject: [ovs-dev] [PATCH 1/4] Add extentions to the standard datapath
> interface
> 
> 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 <nit...@vmware.com>
> ---
>  datapath-windows/automake.mk                 |    1 +
>  datapath-windows/include/OvsDpInterfaceExt.h |   68
> ++++++++++++++++++++++++++
>  datapath-windows/ovsext/ovsext.vcxproj       |    3 +-
>  include/automake.mk                          |    3 +
>  include/odp-netlink-ext.h                    |   23 +++++++++
>  5 files changed, 97 insertions(+), 1 deletions(-)  create mode 100644
> datapath-windows/include/OvsDpInterfaceExt.h
>  create mode 100644 include/odp-netlink-ext.h
> 
> diff --git a/datapath-windows/automake.mk b/datapath-
> windows/automake.mk index 6131de0..3fd6692 100644
> --- a/datapath-windows/automake.mk
> +++ b/datapath-windows/automake.mk
> @@ -3,6 +3,7 @@ EXTRA_DIST += \
>       datapath-windows/DESIGN \
>       datapath-windows/Package/package.VcxProj \
>       datapath-windows/Package/package.VcxProj.user \
> +     datapath-windows/include/OvsDpInterfaceExt.h \
>       datapath-windows/include/OvsNetlink.h \
>       datapath-windows/include/OvsPub.h \
>       datapath-windows/misc/install.cmd \
> diff --git a/datapath-windows/include/OvsDpInterfaceExt.h b/datapath-
> windows/include/OvsDpInterfaceExt.h
> new file mode 100644
> index 0000000..f3339e6
> --- /dev/null
> +++ b/datapath-windows/include/OvsDpInterfaceExt.h
> @@ -0,0 +1,68 @@
> +/*
> + * Copyright (c) 2014 VMware, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + *
> https://urldefense.proofpoint.com/v1/url?u=http://www.apache.org/licens
> es/LICENSE-
> 2.0&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=pEkjsHfytvHEWufeZPp
> gqSOJMdMjuZPbesVsNhCUc0E%3D%0A&m=omBZT4QodVa6B%2BwXTfsQEl
> W42Wc%2FuyUrs%2BZxhR%2FVHH0%3D%0A&s=67ea4b6a708e8dc8522d509
> 0cca08bf4be5d7efdf9d48b9f8bfc200fee05326b
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#ifndef __OVS_DP_INTERFACE_EXT_H_
> +#define __OVS_DP_INTERFACE_EXT_H_ 1
> +
> +/* Windows kernel datapath extensions to the standard datapath
> +interface. */
> +
> +/* Name of the device. */
> +#define OVS_DEVICE_NAME_NT     L"\\Device\\OpenVSwitchDevice"
> +#define OVS_DEVICE_NAME_DOS    L"\\DosDevices\\OpenVSwitchDevice"
> +#define OVS_DEVICE_NAME_USER   TEXT("\\\\.\\OpenVSwitchDevice")
> +

Should be "OpenvSwitchDevice".

> +#define OVS_IOCTL_DEVICE_TYPE 45000
> +
> +/* We used Direct I/O (zero copy) for the buffers. */
> +#define OVS_IOCTL_START   0x100
> +#define OVS_IOCTL_READ \
> +    CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x0,
> METHOD_OUT_DIRECT,\
> +              FILE_READ_ACCESS)
> +#define OVS_IOCTL_WRITE \
> +    CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x1,
> METHOD_IN_DIRECT,\
> +              FILE_READ_ACCESS)
> +#define OVS_IOCTL_TRANSACT \
> +    CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x2,
> METHOD_OUT_DIRECT,\
> +              FILE_WRITE_ACCESS)
> +
> +/*
> + * On platforms that support netlink natively, the operating system
> +assigns a
> + * dynamic value to a netlink family when it is registered. In the
> +absense of
> + * such mechanism, defined hard-coded values that are known both to
> +userspace
> + * and kernel.
> + */
> +#define OVS_WIN_NL_INVALID_FAMILY_ID         0
> +#define OVS_WIN_NL_CTRL_FAMILY_ID            1
> +#define OVS_WIN_NL_DATAPATH_FAMILY_ID        2
> +#define OVS_WIN_NL_PACKET_FAMILY_ID          3
> +#define OVS_WIN_NL_VPORT_FAMILY_ID           4
> +#define OVS_WIN_NL_FLOW_FAMILY_ID            5
> +
> +/*
> + * Define a family of netlink command specific to Windows. This is part
> +of the
> + * extensions.
> + */
> +#define OVS_WIN_CONTROL_FAMILY   "ovs_win_control"
> +#define OVS_WIN_CONTROL_MCGROUP  "ovs_win_control"
> +#define OVS_WIN_CONTROL_VERSION  1
> +#define OVS_WIN_CONTROL_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
> +
> +/* Commands available under the OVS_WIN_CONTROL_FAMILY. */ enum
> +ovs_win_control_cmd {
> +    OVS_CTRL_CMD_WIN_GET_PID,
> +};
> +
> +#endif /* __OVS_DP_INTERFACE_EXT_H_ */
> diff --git a/datapath-windows/ovsext/ovsext.vcxproj b/datapath-
> windows/ovsext/ovsext.vcxproj
> index 9728f20..4febef6 100644
> --- a/datapath-windows/ovsext/ovsext.vcxproj
> +++ b/datapath-windows/ovsext/ovsext.vcxproj
> @@ -70,6 +70,7 @@
>      <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
> Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
> />
>    </ImportGroup>
>    <ItemGroup Label="WrappedTaskItems">
> +    <ClInclude Include="..\include\OvsDpInterfaceExt.h" />
>      <ClInclude Include="OvsAtomic.h" />
>      <ClInclude Include="OvsBufferMgmt.h" />
>      <ClInclude Include="OvsChecksum.h" /> @@ -161,4 +162,4 @@
>      <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
>    </ItemGroup>
>    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
> \ No newline at end of file
> +</Project>
> diff --git a/include/automake.mk b/include/automake.mk index
> 55cb353..19c3b43 100644
> --- a/include/automake.mk
> +++ b/include/automake.mk
> @@ -6,6 +6,9 @@ include/odp-netlink.h:
> datapath/linux/compat/include/linux/openvswitch.h \  EXTRA_DIST += build-
> aux/extract-odp-netlink-h  CLEANFILES += include/odp-netlink.h
> 
> +noinst_HEADERS += \
> +     include/odp-netlink-ext.h
> +
>  include include/openflow/automake.mk
>  include include/openvswitch/automake.mk  include
> include/sparse/automake.mk diff --git a/include/odp-netlink-ext.h
> b/include/odp-netlink-ext.h new file mode 100644 index 0000000..847a17b
> --- /dev/null
> +++ b/include/odp-netlink-ext.h
> @@ -0,0 +1,23 @@
> +/*
> + * Copyright (c) 2014 VMware, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + *
> https://urldefense.proofpoint.com/v1/url?u=http://www.apache.org/licens
> es/LICENSE-
> 2.0&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=pEkjsHfytvHEWufeZPp
> gqSOJMdMjuZPbesVsNhCUc0E%3D%0A&m=omBZT4QodVa6B%2BwXTfsQEl
> W42Wc%2FuyUrs%2BZxhR%2FVHH0%3D%0A&s=67ea4b6a708e8dc8522d509
> 0cca08bf4be5d7efdf9d48b9f8bfc200fee05326b
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +/*
> + * Header file to include platform-specific extensions to the standard
> + * datapath interface defined in odp-netlink.h.
> + */
> +#ifdef _WIN32
> +#include "OvsDpInterfaceExt.h"
> +#endif

Since we define & control the dp interface, why not just include 
OvsDpInterfaceExt.h directly? (Just like what we used to do earlier by 
including OvsPub.h.)

> --
> 1.7.4.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailm
> an/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=pEkjsHfytv
> HEWufeZPpgqSOJMdMjuZPbesVsNhCUc0E%3D%0A&m=omBZT4QodVa6B%
> 2BwXTfsQElW42Wc%2FuyUrs%2BZxhR%2FVHH0%3D%0A&s=6457c6d8230ec7
> c56cb258407c46f4b918150b1b5b09a50cff8bd5d158e690d9
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to