[dpdk-dev,v1,1/3] net/hyperv: introduce MS Hyper-V platform driver

Message ID 20171218162443.12971-2-adrien.mazarguil@6wind.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Adrien Mazarguil Dec. 18, 2017, 4:46 p.m. UTC
  This patch lays the groundwork for this PMD (draft documentation, copyright
notices, code base skeleton and build system hooks). While it can be
successfully compiled and invoked, it's an empty shell at this stage.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 MAINTAINERS                                   |   6 +
 config/common_base                            |   6 +
 config/common_linuxapp                        |   1 +
 doc/guides/nics/features/hyperv.ini           |  12 ++
 doc/guides/nics/hyperv.rst                    |  49 ++++++++
 doc/guides/nics/index.rst                     |   1 +
 drivers/net/Makefile                          |   1 +
 drivers/net/hyperv/Makefile                   |  54 +++++++++
 drivers/net/hyperv/hyperv.c                   | 135 +++++++++++++++++++++
 drivers/net/hyperv/rte_pmd_hyperv_version.map |   4 +
 mk/rte.app.mk                                 |   1 +
 11 files changed, 270 insertions(+)
  

Comments

Stephen Hemminger Dec. 18, 2017, 6:28 p.m. UTC | #1
On Mon, 18 Dec 2017 17:46:21 +0100
Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:

> +#ifdef RTE_LIBRTE_HYPERV_DEBUG
> +
> +#define PMD_DRV_LOG(level, ...) \
> +	RTE_LOG(level, PMD, \
> +		RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> +			strrchr("/" __FILE__, '/') + 1, \
> +			__LINE__, \
> +			__func__, \
> +			RTE_FMT_TAIL(__VA_ARGS__,)))
> +
> +#else /* RTE_LIBRTE_HYPERV_DEBUG */
> +
> +#define PMD_DRV_LOG(level, ...) \
> +	RTE_LOG(level, PMD, \
> +		RTE_FMT(RTE_STR(HYPERV_DRIVER) ": " \
> +			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> +		RTE_FMT_TAIL(__VA_ARGS__,)))
> +
> +#endif /* RTE_LIBRTE_HYPERV_DEBUG */
> +
> +#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> +#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> +#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> +#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> +

Please don't use DEBUG() etc macros. It makes it easier for tools that do
global updates or scans if all drivers use the same model of PMD_DRV_LOG
  
Thomas Monjalon Dec. 18, 2017, 7:54 p.m. UTC | #2
18/12/2017 19:28, Stephen Hemminger:
> On Mon, 18 Dec 2017 17:46:21 +0100
> Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> 
> > +#ifdef RTE_LIBRTE_HYPERV_DEBUG
> > +
> > +#define PMD_DRV_LOG(level, ...) \
> > +	RTE_LOG(level, PMD, \
> > +		RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> > +			strrchr("/" __FILE__, '/') + 1, \
> > +			__LINE__, \
> > +			__func__, \
> > +			RTE_FMT_TAIL(__VA_ARGS__,)))
> > +
> > +#else /* RTE_LIBRTE_HYPERV_DEBUG */
> > +
> > +#define PMD_DRV_LOG(level, ...) \
> > +	RTE_LOG(level, PMD, \
> > +		RTE_FMT(RTE_STR(HYPERV_DRIVER) ": " \
> > +			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> > +		RTE_FMT_TAIL(__VA_ARGS__,)))
> > +
> > +#endif /* RTE_LIBRTE_HYPERV_DEBUG */
> > +
> > +#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> > +#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> > +#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> > +#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> > +
> 
> Please don't use DEBUG() etc macros. It makes it easier for tools that do
> global updates or scans if all drivers use the same model of PMD_DRV_LOG

The new standard is to use dynamic logtype.
  
Stephen Hemminger Dec. 18, 2017, 9:17 p.m. UTC | #3
On Mon, 18 Dec 2017 20:54:16 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> > > +#endif /* RTE_LIBRTE_HYPERV_DEBUG */
> > > +
> > > +#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> > > +#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> > > +#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> > > +#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> > > +  
> > 
> > Please don't use DEBUG() etc macros. It makes it easier for tools that do
> > global updates or scans if all drivers use the same model of PMD_DRV_LOG  
> 
> The new standard is to use dynamic logtype.

