From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0059.outbound.protection.outlook.com [104.47.1.59]) by dpdk.org (Postfix) with ESMTP id 5F4BA1B024 for ; Thu, 18 Jan 2018 09:44:14 +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=Q8JJZ5x/3ianFG8oXY4UJHmOimcfxhg78BpMMWo0aeL6IomUR20mskgwjOp31SQfxVBH2apqtmJxy5iOoXTyuRnMbb1nPYhfkCBfNCapktf1EzSxpnKWR7tPmH3d2xvCqoJz8NHPgPz2Y4Br1qaYbNK/UIkZcBNshs7X4bUoQyI= 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 08:44:12 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Adrien Mazarguil Date: Thu, 18 Jan 2018 08:43:45 +0000 Message-Id: <1516265026-6469-8-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516265026-6469-1-git-send-email-matan@mellanox.com> References: <1515509253-17834-1-git-send-email-matan@mellanox.com> <1516265026-6469-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0902CA0040.eurprd09.prod.outlook.com (2603:10a6:802:1::29) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b7acd1b-8587-4e6f-908c-08d55e4fa68e 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:u1FGQfD3jHS1L2JC3S15H+0GaxbAwfTmkLc8KqgnqUXcBilVA+JWoQTK0fD1DrGvkr7zFZSABoHL+Cy7XcjhWbRh1MK4Md9VpcDjkxANdU29ncOesabwoO59mk+k0VjDTYd4keSN7zXpkaJGpth/4fZNiaJ61hM7CCIm95Di5FKe54ZKSu9AdLW6hXVFy7qw1QG7EWXhmDL8wKC4DymZllTAQWDtkdB/eMuH6b9XHUmYA6Z+azx7pkMZpZJLya0r; 25:ENnk1tmRwc7/8EsQhULBjWRzcEabpDUeCeN4AE4Nb8ElYSIHJYAGadpfCPeG7+naFz48bbBEyFo0BQgWFBKis6qLhkMBYw5aSOLKaBW8Ak4deJ76xkgisJSsWkQdocXjTEilE92Wpuv5XGR4uZIPm8sBxCFdpajOIPfEbrMZbT/gafM/i71fvOPp/HpWaqJRiaz+de3P9hfOT8/mIfdfqRAGRvaqkQ/Q/m3teFxK1hphl3jZhTGbU5AJ9MdXUhVA0o6rcIUSwvHrjSHxkhaA8y56g3tNemdooeGdhYizZGkXBSv6a/zqE69z9VzvkFErntxjMWkBAALOCUuGyUNwHA==; 31:kW8M1tW8AewZqkD3IMShFcAu75bW3QO8KbvqzVWlHyNjuNacH9o4zDfHCpLpe7BYUzdvoNOH0eLosyHnKNBcSOrz/jgL9MCSTZQ86/ccXOwMsZQwWwzsiHM+wwOxBxGIfLnr5tyOLbx0THA5avE4FCSZneg99zLgS3zyHnP8Q+yuxU1r0s5921iqn/tx/MBRwRAyV7WBwtKTLH2+Nkv+MafNONJkBKmDSjn5eeG8+ro= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:BhpQn86RVmziGy9X/xpErnWGbFKtYUsBo7mpOq8GpMyeJBLONdkS+Gh4TuCgadcavCRYs+6wIpvvewmyNVnMiRy/tZTdtX9X5t7LfhtJ3ufRc5vI+rdf6qXJ9vNtzTVvD5M1B4V3op7QxYotPDdkqUR7mmIjbHXa7vUMa3DW3S2xmGIHr1v5JHPTSLkx7lktIaZfxGB9r6H0C5lYAp82Q/h5cIGMYrLmECKC64oWnp72s3dOeu0QBtWvx+U2fhsLhkG7IBv/irX6Dbvgm2cuAQCitZqwhpUotGMiNIL/okwjmXW3qt8feM/rXNJqlj/ckbs/5A/n9FnESSvEkpqQm5W0rKyIP0hB6QA7iZr1TGWqOzdHiYIteneZxRy/9Lm/UoExYG3ube5Gs4O6dFzOBLFKZXc0LRChqUJIMscadH+oKMByMek3P8GuAZ7R3u5EJEyGRlT7WFoTkGounywhB+mcYHGKvW1XKIGYWzUXWrUnQFpqao4IqxK3KKaJM006; 4:UP812/I57gKOnXpRy30iFLkC7XMKv7xl1UMVloPWxn+zIWreHgrDLhqUDAXzdoynt9GyFcCwVlPOsnIA8CXvyx+CVG/SQE+eLxffhYhfu1buWHATnlFzCaNH4cVHJB/4RdQe0xM54ENARMMtTVpVZanuuM8mkSyRJJj9l3jv0pbMRzq2wU7PkHYUA7L8nz2ggtseof+nMJJZfTPFT69QAAv5mtaK8uxnqMJYXycAfmNUjN16sPozgr71BJskmijnZ6jLpAjsYCHAKhMSR6ybMQ== 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)(2400058)(944501161)(3002001)(93006095)(93001095)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(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)(346002)(39380400002)(396003)(376002)(366004)(39860400002)(189003)(199004)(97736004)(68736007)(36756003)(50226002)(4326008)(86362001)(575784001)(16526018)(81156014)(81166006)(8936002)(33026002)(55016002)(105586002)(5660300001)(106356001)(69596002)(3846002)(53936002)(66066001)(7736002)(305945005)(47776003)(2906002)(6116002)(76176011)(26005)(59450400001)(386003)(4720700003)(50466002)(52116002)(6666003)(51416003)(6916009)(7696005)(25786009)(21086003)(2950100002)(48376002)(16586007)(5890100001)(54906003)(8676002)(316002)(478600001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; 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; AM6PR0502MB3797; 23:AU9inFrflocVly+MKjXfidHPpFB4v9WETSxwRIH?= =?us-ascii?Q?36F7nzsfeC4QnHtUonLQbJr8EbexLU1rqrh35ptxp43QfITlURws4kWnKuQF?= =?us-ascii?Q?zeUQhtpE79WCJMWoqBU92OElZr+iqdqb6OewA05oA5Ka0uXzuevHWHsrpGyZ?= =?us-ascii?Q?HIM3WyczMtjF519jJyt/YlfdrycCDkUmJO67hn4HGnZqyv3Y/Bl1e9/LP2Ri?= =?us-ascii?Q?yUIKZD8XOapFywNdXHmG6vDaJuMui7F6kuQbf66ErwPB6Ta+8rp0/HReoL+s?= =?us-ascii?Q?wuIUDOpYcCNPvoHvH1zlF8QAaauEhG0lZ/PwNZOKzvMtMFT22oIfbP0F5/pH?= =?us-ascii?Q?fu7RiOy+Ez63IPmKbvrzhEB1TMfjueE9RpkYBTinh+AMAYk0K+cWUSEulPC0?= =?us-ascii?Q?8oJIDHOHzCXDowuUCwnzVtsKIGy9acEInpBR72TZ2DJjyIex0bkXuPcE4WO/?= =?us-ascii?Q?nrfHibT5CIGLwiw0LerqbjggryMrBnZYAFtdiOQXjPMW08txQRDGcIgNrbKn?= =?us-ascii?Q?VmS5qYReH1qMTiYVRXUMc025SFuXed+7JP4c0t04RISiwWjJShWa6p6dzrVU?= =?us-ascii?Q?Mp0T8px0o4ZlcfhDFCUkCaRGjUc6bTaEnJx+/nxLCLgiclHvT8FBMj/F8t4c?= =?us-ascii?Q?HbniOeWRoHtGDB88OKqJkOn226j4wmnqDE56LgW4DvWy64bFwUV3sJI5hNM2?= =?us-ascii?Q?3TeTj4cHPLaryOBsFUbmh1GUFImjTIhU0QOZz86sMjL+FIzj1flFZnAXQ81E?= =?us-ascii?Q?2k2pLPFDnDpLxbwZMGCt47jHiXIHyi9+sd57O6YvhIt5JIc5O8cBBGay0Pk+?= =?us-ascii?Q?XsMB8m2fdaol5yzYUktsACamPikcE5TuBbCpHq3NzKUZEeP8wOPojXcwlOyq?= =?us-ascii?Q?3XUH+m3gIX6FN7YhYcmAFg0hFZkXy3r6btpoQ8gqX5AsrRun58aYm/04GRcq?= =?us-ascii?Q?HSzSUB5xFUyM/kut+9qCe3P7MK0VZxqYVB7Alqq1ifFdzRtcLpy5keFebJv+?= =?us-ascii?Q?BFa3Z2hURT64K9Q3MYPJ3giLedABd2VTURZLD+HIVLcrP6MO8TAEFomQwfdG?= =?us-ascii?Q?8GVmZpL1ZvcqHD5EIoeNgf+9oaTvBHTooW1gX473oDcFPAq5XInPby7DGJjG?= =?us-ascii?Q?JAC/SmehaXLGTuN7pGVwohsi3TeiqCSoxAb9+xTqMQeXDJbFGsBvQh8gF1HL?= =?us-ascii?Q?bVYvZMUIVWVQPbuwv4plT76/HqzFCbULBNue22Dv8gIPBntQT7R1RqXxcaYv?= =?us-ascii?Q?LexBEvEBrywn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Org: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 08:44:12.5237 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b7acd1b-8587-4e6f-908c-08d55e4fa68e 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 v4 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 08:44:14 -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