From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60047.outbound.protection.outlook.com [40.107.6.47]) by dpdk.org (Postfix) with ESMTP id 2DE141B2C9 for ; Thu, 18 Jan 2018 14:52:08 +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=6I7cy2cFQB4p/+3BMhj0DtGI2VH/BvmBeBD2WP7zCho=; b=Op8iMwscLY67498DQ1RMgx2R5Gyrsfyshd9NaefHIYTmdKG/MYS9Pb2Yx3G86ML66iURZWm8dvniAIBx1WHpZDVXPCXSTPPXAhZ04lkUAAuqDwVZqIs6jjXT97bUyl5+TnR80yYN0lGhs/+fivcUIqyREUUHA6elC/FC6k5wc18= 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:04 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Thu, 18 Jan 2018 13:51:45 +0000 Message-Id: <1516283506-21198-8-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: caaee202-1d36-4264-5a7c-08d55e7aa9d9 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:o8kx/36X9PnzSbbymMsQ/npajEiz7fDMAzvIyiMtZ+4IgAT9LIJT0NkOhHzFZz0J5QGimGz7oNwPZGDD7WuTLlCf+QlH6OhlRRU40kaniZhbOz1p+hp7HGhVMm6JgV1sCcwCanYUTOYARU+h3HhTiNJA5Khn03dLSXcSGT1mD7hyudX/oZ+uU/9aCYBvCJuoFeWmz4S6AwP+cRnk3SxLZ7lB0R3MMVjV/hC5CFGh3k6VlyAReR+DrGFcLrz27E8Y; 25:3Lsapxg01SVgJ+40YiJmQcuwF5Vzs2urGMmm7AVmQ8126K7XW/uDCN0+UpPjpUGRymrMQ+rgja5S1l0pft4IJ0akmc2i+PzBH0LnKwrm3CqvLELgKI9fksPm5ITSewZP1JW6FEWbLnjrk3oIVVSlwG/C+DQA0FJYT35Gy27IOH8gmA2/lDB4Ca1/YyW5q7q4AEKAAZ5lAX7v52ZpsSZT+bPNLiXvXY6jjYm1sXSqcwwHrcLuywJOeHx/Eo4a8ktaILXvDFUWFcWhpv1+SVLuUPvlXH4X4wHo/+FDUS+f26itZybB0xqWPQjQxuLZCr6RIi23PzyCZMNnY+EKCuGv1A==; 31:NEMesN6CQsxc2ht6Mh/6IDXsfBmYKN4T0RRAciCMBU40YSJ+W3NP8cjFV3DFfYSQXAUFDOoehY3HAGOXfnwQakgOwkqZ7VysQ7hobgWQT4oHCN3UatODUWNFfGhfGGDGPgxJanauvxi73P36LRMIIjQeF5pZiNMu9LY54pqyi+7B31UHy15VjT+vIhGiBtsxJ5dk9jllCrL79Jn/MYHqBytGarxjOa9itzGwdn7WETc= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3798: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3798; 20:nWclL6vDZoApeUrmKBT0udmCt1PU1oM5laik/GclEhkffVYOpHO0PoZIhz63z/TRM3ehQDstA3bFHF+NuGIW5Y2v5Z11vOxOsRvDiojbaCtKiy5uctFtrA4tq4NoBMgQKUmCEScSVmtDp9KNZoJMc+1PrXn2vaubu7wGRPsi8GZuV7OYqhHATiScSCBbTGtxze8eABVHDVV9+Fngi2RMNH709LEtz2pTiNwOkfS7wF/e+y0rTMu2zPJEDfD/o699PqJa2ubUlPIdsDSmCWJ01Ua+4rJ4e39zW0Z2dBT7FEwroOkClh7vewG6UWZATAHoWbxnuMkiI8ZDPZuDPcxEPaJKE/zripYqjsYiCn1WjMsmCqoBp1daeFiF77Nd81Msyhwz3ipY/5iMDg0DYcElU6wIvmizTrOjr18yrc/npz4ps+l6dMKBj4+bXpOYF8lDikmm6SKFsXsrD85yHLK2zRnLhKE/W3URbhBeKY2D2jLhJzbcT8SS1OH1HJuRIp4c; 4:M9sTRDxqjjBQBkaGMTJAaQQjxRscUP+/VIcbGZ/Vmg+Uu9XcdVh6tGuCnQarsu4ZK/2MxBdZBm9CYOSXMolbG6uEN5+UpThkT0zlqbV/HwVHoti3lZkjP4JdOPuT4YgV4H4RgrhfJspcRqPatcHn40MHTOhwLIJS6RiVaLySdLkMS8FlDeb+MULPssrhFKyPOKKV88QsDnU7j3BhrxwTL695aP0G32/Gi4UC6cYdyHUOjSS3nKKOVRK9NyjqXhXbAe2lUSPYJ3ycInnviCzh2A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231023)(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)(76176011)(59450400001)(105586002)(86362001)(97736004)(3846002)(6116002)(575784001)(52116002)(53936002)(6666003)(50226002)(55016002)(4720700003)(33026002)(7736002)(2950100002)(36756003)(47776003)(478600001)(16526018)(8936002)(66066001)(316002)(110136005)(48376002)(50466002)(16586007)(5890100001)(25786009)(309714004); 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:Kc2veELqzfmIXFf6UN8TyYe08yYq2SwEsRMslJg?= =?us-ascii?Q?meyk7yzLsqxcoi5q4koc+sogFIdb+maNWNh4QvTyetmO5p/rKQD9AY40hjfs?= =?us-ascii?Q?/6VbQGLeOVLRXifqOc4mQweS4MdQqU9/8QxtGB7xhu+1MnSUaaiEmtgbsTR0?= =?us-ascii?Q?vJn4sQcI7ENO2PHI7xxVIirFyehhvXnJnL8uoUnHYzDlO0lDpbZ48Jxu60ED?= =?us-ascii?Q?ctCCOsi0E2sD4R7A/EcJcm6jvwLBZiUwOV3dwNqEOZdisvrwXM8sOj/fkxxc?= =?us-ascii?Q?fOD6/9eH/RU0TMPkKM6Qc2lY/bb7e0ex3wVuluDCFOT177wGA3zX45CWqBWq?= =?us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ox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 13:52:04.2658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caaee202-1d36-4264-5a7c-08d55e7aa9d9 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 7/8] net/vdev_netvsc: add "force" parameter 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:08 -0000 This parameter allows specifying any non-NetVSC interface or routed NetVSC interfaces to use with tap sub-devices for development purposes. Signed-off-by: Adrien Mazarguil Signed-off-by: Matan Azrad --- doc/guides/nics/vdev_netvsc.rst | 5 +++++ drivers/net/vdev_netvsc/vdev_netvsc.c | 30 +++++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/doc/guides/nics/vdev_netvsc.rst b/doc/guides/nics/vdev_netvsc.rst index f779862..3c26990 100644 --- a/doc/guides/nics/vdev_netvsc.rst +++ b/doc/guides/nics/vdev_netvsc.rst @@ -86,5 +86,10 @@ The following device parameters are supported: Same as ``iface`` except a suitable NetVSC interface is located using its MAC address. +- ``force`` [int] + + If nonzero, forces the use of specified interfaces even if not detected as + NetVSC or detected as routed NETVSC. + Not specifying either ``iface`` or ``mac`` makes this driver attach itself to all unrouted NetVSC interfaces found on the system. diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 0055d0b..2d03033 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -36,6 +36,7 @@ #define VDEV_NETVSC_DRIVER net_vdev_netvsc #define VDEV_NETVSC_ARG_IFACE "iface" #define VDEV_NETVSC_ARG_MAC "mac" +#define VDEV_NETVSC_ARG_FORCE "force" #define VDEV_NETVSC_PROBE_MS 1000 #define NETVSC_CLASS_ID "{f8615163-df3e-46c5-913f-f2d2f965ed0e}" @@ -419,6 +420,9 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = * - struct rte_kvargs *kvargs: * Device arguments provided to current driver instance. * + * - int force: + * Accept specified interface even if not detected as NetVSC. + * * - unsigned int specified: * Number of specific netdevices provided as device arguments. * @@ -436,6 +440,7 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = { const char *name = va_arg(ap, const char *); struct rte_kvargs *kvargs = va_arg(ap, struct rte_kvargs *); + int force = va_arg(ap, int); unsigned int specified = va_arg(ap, unsigned int); unsigned int *matched = va_arg(ap, unsigned int *); unsigned int i; @@ -490,20 +495,18 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = return 0; } if (!vdev_netvsc_iface_is_netvsc(iface)) { - if (!specified) + if (!specified || !force) return 0; DRV_LOG(WARNING, - "interface \"%s\" (index %u) is not NetVSC," - " skipping", + "using non-NetVSC interface \"%s\" (index %u)", iface->if_name, iface->if_index); - return 0; } /* Routed NetVSC should not be probed. */ if (vdev_netvsc_has_route(iface->if_name)) { - DRV_LOG(WARNING, "NetVSC interface \"%s\" (index %u) is routed", - iface->if_name, iface->if_index); - if (!specified) + if (!specified || !force) return 0; + DRV_LOG(WARNING, "using routed NetVSC interface \"%s\"" + " (index %u)", iface->if_name, iface->if_index); } /* Create interface context. */ ctx = calloc(1, sizeof(*ctx)); @@ -597,6 +600,7 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = static const char *const vdev_netvsc_arg[] = { VDEV_NETVSC_ARG_IFACE, VDEV_NETVSC_ARG_MAC, + VDEV_NETVSC_ARG_FORCE, NULL, }; const char *name = rte_vdev_device_name(dev); @@ -605,6 +609,7 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = vdev_netvsc_arg); unsigned int specified = 0; unsigned int matched = 0; + int force = 0; unsigned int i; int ret; @@ -616,14 +621,16 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = for (i = 0; i != kvargs->count; ++i) { const struct rte_kvargs_pair *pair = &kvargs->pairs[i]; - if (!strcmp(pair->key, VDEV_NETVSC_ARG_IFACE) || - !strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) + if (!strcmp(pair->key, VDEV_NETVSC_ARG_FORCE)) + force = !!atoi(pair->value); + else if (!strcmp(pair->key, VDEV_NETVSC_ARG_IFACE) || + !strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) ++specified; } rte_eal_alarm_cancel(vdev_netvsc_alarm, NULL); /* Gather interfaces. */ ret = vdev_netvsc_foreach_iface(vdev_netvsc_netvsc_probe, name, kvargs, - specified, &matched); + force, specified, &matched); if (ret < 0) goto error; if (matched < specified) @@ -682,7 +689,8 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list = 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 "="); + VDEV_NETVSC_ARG_MAC "= " + VDEV_NETVSC_ARG_FORCE "="); /** Initialize driver log type. */ RTE_INIT(vdev_netvsc_init_log) -- 1.8.3.1