Agree, please use dynamic logging, and also don't redefine new macros like DEBUG/INFO/WARN/ERROR.
Instead use PMD_DRV_LOG or equivalent macros.

The base rule here is that all drivers should look the same as much
as reasonably possible. This makes reviewers of other subsystems more likely
to see problems. It also allows for later changes where some developer does a global
improvement across many PMD's.

Drivers should not be snowflakes, each one is not unique.
  
Adrien Mazarguil Dec. 19, 2017, 10:01 a.m. UTC | #4
On Mon, Dec 18, 2017 at 01:17:51PM -0800, Stephen Hemminger wrote:
> On Mon, 18 Dec 2017 20:54:16 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > > > +#endif /* RTE_LIBRTE_HYPERV_DEBUG */
> > > > +
> > > > +#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> > > > +#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> > > > +#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> > > > +#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> > > > +  
> > > 
> > > Please don't use DEBUG() etc macros. It makes it easier for tools that do
> > > global updates or scans if all drivers use the same model of PMD_DRV_LOG  
> > 
> > The new standard is to use dynamic logtype.
> 
> Agree, please use dynamic logging, and also don't redefine new macros like DEBUG/INFO/WARN/ERROR.
> Instead use PMD_DRV_LOG or equivalent macros.

Wait, the above definitions are only convenience wrappers to PMD_DRV_LOG(),
itself a wrapper to RTE_LOG(), itself a wrapper to rte_log(), their presence
is not triggered according to compilation options, did I miss something?

Let me bring back some context from the original patch:

 #ifdef RTE_LIBRTE_HYPERV_DEBUG

 #define PMD_DRV_LOG(level, ...) \
 	RTE_LOG(level, PMD, \
 		RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 			strrchr("/" __FILE__, '/') + 1, \
 			__LINE__, \
 			__func__, \
 			RTE_FMT_TAIL(__VA_ARGS__,)))

 #else /* RTE_LIBRTE_HYPERV_DEBUG */

 #define PMD_DRV_LOG(level, ...) \
 	RTE_LOG(level, PMD, \
 		RTE_FMT(RTE_STR(HYPERV_DRIVER) ": " \
 			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__,)))

 #endif /* RTE_LIBRTE_HYPERV_DEBUG */

 #define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
 #define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
 #define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
 #define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)

Enabling RTE_LIBRTE_HYPERV_DEBUG adds file and line information to log
output, messages are otherwise unaffected by that compilation option. Adding
this information required some sort of wrapper to avoid needless clutter.

Nothing against outputting file/line information when compiled in debug mode
right?

> The base rule here is that all drivers should look the same as much
> as reasonably possible. This makes reviewers of other subsystems more likely
> to see problems. It also allows for later changes where some developer does a global
> improvement across many PMD's.
> 
> Drivers should not be snowflakes, each one is not unique.

Point taken, do you confirm replacing i.e. WARN(...) with
PMD_DRV_LOG(WARN, ...) and friends is all that's needed?
  
