From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00046.outbound.protection.outlook.com [40.107.0.46]) by dpdk.org (Postfix) with ESMTP id 028441B29A for ; Thu, 18 Jan 2018 11:02:11 +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=KgV0K8xbtk1WN/0RsxUPkv4QTWGl/s1Qv5ffF9LLUUc5Yz5utVwh1ABZogk6hfTIb0TKGGf18nt+bCnZskFhHo3YvEWt5KBJlSObt+ab+ic1Z7bgjXy6Zc2x9aY5U/fQu2nvmqkmrWbWqcs40oTTmFXX+XcQxgnXl4WAOnizT2w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Thu, 18 Jan 2018 10:02:09 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Adrien Mazarguil Date: Thu, 18 Jan 2018 10:01:48 +0000 Message-Id: <1516269709-15252-8-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516269709-15252-1-git-send-email-matan@mellanox.com> References: <1516265026-6469-1-git-send-email-matan@mellanox.com> <1516269709-15252-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0202CA0033.eurprd02.prod.outlook.com (2603:10a6:803:14::46) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7f3e7f4-9ee0-4b0b-0d8c-08d55e5a89f7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3797; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 3:++yRSWq/OX27peKBae2uS0KRPu9D14NvDtu/Hrl7Lb9VrFugCDxry6nfiziNLc5cf/ZrDVJBpJeT+mqdjrC1/uDpJlRTCGcKyRCuakL4azG6A/ruABGe1p+w2ldmO3vWltsMK7edTmelAQYHVBT5YGg1Rcmo/K/JYLwptHaB2wvuZDfWJk73QiCXYqLot/QzfWkiMRA0DpD9SNtPOWB7OJV6e9NJaLkwgOqAfm4KW5emUsNVoCHbBsst9RpZtZQz; 25:om8fiINBg14H5yDtPfEKFQ+QmZLa/r8X+Z1oz1qV+GCqy3csf3gh4Y6NAYeNjNTHQF3x+a1yhDqgyAektpN+tGI0y/mNQlVh00juVRh+mk/KpEAqhFaYUaMkzTET+M6PPGuYv4HdQOdHO6TAzJJzoTEeHKKtPgth23TCuGqj/W2bEHo3hIjt4IWSiICMuZxoVEk3UEOjpieVBoUJRkSWNWiaomcHwJBPh0Aq1eNn2mQ7V9HvVhGxw+HG4X0mbUDdUMHMr1TNdcDAPORInWGhGHn3RfSlpZIn/K7h5Z0/gN/jJflVEgdEmC2755E5LE/jWcwy+loCaegNEXaoc/MnjA==; 31:EEYKnREEt6AgMWg3WoxeOF8LW3k9U6P5NMMjbQ1AnFDZYN1Za+jfM8IdyffVbZacssfGa8JzCxfEpszOJKTjc0ZjIBUVFuzsk229ifhF9EkBt8aHi1ukMCA96o9L7gCTBIYLQf+FQA9BU/dKmwYY3DDhKPVDqcWrTAmysFrLESG4fpiw8c7EutVeVMPH2XZYIjJKFnL3zabCT+6aWqxioJtlq8h+h7sax97vbjjGLOQ= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:iDOstyaCcGeWAUjWmyeY/lXd0sz0py1Lbn7MB9qyEuXAcIBABAET+0AJOWXs444jVw1+oYIpw7W9zI2TZBxb4MR3QNa8piN6ysyYIpZzvZBfM9TjtGVUeK6BfhRAAHBi90LN+xSD9TkrjgmdLGj1Xcw6MYLfo5Pu5fuI8VdqWsmUR/WJnAu5kISzRvv3cMhKYmzaMxqRyX2+hNIfWdnI6c9z5FbPrCpNy4PUdugGyc2liUdlfinAmY2BT9tRXgovbJ4L/3NCoM2IHFCvZMAzjHejTRln+kcveQb/7j3q7SA5/ABvQxuddUzym1XxlKkw4PVb2bEZpsGP1FuTFrpeyAAnWt/qCFz9o5FlJOOq2qwqXRu+90pZjrE04tTj/vrNpCGITjZRpGYL3fn6FK7fJErU7gnlVOzqDlaYbylNAw+mFGimut8JgGgoMFQGjdtoizoUJxx17z6k/mucJSD92ROpV4hfTEKNWfWvVEH6o2Az8syFARfTUTGucl19h+Mu; 4:Xf2aLYgk/mr7P6dfovSxUNuN8/XRJDXS4lH9B8Zrfd8B92vlvfVnNY1k68Nc4Baz8FxLPv6HRnGxoawi1taVs5CIc/QkYAnLLCJMbp5ELXIUGsocx7jJcVF40aXMZ42tOH1x75h/If4G5nepR/sICJk+dSiT1BLlQiyQsCrzqI+3oo3uB+ajel67Eo+Mm/ZZTuym+8RcqYAizCaAl3NzAb8xgPd9W2KpDlg8W4Qv5q0gEyrJJ8r633w16eyaTF+RrFQ2nLFU+lpk2O3WD3sd4A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3231023)(2400060)(944501161)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3797; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3797; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(39380400002)(346002)(396003)(376002)(199004)(189003)(6116002)(53936002)(76176011)(386003)(4720700003)(59450400001)(26005)(7736002)(305945005)(50466002)(66066001)(2906002)(47776003)(16586007)(54906003)(5890100001)(8676002)(478600001)(316002)(21086003)(2950100002)(25786009)(48376002)(52116002)(6666003)(51416003)(7696005)(6916009)(81166006)(81156014)(8936002)(4326008)(86362001)(575784001)(16526018)(97736004)(68736007)(36756003)(50226002)(5660300001)(105586002)(3846002)(69596002)(106356001)(33026002)(55016002)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; 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; AM6PR0502MB3797; 23:XNOI37u/9FXE22CU7FJDKbcstkfkZMJlmbPls2V?= =?us-ascii?Q?D9gjsOG3vk3XrIhb0NXJKZqdn57K9hRtHwQZzGSTUE7V7rIaqcVNHNiEM0Tn?= =?us-ascii?Q?7dOFENEUX6KM6dYdU/FnGyYhRTeBOn+Nn9md64kXpiviwMKaR5yK1n7Qs4wp?= =?us-ascii?Q?FAIduHE8gAg0YjOBN2SlTg3nduq4uca2Euo711qmNGWHFENgRP0vgKzOEC74?= =?us-ascii?Q?jGhhh4Gcbg5WhfmRHSUYJPHENz5mzxdk6/UAX+BG5wO5xl3j2aYOYsDfQ71Q?= =?us-ascii?Q?Vo5b+qJjrDL+nbjrGHmHGrrrhfFLuePvwiIDyQ2zlbVhNgQB3tpf0ezeO7jI?= =?us-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pamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 10:02:09.0186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7f3e7f4-9ee0-4b0b-0d8c-08d55e5a89f7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3797 Subject: [dpdk-dev] [PATCH v5 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 10:02:11 -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