From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0088.outbound.protection.outlook.com [104.47.1.88]) by dpdk.org (Postfix) with ESMTP id A8F3A1B1DC for ; Tue, 9 Jan 2018 15:48:22 +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=wEqqJW2P9aMAtHXs4BLC/Zwt6DtRXdRlki8jm1uEQus=; b=ar/6L3y+tTazYJMlWT3jm2o3i8no3361T9DxQZbmAYc6pBqirQ6CSsrQCrwALSmoGCKrODrDljsVI1FcyM9CUINyUXdOly6ilCHv5jPn8XhuTQtvpyFw2XOvGu8RXKvZEmFk5KOhEP4QbJtuSRhZpgnXmb1juQFkboO8h7337qE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 9 Jan 2018 14:48:20 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Adrien Mazarguil Date: Tue, 9 Jan 2018 14:47:32 +0000 Message-Id: <1515509253-17834-8-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515509253-17834-1-git-send-email-matan@mellanox.com> References: <20171222173846.20731-1-adrien.mazarguil@6wind.com> <1515509253-17834-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::16) To AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6824f610-300f-4ca6-bba5-08d557700719 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3799; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 3:o6g1KiJNiKzJtimL/pInUQO97jK55mMydKdpxhgIodEwlfHRcry2ehlsbIF+HSa4WGZYNhuV7FcRGVUOiSr+ggbZFB+7/Z6tIhL9BWI3TLdmFJRioYKEPSYzpz0Knr7iIhQWj8HD1pGR+6HXRuluVQg3Hg0CRgiWpwtd7nZ1D1r39qB7jT1i6jT84y/+TKc9v9xzquXfBr8jGhOU/QeyHJhoBtzLFiQBNDwCKu0JB4zfJ1IFBRJy7vcKj2YKngnp; 25:vPaiak/gp6Duv3UMP6vLs5kSIkkY5zKv7tucjB4Xdq0+9038P/yUfMBgIf9i2jVOYTSG7qs9qhPdCtoEH+vicCueMV6CXH2QGpd1afvwjSJ/4ZeYVFAUNcRgTrt7XWHelX3p0jLmnIK/0cGo2mY3bcTGi4UWqIVy0zwvCzUiEKTKcq6UqUtfKnP6so6J/Qfg3THGIXhYRTNBSo4RtlzuunWc5yUzSJSIkSY4XH/c9/XrUDxfWwj74tmp/KUOfj/zsodbxEaHu8BVzYpIWPI/WUtt0G7xiRsZPHs0oQEAqhA67gBCn0/LzU3Qqysar9L2S89fl8paqSh/wMLcrPPdRQ==; 31:FE7+p0llP6ZNLcNsZEo5UxUQpOmFLgZ9zLBLHchJK6GBkGAs3GHC99VrJ3TBl/Ls1CuPYSCb81kzyT02T2Dw2uGokJELYw24JmxKtRZKtyhNwzWHW1tyP9GVD/5ZKC7dQGzDagxLMrjN84Mi+agIssalDKQFaa9OfeCZjm0jZi1BuPWohPCTLK7IBSkb16QmW6QQOx3PS82v8M+JoiocqtyqjrjrIJ4XJogo88gOPp4= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3799: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 20:nQdefm8xT3lDTCDs+DAIbq0HQw4UGjQa/0Ub7sF8X3MpDyL3w08nTlOrMoCgIlNRQJu6zJHUBU280T4B+wF/x/hnli6A+43uHsKLPVydQubE83qyRX+K9UaMJnVk/ebjDOADaFaOX4h0sZOtuh4zq47oMvO5Xu4MRVOU+yrCl2qASuGUH/RyPf//GlOyweOLqcKBRuQbcKK8hneTJivo0ggHKEErsMiYXf90zMvnzpvNHdIjY8IGSSyjw1XgaG+HyrnTqTvK94s3pZKtO2j/fGBFoZng+RwWCqTuu+0N4h6lsqV8RP55v7QOVTzihdiXAkCY9a5O6dkKmeKKiew8fuaJPVNfvGvJfVOdFvlizoziMTUlcOUB74w2B8bZtm60dIjTMVboWu7DtesxsBA/F2T+jHSl1uPknBaFiNGmbn1cHHLyYaMqaCBk8job94j2krXHhLCiOsFbI4ZVPTZX71lL3c0YGVSheaV8jVRUMm9/TVRju+Kh7sxGuWShUFw4; 4:Cax3EsTFrkMR28crlhtG2Ra4eKM5kN6jVJhAIFtj7GKlQt0ru56MnELNF+1pLzl2kAVqinz4uKIlVdWW8n7TE14lEufg78PQwRcPoyf8+VyHKRsn49yLzvL6UNrjrHQ0DdzgJXkwjRSUWJwAWYQMD9N9CmwuIX+qOn7AdUmStp78XGUt8OsmnKE8v5n5t88neAEzD0XaRjJHLW/ADU//jQorB2HhBSxCltyiMyYYYiN9fcJKynwCADl5CpNXuH/ro6MXyOUoY6jR19fHOUj4Mw== 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)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:AM6PR0502MB3799; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3799; X-Forefront-PRVS: 0547116B72 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(39380400002)(346002)(366004)(376002)(189003)(199004)(21086003)(16586007)(8676002)(575784001)(8936002)(5890100001)(54906003)(316002)(3846002)(51416003)(97736004)(33026002)(386003)(6116002)(55016002)(81156014)(86362001)(16526018)(50466002)(48376002)(69596002)(81166006)(50226002)(76176011)(53936002)(2950100002)(6916009)(59450400001)(7696005)(105586002)(36756003)(68736007)(4720700003)(25786009)(5660300001)(106356001)(305945005)(47776003)(52116002)(2906002)(4326008)(7736002)(478600001)(66066001)(6666003)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3799; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; AM6PR0502MB3799; 23:Hnhne6KyA4c4kV1w57QJjbW2iW+AqTSrTIxybUq?= =?us-ascii?Q?ZY4rkWfbgjqJxoZF4JD7dLlovEafEcq69p+7cj9R64iTakT3aeMtc6H7WR8z?= =?us-ascii?Q?1vHJbgeqgTY5Y3xbTilIOCrOZdUJunXnykbk557AbInl320372TxxVvSgdVu?= =?us-ascii?Q?DlxO28LnvCeUnJRERstM8WNt7pzzvuh5Nk0bLuOoMo1Qg+9JCy1wFYX5EXIH?= =?us-ascii?Q?fTy+6+Vm1bmuG4CF7vcLhdYsZEu+3uBe1k+YEOQp81OIVyyY4bbFz9aNME2y?= =?us-ascii?Q?3eGTcmxglsqvRtJ788ACxpbvgjzyM6IzEU/Zj2G6v8Cy6QS9ITyc8MQHHNns?= =?us-ascii?Q?R03b61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ox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 14:48:20.0342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6824f610-300f-4ca6-bba5-08d557700719 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3799 Subject: [dpdk-dev] [PATCH v3 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: Tue, 09 Jan 2018 14:48:23 -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 4295b92..301f9b6 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -35,6 +35,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}" @@ -413,6 +414,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. * @@ -430,6 +434,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; @@ -484,20 +489,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)); @@ -591,6 +594,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); @@ -599,6 +603,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; @@ -610,14 +615,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) @@ -676,7 +683,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