Thomas Monjalon Dec. 19, 2017, 11:15 a.m. UTC | #5
19/12/2017 11:01, Adrien Mazarguil:
> On Mon, Dec 18, 2017 at 01:17:51PM -0800, Stephen Hemminger wrote:
> > On Mon, 18 Dec 2017 20:54:16 +0100
> > Thomas Monjalon <thomas@monjalon.net> wrote:
> > 
> > > > > +#endif /* RTE_LIBRTE_HYPERV_DEBUG */
> > > > > +
> > > > > +#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> > > > > +#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> > > > > +#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> > > > > +#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> > > > > +  
> > > > 
> > > > Please don't use DEBUG() etc macros. It makes it easier for tools that do
> > > > global updates or scans if all drivers use the same model of PMD_DRV_LOG  
> > > 
> > > The new standard is to use dynamic logtype.
> > 
> > Agree, please use dynamic logging, and also don't redefine new macros like DEBUG/INFO/WARN/ERROR.
> > Instead use PMD_DRV_LOG or equivalent macros.
> 
> Wait, the above definitions are only convenience wrappers to PMD_DRV_LOG(),
> itself a wrapper to RTE_LOG(), itself a wrapper to rte_log(), their presence
> is not triggered according to compilation options, did I miss something?
> 
> Let me bring back some context from the original patch:
> 
>  #ifdef RTE_LIBRTE_HYPERV_DEBUG
> 
>  #define PMD_DRV_LOG(level, ...) \
>  	RTE_LOG(level, PMD, \
>  		RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
>  			strrchr("/" __FILE__, '/') + 1, \
>  			__LINE__, \
>  			__func__, \
>  			RTE_FMT_TAIL(__VA_ARGS__,)))
> 
>  #else /* RTE_LIBRTE_HYPERV_DEBUG */
> 
>  #define PMD_DRV_LOG(level, ...) \
>  	RTE_LOG(level, PMD, \
>  		RTE_FMT(RTE_STR(HYPERV_DRIVER) ": " \
>  			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
>  		RTE_FMT_TAIL(__VA_ARGS__,)))
> 
>  #endif /* RTE_LIBRTE_HYPERV_DEBUG */
> 
>  #define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
>  #define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
>  #define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
>  #define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> 
> Enabling RTE_LIBRTE_HYPERV_DEBUG adds file and line information to log
> output, messages are otherwise unaffected by that compilation option. Adding
> this information required some sort of wrapper to avoid needless clutter.
> 
> Nothing against outputting file/line information when compiled in debug mode
> right?

I am not sure __FILE__, __LINE__ and __func__ are so much useful.
The log message should be unique enough.

> > The base rule here is that all drivers should look the same as much
> > as reasonably possible. This makes reviewers of other subsystems more likely
> > to see problems. It also allows for later changes where some developer does a global
> > improvement across many PMD's.
> > 
> > Drivers should not be snowflakes, each one is not unique.
> 
> Point taken, do you confirm replacing i.e. WARN(...) with
> PMD_DRV_LOG(WARN, ...) and friends is all that's needed?

You need to remove the compile-time option for DEBUG,
and rely on dynamic log type, thanks to rte_log_register().
  
Adrien Mazarguil Dec. 19, 2017, 1:13 p.m. UTC | #6
On Tue, Dec 19, 2017 at 12:15:38PM +0100, Thomas Monjalon wrote:
> 19/12/2017 11:01, Adrien Mazarguil:
> > On Mon, Dec 18, 2017 at 01:17:51PM -0800, Stephen Hemminger wrote:
> > > On Mon, 18 Dec 2017 20:54:16 +0100
> > > Thomas Monjalon <thomas@monjalon.net> wrote:
> > > 
> > > > > > +#endif /* RTE_LIBRTE_HYPERV_DEBUG */
> > > > > > +
> > > > > > +#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> > > > > > +#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> > > > > > +#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> > > > > > +#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> > > > > > +  
> > > > > 
> > > > > Please don't use DEBUG() etc macros. It makes it easier for tools that do
> > > > > global updates or scans if all drivers use the same model of PMD_DRV_LOG  
> > > > 
> > > > The new standard is to use dynamic logtype.
> > > 
> > > Agree, please use dynamic logging, and also don't redefine new macros like DEBUG/INFO/WARN/ERROR.
> > > Instead use PMD_DRV_LOG or equivalent macros.
> > 
> > Wait, the above definitions are only convenience wrappers to PMD_DRV_LOG(),
> > itself a wrapper to RTE_LOG(), itself a wrapper to rte_log(), their presence
> > is not triggered according to compilation options, did I miss something?
> > 
> > Let me bring back some context from the original patch:
> > 
> >  #ifdef RTE_LIBRTE_HYPERV_DEBUG
> > 
> >  #define PMD_DRV_LOG(level, ...) \
> >  	RTE_LOG(level, PMD, \
> >  		RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> >  			strrchr("/" __FILE__, '/') + 1, \
> >  			__LINE__, \
> >  			__func__, \
> >  			RTE_FMT_TAIL(__VA_ARGS__,)))
> > 
> >  #else /* RTE_LIBRTE_HYPERV_DEBUG */
> > 
> >  #define PMD_DRV_LOG(level, ...) \
> >  	RTE_LOG(level, PMD, \
> >  		RTE_FMT(RTE_STR(HYPERV_DRIVER) ": " \
> >  			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> >  		RTE_FMT_TAIL(__VA_ARGS__,)))
> > 
> >  #endif /* RTE_LIBRTE_HYPERV_DEBUG */
> > 
> >  #define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
> >  #define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
> >  #define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
> >  #define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
> > 
> > Enabling RTE_LIBRTE_HYPERV_DEBUG adds file and line information to log
> > output, messages are otherwise unaffected by that compilation option. Adding
> > this information required some sort of wrapper to avoid needless clutter.
> > 
> > Nothing against outputting file/line information when compiled in debug mode
> > right?
> 
> I am not sure __FILE__, __LINE__ and __func__ are so much useful.
> The log message should be unique enough.

