From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10077.outbound.protection.outlook.com [40.107.1.77]) by dpdk.org (Postfix) with ESMTP id BF1651B300 for ; Thu, 18 Jan 2018 14:52:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BALlpME9x76DVSmQRGaCp9GZzJSE5jtNyUhZhP7Kwoc=; b=dpZREVfqB3OijpfWkVZgxyeVvGhYP9G2XjVAsJ0+4N3N4+EsyOqLnIxTAlbU5Y3ipxNTBgZB0RbM//XWaFm5NdVr8kuDks4ir/QP9LFjFesN6SydIA5VWk3tWvy6FwCyqzOnlf6MDpoCiVSuJlK1br3Fj3PNoSJQmTA5OWkA8kY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3798.eurprd05.prod.outlook.com (2603:10a6:209:a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 13:52:01 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Thu, 18 Jan 2018 13:51:42 +0000 Message-Id: <1516283506-21198-5-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516283506-21198-1-git-send-email-matan@mellanox.com> References: <1516269709-15252-1-git-send-email-matan@mellanox.com> <1516283506-21198-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0115.eurprd08.prod.outlook.com (2603:10a6:800:d4::17) To AM6PR0502MB3798.eurprd05.prod.outlook.com (2603:10a6:209:a::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e77db2d9-45be-423d-2fd8-08d55e7aa6a5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3798; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3798; 3:PX3pMwEfxg80OLsYP2CUslyxk+oGBlYP+IRKJR3XjAtWK7m9pNN68gevYK3rnTBiPHzC1m3GFyXWE27YgGF1Cn/OEZIVYk6ITU/TWeHSx15crHvRULi9h45XwzrljKB3crotAFS6pM6BSx5os6lP+BOJzzPyru1g7UCB24WbzxQysqchTpv9jYrk1+dc4trxqsZkEUzQNL5l7X4JRvSQa2ntCMbhal6ycTJ2/Cq1ac3jg0xAGr8aZdkIC3I5cDv+; 25:n9E1DAvFOSl1MGojfhecc0l74CQz0jYXh8mCYJDI1kDXg0dN2OMc3nelI/Qs9so3/bVhuEGGsU/fMSJUG4Q6Dfacec+Fn6QAcZ/hGz6tCATm+ppWla6NDoNYDGyg4eDnN8qjgLV6m36Wl4gLGhiqqWi9brIZmu8ocJ3dRGpfRqn+/BNShCWMoOIq38ss48dxox5CPHBUw5RfiPyJeigSzIUHIYivJP3xPgrtIabYNdFxzqhTlzD3T997tjmAyWSYEVjMTneAw8k39a5UBNeT+2vEnUbntGOdUF6+o7jg1HBDrBMha4elZDkZDb7b+40wIPpDyMJzInM3Ssj8x2mzZg==; 31:jdMDUZJ3gAdWgXdTmTF8vdd5g0eCtkEhF2Yb0CZnj4i4PjD8TDll4bHex3jhSmH5hd48NylpfJ7dz6Uw8MDXkJkWL+n1bwRFcrrAVc+8l+A2m81g0hcrVkQY5/O9V1kHi5dEjQo2dg9m6WplODNUo6W9O+zVsISslCMHEZxV8BpDQzIfjaiSltuGXT0MpBm1mW3kexdcj17utYSHbqQthBBdQwRqkguDdoCuhD+oFKA= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3798: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3798; 20:qpvblMalNtKKxTOP5padTGbriChgQ+7j48gPk3OXwE7VRzs/ffhBbGiI8Z/0KZwaUIJaxkmCOvmXdSJaG3mBbWSno9fwyCyKKDuprgEk+q53ux3xks5ejIGR/zuwavVMtBK/Zp4S5RSpxw0riCuSFlIj6SmMdGugMspsCZ7q41LOOCrn0ocXJHhbX/7aPXnYkHv1tQ+a4d7K/eMRD85SY8HMVPishXe4OXWB4lgMIlUfZ9D9WwTKM2Wah3VOkcRarmki1FazEX3xkD1fyC3RaErrCc8Z3qrULIXSzis6ryOJofH1PY2adjCsihlcBhsooRyPl7RrqFt1M/WLJoPDe5c7lHU5et2xotLTMHI2TP7BLZi9hNIhIBWi00eIkY1uar8vifosoKCHNwgE6yVoxa9yD/ltL8Rls5Cmaqa+ay0QSwpCPFIKG6kw69oJl5TfZAI3LnLx9bUJ/nPSw2ojKDGLlrV1CyWX9Bexb4neGzwKxhu8q/TaJ/fzYg0qz+9h; 4:SFbOFvFpUuQdL44TSug8HMUOtBNt17De8CCfA0BwEZRQa+THd2lSfyyrKY4b5NafNyP6f0E1gQp0PzOzcAwsvgTjlgFaXQwr65DZAhqf+e/uPJ/Isna1wialIDEFIacq6eONkpFwIp4WK7ibl9CFqM6xWHve0hrWtmkrMxtIl7qZPQE95zZ072fPGRf7iw9siO6H9jd/B2vJXlUqLyqZbIJM79evmB3xsXxVP+NYxuoL2bAdFZI6QsTj+Q57dZ2CSxeK+9ZPHum0dLCksVm1d0dcwAh+V5nKRKh57F32lNtyp2cNTwSqjAt5xjDa4zDzV9Qoaeg/IMoA5kvPYYbiMCZ3k28yOQTrd9azpExepF0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(28532068793085)(66839620246622); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231023)(2232001)(2102002)(944501161)(93006095)(93001095)(6055026)(6041268)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM6PR0502MB3798; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3798; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39380400002)(39860400002)(376002)(199004)(189003)(386003)(2906002)(51416003)(81156014)(81166006)(5660300001)(305945005)(4326008)(21086003)(7696005)(106356001)(8676002)(68736007)(26005)(69596002)(6306002)(76176011)(59450400001)(105586002)(86362001)(97736004)(3846002)(6116002)(52116002)(53936002)(6666003)(50226002)(55016002)(4720700003)(33026002)(7736002)(2950100002)(36756003)(47776003)(45080400002)(478600001)(16526018)(8936002)(66066001)(316002)(966005)(110136005)(48376002)(50466002)(16586007)(25786009)(50929007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3798; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR0502MB3798; 23:rthiO5oxPQa9/hgr+divq4o6Fe+LRjJg2s5ya/U?= =?us-ascii?Q?qyOG+J975iiOjBKQDDbtJrKZNabHluwCLJEKW6Z4PME2PYMc750PZ1qxAyFu?= =?us-ascii?Q?1UzGUa0j1DsH1o7fy9O8cZSwCDQ52qYhLOHeGzVEmcS04FdO8Nxope3W5eeb?= =?us-ascii?Q?D5dmReLQxCJJmzzDyv41GxY6zGAh3aH10zaahAzBh0t1WYkh4s6ot513Cmdm?= =?us-ascii?Q?CHLZnYw9Q9R/XrAWxl4BvSPV/nDIm1sH//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QQpItqUtVBNlF1web1GTTDR40DXRHjtq9REg4oUZV66i64Q1H6PeR84PEg8a5UzMY4ips9NySkhYIN0IlISjWa5ealAIZJIrO2cjoKf8V94aKxKlRBAd5mGcNxkKJKeUKjvxwbRlm7ayDjeV1s8eAzEWUlD+CjCRdAEINcoO8RTRfb1fspgRr0RWIzCA8Oo8D/nTA4hYc0pmQWt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 13:52:01.0470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e77db2d9-45be-423d-2fd8-08d55e7aa6a5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3798 Subject: [dpdk-dev] [PATCH v6 4/8] net/vdev_netvsc: introduce Hyper-V platform driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jan 2018 13:52:03 -0000 This patch lays the groundwork for this driver (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 Signed-off-by: Matan Azrad --- MAINTAINERS | 6 ++ config/common_base | 5 ++ config/common_linuxapp | 1 + doc/guides/nics/features/vdev_netvsc.ini | 12 +++ doc/guides/nics/index.rst | 1 + doc/guides/nics/vdev_netvsc.rst | 20 +++++ drivers/net/Makefile | 1 + drivers/net/vdev_netvsc/Makefile | 27 ++++++ .../vdev_netvsc/rte_pmd_vdev_netvsc_version.map | 4 + drivers/net/vdev_netvsc/vdev_netvsc.c | 99 ++++++++++++++++++++++ mk/rte.app.mk | 1 + 11 files changed, 177 insertions(+) create mode 100644 doc/guides/nics/features/vdev_netvsc.ini create mode 100644 doc/guides/nics/vdev_netvsc.rst create mode 100644 drivers/net/vdev_netvsc/Makefile create mode 100644 drivers/net/vdev_netvsc/rte_pmd_vdev_netvsc_version.map create mode 100644 drivers/net/vdev_netvsc/vdev_netvsc.c diff --git a/MAINTAINERS b/MAINTAINERS index af8de4f..97efbb9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -462,6 +462,12 @@ F: drivers/net/mrvl/ F: doc/guides/nics/mrvl.rst F: doc/guides/nics/features/mrvl.ini +Microsoft vdev-netvsc - EXPERIMENTAL +M: Matan Azrad +F: drivers/net/vdev-netvsc/ +F: doc/guides/nics/vdev-netvsc.rst +F: doc/guides/nics/features/vdev-netvsc.ini + Netcope szedata2 M: Matej Vido F: drivers/net/szedata2/ diff --git a/config/common_base b/config/common_base index 90508a8..664ff21 100644 --- a/config/common_base +++ b/config/common_base @@ -279,6 +279,11 @@ CONFIG_RTE_LIBRTE_NFP_DEBUG_RX=n CONFIG_RTE_LIBRTE_MRVL_PMD=n # +# Compile virtual device driver for NetVSC on Hyper-V/Azure +# +CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD=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 74c7d64..e043262 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_VDEV_NETVSC_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/vdev_netvsc.ini b/doc/guides/nics/features/vdev_netvsc.ini new file mode 100644 index 0000000..cfc5cb9 --- /dev/null +++ b/doc/guides/nics/features/vdev_netvsc.ini @@ -0,0 +1,12 @@ +; +; Supported features of the 'vdev_netvsc' 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/index.rst b/doc/guides/nics/index.rst index 23babe9..5666046 100644 --- a/doc/guides/nics/index.rst +++ b/doc/guides/nics/index.rst @@ -64,6 +64,7 @@ Network Interface Controller Drivers szedata2 tap thunderx + vdev_netvsc virtio vhost vmxnet3 diff --git a/doc/guides/nics/vdev_netvsc.rst b/doc/guides/nics/vdev_netvsc.rst new file mode 100644 index 0000000..a952908 --- /dev/null +++ b/doc/guides/nics/vdev_netvsc.rst @@ -0,0 +1,20 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2017 6WIND S.A. + Copyright 2017 Mellanox Technologies, Ltd. + +VDEV_NETVSC driver +================== + +The VDEV_NETVSC driver (librte_pmd_vdev_netvsc) 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_VDEV_NETVSC_PMD`` (default ``y``) + + Toggle compilation of this driver. diff --git a/drivers/net/Makefile b/drivers/net/Makefile index c2fd7f5..e112732 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -39,6 +39,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2 DIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx +DIRS-$(CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD) += vdev_netvsc DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 diff --git a/drivers/net/vdev_netvsc/Makefile b/drivers/net/vdev_netvsc/Makefile new file mode 100644 index 0000000..2fb059d --- /dev/null +++ b/drivers/net/vdev_netvsc/Makefile @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2017 6WIND S.A. +# Copyright 2017 Mellanox Technologies, Ltd. + +include $(RTE_SDK)/mk/rte.vars.mk + +# Properties of the generated library. +LIB = librte_pmd_vdev_netvsc.a +LIBABIVER := 1 +EXPORT_MAP := rte_pmd_vdev_netvsc_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_VDEV_NETVSC_PMD) += vdev_netvsc.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/vdev_netvsc/rte_pmd_vdev_netvsc_version.map b/drivers/net/vdev_netvsc/rte_pmd_vdev_netvsc_version.map new file mode 100644 index 0000000..179140f --- /dev/null +++ b/drivers/net/vdev_netvsc/rte_pmd_vdev_netvsc_version.map @@ -0,0 +1,4 @@ +DPDK_18.02 { + + local: *; +}; diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c new file mode 100644 index 0000000..e895b32 --- /dev/null +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -0,0 +1,99 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017 6WIND S.A. + * Copyright 2017 Mellanox Technologies, Ltd. + */ + +#include + +#include +#include +#include +#include +#include + +#define VDEV_NETVSC_DRIVER net_vdev_netvsc +#define VDEV_NETVSC_ARG_IFACE "iface" +#define VDEV_NETVSC_ARG_MAC "mac" + +#define DRV_LOG(level, ...) \ + rte_log(RTE_LOG_ ## level, \ + vdev_netvsc_logtype, \ + RTE_FMT(RTE_STR(VDEV_NETVSC_DRIVER) ": " \ + RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_FMT_TAIL(__VA_ARGS__,))) + +/** Driver-specific log messages type. */ +static int vdev_netvsc_logtype; + +/** Number of driver instances relying on context list. */ +static unsigned int vdev_netvsc_ctx_inst; + +/** + * Probe NetVSC interfaces. + * + * @param dev + * Virtual device context for driver instance. + * + * @return + * Always 0, even in case of errors. + */ +static int +vdev_netvsc_vdev_probe(struct rte_vdev_device *dev) +{ + static const char *const vdev_netvsc_arg[] = { + VDEV_NETVSC_ARG_IFACE, + VDEV_NETVSC_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 : "", + vdev_netvsc_arg); + + DRV_LOG(DEBUG, "invoked as \"%s\", using arguments \"%s\"", name, args); + if (!kvargs) { + DRV_LOG(ERR, "cannot parse arguments list"); + goto error; + } +error: + if (kvargs) + rte_kvargs_free(kvargs); + ++vdev_netvsc_ctx_inst; + return 0; +} + +/** + * Remove driver instance. + * + * @param dev + * Virtual device context for driver instance. + * + * @return + * Always 0. + */ +static int +vdev_netvsc_vdev_remove(__rte_unused struct rte_vdev_device *dev) +{ + --vdev_netvsc_ctx_inst; + return 0; +} + +/** Virtual device descriptor. */ +static struct rte_vdev_driver vdev_netvsc_vdev = { + .probe = vdev_netvsc_vdev_probe, + .remove = vdev_netvsc_vdev_remove, +}; + +RTE_PMD_REGISTER_VDEV(VDEV_NETVSC_DRIVER, vdev_netvsc_vdev); +RTE_PMD_REGISTER_ALIAS(VDEV_NETVSC_DRIVER, eth_vdev_netvsc); +RTE_PMD_REGISTER_PARAM_STRING(net_vdev_netvsc, + VDEV_NETVSC_ARG_IFACE "= " + VDEV_NETVSC_ARG_MAC "="); + +/** Initialize driver log type. */ +RTE_INIT(vdev_netvsc_init_log) +{ + vdev_netvsc_logtype = rte_log_register("pmd.vdev_netvsc"); + if (vdev_netvsc_logtype >= 0) + rte_log_set_level(vdev_netvsc_logtype, RTE_LOG_NOTICE); +} diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 78f23c5..2f8af49 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -157,6 +157,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += -lrte_pmd_sfc_efx _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += -lrte_pmd_tap _LDLIBS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += -lrte_pmd_thunderx_nicvf +_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD) += -lrte_pmd_vdev_netvsc _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost -- 1.8.3.1