I don't share your opinion. mlx4/mlx5 PMDs output similar information when
compiled in debug mode and that proved quite useful during development and
when tracking down bugs.

Thing is, mere users are not the target audience, it's a development tool
that doesn't need to be part of distributed binaries, hence the compilation
option.

> > > The base rule here is that all drivers should look the same as much
> > > as reasonably possible. This makes reviewers of other subsystems more likely
> > > to see problems. It also allows for later changes where some developer does a global
> > > improvement across many PMD's.
> > > 
> > > Drivers should not be snowflakes, each one is not unique.
> > 
> > Point taken, do you confirm replacing i.e. WARN(...) with
> > PMD_DRV_LOG(WARN, ...) and friends is all that's needed?
> 
> You need to remove the compile-time option for DEBUG,
> and rely on dynamic log type, thanks to rte_log_register().

OK, I didn't know about rte_log_register() which may explain some of the
confusion, I'll add it in v2 then.

To summarize what needs to be done for v2:

- Call rte_log_register() during init.
- Use its return value in place of the second argument to RTE_LOG().
- Replace DEBUG/WARN/INFO/ERROR() wrappers with direct calls to
  PMD_DRV_LOG() for consistency with other PMDs.
- Finally, remove debugging code/information and related compilation option
  since they're useless to end users.
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 5a63b40c2..fe686f4c5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -451,6 +451,12 @@  F: drivers/net/mrvl/
 F: doc/guides/nics/mrvl.rst
 F: doc/guides/nics/features/mrvl.ini
 
+Microsoft hyperv
+M: Adrien Mazarguil <adrien.mazarguil@6wind.com>
+F: drivers/net/hyperv/
+F: doc/guides/nics/hyperv.rst
+F: doc/guides/nics/features/hyperv.ini
+
 Netcope szedata2
 M: Matej Vido <vido@cesnet.cz>
 F: drivers/net/szedata2/
diff --git a/config/common_base b/config/common_base
index b8ee8f91c..8bc83c8c9 100644
--- a/config/common_base
+++ b/config/common_base
@@ -280,6 +280,12 @@  CONFIG_RTE_LIBRTE_NFP_DEBUG=n
 CONFIG_RTE_LIBRTE_MRVL_PMD=n
 
 #
+# Compile Microsoft Hyper-V/Azure driver
+#
+CONFIG_RTE_LIBRTE_HYPERV_PMD=n
+CONFIG_RTE_LIBRTE_HYPERV_DEBUG=n
+
+#
 # Compile burst-oriented Broadcom BNXT PMD driver
 #
 CONFIG_RTE_LIBRTE_BNXT_PMD=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 74c7d64ec..fac6cb172 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -47,6 +47,7 @@  CONFIG_RTE_LIBRTE_PMD_VHOST=y
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_PMD_TAP=y
 CONFIG_RTE_LIBRTE_AVP_PMD=y
+CONFIG_RTE_LIBRTE_HYPERV_PMD=y
 CONFIG_RTE_LIBRTE_NFP_PMD=y
 CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
diff --git a/doc/guides/nics/features/hyperv.ini b/doc/guides/nics/features/hyperv.ini
new file mode 100644
index 000000000..170912c25
--- /dev/null
+++ b/doc/guides/nics/features/hyperv.ini
@@ -0,0 +1,12 @@ 
+;
+; Supported features of the 'hyperv' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+ARMv7                = Y
+ARMv8                = Y
+Power8               = Y
+x86-32               = Y
+x86-64               = Y
+Usage doc            = Y
diff --git a/doc/guides/nics/hyperv.rst b/doc/guides/nics/hyperv.rst
new file mode 100644
index 000000000..28c4443d6
--- /dev/null
+++ b/doc/guides/nics/hyperv.rst
@@ -0,0 +1,49 @@ 
+..  BSD LICENSE
+    Copyright 2017 6WIND S.A.
+    Copyright 2017 Mellanox
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+    * Neither the name of 6WIND S.A. nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+HYPERV poll mode driver
+=======================
+
+The HYPERV PMD (librte_pmd_hyperv) provides support for NetVSC interfaces
+and associated SR-IOV virtual function (VF) devices found in Linux virtual
+machines running on Microsoft Hyper-V_ (including Azure) platforms.
+
+.. _Hyper-V: https://docs.microsoft.com/en-us/windows-hardware/drivers/network/overview-of-hyper-v
+
+Build options
+-------------
+
+- ``CONFIG_RTE_LIBRTE_HYPERV_PMD`` (default ``y``)
+
+   Toggle compilation of this driver.
+
+- ``CONFIG_RTE_LIBRTE_HYPERV_DEBUG`` (default ``n``)
+
+   Toggle additional debugging code.
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 23babe933..9d66353a1 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -49,6 +49,7 @@  Network Interface Controller Drivers
     ena
     enic
     fm10k
+    hyperv
     i40e
     ixgbe
     intel_vf
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index ef09b4e16..5bcc37cb3 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -55,6 +55,7 @@  DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
 DIRS-$(CONFIG_RTE_LIBRTE_MRVL_PMD) += mrvl
+DIRS-$(CONFIG_RTE_LIBRTE_HYPERV_PMD) += hyperv
 DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
 DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
diff --git a/drivers/net/hyperv/Makefile b/drivers/net/hyperv/Makefile
new file mode 100644
index 000000000..82c720353
--- /dev/null
+++ b/drivers/net/hyperv/Makefile
@@ -0,0 +1,54 @@ 
+#   BSD LICENSE
+#
+#   Copyright 2017 6WIND S.A.
+#   Copyright 2017 Mellanox
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of 6WIND S.A. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# Properties of the generated library.
+LIB = librte_pmd_hyperv.a
+LIBABIVER := 1
+EXPORT_MAP := rte_pmd_hyperv_version.map
+
+# Additional compilation flags.
+CFLAGS += -O3
+CFLAGS += -g
+CFLAGS += -std=c11 -pedantic -Wall -Wextra
+CFLAGS += $(WERROR_FLAGS)
+
+# Dependencies.
+LDLIBS += -lrte_bus_vdev
+LDLIBS += -lrte_eal
+LDLIBS += -lrte_ethdev
+LDLIBS += -lrte_kvargs
+
+# Source files.
+SRCS-$(CONFIG_RTE_LIBRTE_HYPERV_PMD) += hyperv.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/hyperv/hyperv.c b/drivers/net/hyperv/hyperv.c
new file mode 100644
index 000000000..2f940c76f
--- /dev/null
+++ b/drivers/net/hyperv/hyperv.c
@@ -0,0 +1,135 @@ 
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright 2017 6WIND S.A.
+ *   Copyright 2017 Mellanox
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of 6WIND S.A. nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stddef.h>
+#include <string.h>
+
+#include <rte_bus_vdev.h>
+#include <rte_config.h>
+#include <rte_kvargs.h>
+#include <rte_log.h>
+
+#define HYPERV_DRIVER net_hyperv
+#define HYPERV_ARG_IFACE "iface"
+#define HYPERV_ARG_MAC "mac"
+
+#ifdef RTE_LIBRTE_HYPERV_DEBUG
+
+#define PMD_DRV_LOG(level, ...) \
+	RTE_LOG(level, PMD, \
+		RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			strrchr("/" __FILE__, '/') + 1, \
+			__LINE__, \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#else /* RTE_LIBRTE_HYPERV_DEBUG */
+
+#define PMD_DRV_LOG(level, ...) \
+	RTE_LOG(level, PMD, \
+		RTE_FMT(RTE_STR(HYPERV_DRIVER) ": " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#endif /* RTE_LIBRTE_HYPERV_DEBUG */
+
+#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
+#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
+#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
+#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)
+
+/** Number of PMD instances relying on context list. */
+static unsigned int hyperv_ctx_inst;
+
+/**
+ * Probe NetVSC interfaces.
+ *
+ * @param dev
+ *   Virtual device context for PMD instance.
+ *
+ * @return
+ *    Always 0, even in case of errors.
+ */
+static int
+hyperv_vdev_probe(struct rte_vdev_device *dev)
+{
+	static const char *const hyperv_arg[] = {
+		HYPERV_ARG_IFACE,
+		HYPERV_ARG_MAC,
+		NULL,
+	};
+	const char *name = rte_vdev_device_name(dev);
+	const char *args = rte_vdev_device_args(dev);
+	struct rte_kvargs *kvargs = rte_kvargs_parse(args ? args : "",
+						     hyperv_arg);
+
+	DEBUG("invoked as \"%s\", using arguments \"%s\"", name, args);
+	if (!kvargs) {
+		ERROR("cannot parse arguments list");
+		goto error;
+	}
+error:
+	if (kvargs)
+		rte_kvargs_free(kvargs);
+	++hyperv_ctx_inst;
+	return 0;
+}
+
+/**
+ * Remove PMD instance.
+ *
+ * @param dev
+ *   Virtual device context for PMD instance.
+ *
+ * @return
+ *   Always 0.
+ */
+static int
+hyperv_vdev_remove(struct rte_vdev_device *dev)
+{
+	(void)dev;
+	--hyperv_ctx_inst;
+	return 0;
+}
+
+/** Virtual device descriptor. */
+static struct rte_vdev_driver hyperv_vdev = {
+	.probe = hyperv_vdev_probe,
+	.remove = hyperv_vdev_remove,
+};
+
+RTE_PMD_REGISTER_VDEV(HYPERV_DRIVER, hyperv_vdev);
+RTE_PMD_REGISTER_ALIAS(HYPERV_DRIVER, eth_hyperv);
+RTE_PMD_REGISTER_PARAM_STRING(net_hyperv,
+			      HYPERV_ARG_IFACE "=<string> "
+			      HYPERV_ARG_MAC "=<string>");
diff --git a/drivers/net/hyperv/rte_pmd_hyperv_version.map b/drivers/net/hyperv/rte_pmd_hyperv_version.map
new file mode 100644
index 000000000..179140fb8
--- /dev/null
+++ b/drivers/net/hyperv/rte_pmd_hyperv_version.map
@@ -0,0 +1,4 @@ 
+DPDK_18.02 {
+
+	local: *;
+};
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 6a6a7452e..b0701c49f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -134,6 +134,7 @@  _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)      += -lrte_pmd_e1000
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD)        += -lrte_pmd_ena
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)       += -lrte_pmd_enic
 _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)      += -lrte_pmd_fm10k
+_LDLIBS-$(CONFIG_RTE_LIBRTE_HYPERV_PMD)     += -lrte_pmd_hyperv
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE)   += -lrte_pmd_failsafe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)       += -lrte_pmd_i40e
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)      += -lrte_pmd_ixgbe