From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00061.outbound.protection.outlook.com [40.107.0.61]) by dpdk.org (Postfix) with ESMTP id 9313A1B1D0 for ; Thu, 18 Jan 2018 11:02:06 +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=JUOtFK6PhXkyHgLIFemRP5rdcNqmmJG8c6DfY7O74bY=; b=bGU7K1CmQLF9ryCzc6d5KQGM+xJSPEw/4xSzwbhGrAJul9m9j1YmakGTU7WK4YtX7+bkOyJcI/K2jFsyvBzNT2CqqiaPv5u7gupJaaTS1XLd9byO2U3UWJA7gKWDfPddwB2Bd8c5VcgtyqSE87bV7GDDWGhaGtkScqfKoCbI0qc= 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:04 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Gaetan Rivet Date: Thu, 18 Jan 2018 10:01:44 +0000 Message-Id: <1516269709-15252-4-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: 840c365e-4266-4b8e-672e-08d55e5a8748 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:0vn9q2A+762VU89z9Mlpnw95cNKv2RKV10MnAmqL4uPp+7/aKH5WAhbC8TjbdfSzvFgL4sc/9e6jIG4N1ULFTsPF5cBFyNkVuVARodt/7NvwGbsvRDKOyz1cMdf6tcA6/3VlDCFCHLyPrI/MA5ZvgDoqDiPpD3PGMD8fD3/6ejDrjIBFIm/QBnwptjYfuzHLubTuZ0W2hkd/61hGRHlUgT/K0deB3yUHQmKU6o052KPw+LI4Nz7Yk5zwhMmlcIBZ; 25:RV1xaYpPklYz3LB3fv4f57tDPY7lyjL3NK4FiIix1u/KbU9fn6h+nrf0qqvAVwxP16HA3S9ul3H2Pbp6IRbpIzVbwIw/Jkzx+YZeXF7BDfkdgt5ogKt6XimIxQHRHH7+y79zKC1A27kZZrQ40i7ED8ArjZvXZqIYcKkp7hl8yDqH7eaYKO6BSB0pFZCQfehHkZcZiKV/EQMpssSakEeRtTLjp8KW4Qn4d6ZVb91EFhUrmuqrxuO6+Sdgz7gbQ4kH+DhqCk4TytvPXJd4nhAJ5M6vJCuCm5Bltu3zLZYtceh3W6BB5Jgpdw3M1O4COpt4U5Gs//7IrVYwBud+W+7WYg==; 31:qrQcciXU90z05o0R8Y3zCJPjp+YgQXUEajK+TlSLvrfgLPdR6YCsQUsxawrIO3LmWBH5V9P0az+ZpfYcExn00kmT9my4ciU0TdNCmxIUhvNpRUWAO1jyLoubvHJJ9FClXszlH4ooUgg/O3dQkINM+qNBU8yQJTj7gZ0wj6XeGBnG8/TbvjDXO25FBwVWUARmddUhn/EbfMcaIeS4fMachSCjTU3vOmHGJQ2OgH9RyRU= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:4sS6IF3g4roYGgREReFrrJ9/dJVysHAg2vJHOpao/4AtBeNwJIUw+KJO7ZfyYM07xfDhq9/JmKiznNeOtuCj1lVNtGVlW4XGgKyd8+41YXS411h60QkMEiWmS18f+oNC984r6qVmWVWXvSPWUutrsPMWFoFo7JBqAjH3TDk9QdVQtraV0rLzSMb2zOsCMvaix9fElgrC9rk2Q83xxQtcvJduzG7J48WUGtz6MDVeBdwaO00B4eoQ3EQaQJk+tiVsOE3etN/0AObBw5bXnLfnR3j8Y9+ZUonlCgTNMoPzPwvFzR7VHn+p8CtvU6aHXzLnTLVYbr2236fkYHhCSx7g3lFUREFQFe6L5OSzdiSPryTWjWwVZVjFFCN5t1DbHS2+UqZI9m0UneDrSj24ZxqK0gu+qKF7ReTiSwzdHA107lWaKSTCyKEO72g/rlELX7ivp5HdFjA0h3Z0rOWXunDe9+5gU1zvuYuOZJ5bh7fbTWaoh4U9uWa1/aqjVaHrHbSA; 4:d3l0Cs2jGne8L7NYmh3aElSc2hyGjCuzosPE4gFI9nRrWl3wMiqZx7+Zd+dqVAp2T6p4EG8naYcNE7wv9kCmzInBVCCawO76EVOQJvjLs/34rlNbgNNaqfNQw4UQcluYlaTh9Bzvgt/8As3nu5MQ/jywX8fbPUlttmd3YXwzeGn9/qaGv6EslkP6VW6wjgscPv9s5z5BVEzgZ9ZOCixE0iyDyrmht17cc/0HUgRyiFUm6g5oEi1PYBftM8/+0ge60fiJJRzTcTo0DELLMXei4w== 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)(26005)(7736002)(305945005)(50466002)(66066001)(2906002)(47776003)(16586007)(54906003)(8676002)(478600001)(316002)(21086003)(2950100002)(25786009)(48376002)(52116002)(6666003)(51416003)(7696005)(6916009)(81166006)(81156014)(8936002)(4326008)(86362001)(16526018)(97736004)(68736007)(36756003)(50226002)(5660300001)(105586002)(3846002)(69596002)(106356001)(33026002)(55016002); 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:1sndaqz40GDE/PuT1Gkgjco0UXbAStitG6GJIQA?= =?us-ascii?Q?8ro3p2GfcTgxEvo0/UVTUOSt8mCbvccrt7Ksktl9MGrdAFGWEGujo6q+VFvl?= =?us-ascii?Q?kFHekxPGgjQbYfrqXjEFgp0cIHxN982OWhIadHHwCLbuvMKBjj4y7x34wgr5?= =?us-ascii?Q?WLUUvTZnmFcd9HzRxlWzhQB9WM426WwsLjgykFxmYp3Zw/y0RJijRLKF3eLs?= =?us-ascii?Q?poii78wGMkPYPXLI4ir9b+uInSpumfNi+hsKYYgMiN6NsDlngJ4pOJC2gnJU?= =?us-ascii?Q?DeRQ9ewuqi77b2iFa0Wp49z0WTF8zoVP2bvHt87c0orJKtq3ULYVMDAyYMAP?= =?us-ascii?Q?9EAnHSQpGWMncrvkdPMIbuZCk0X9RrlE2UePIrDzttILjiSFVJqIrcTo467h?= =?us-ascii?Q?ZHrNCvh4KWfIE0UvJMpmKiUFHlQEHTOKX1IaWj08FzpSmk2kUUNHsIwDAAUS?= =?us-ascii?Q?YyYQirWE43BbulcWyYEwcxEVM+q/RpoiI0MPiu76vlLQ+iwP+9NJyrIEycV6?= =?us-ascii?Q?1WiUuHbU1U5g9I6yWoEf6cgpXHzJV5/K5q+tPyPgsDMP4D2IIORoT3RzkD2h?= =?us-ascii?Q?Y1T577qduUPSHriPC5Pgg8s9Adk/RuxdClAFaDp9iYHHC2wi+jJXyevVzIpb?= =?us-ascii?Q?9rI8mIFH05sWF8W+XLUiXk+gfjQPfiGfcW/zmtj3Njmi/S4HBHKqgOmKTRab?= =?us-ascii?Q?evBr7bti2ZVqsi8ByyRcN3ivVr1qaUdWstluSnhwGTND7S7kujgov/y2Y+IS?= =?us-ascii?Q?ewPGs8dndTAkRq7calQAZOdMdXVKWarLbyzecdis30E3IXm4PYhZ8DZEQZTp?= =?us-ascii?Q?a3HN/TkJ+KOo5Z1qNHFTDOMgzuV/KXAZ5iKnwrIhjgHra+LLTg/hPHdR0P0z?= =?us-ascii?Q?UCmkoFMrNR3e7WK5GBln/FNiuJzhKsrax+dg1ioTyongvyzDtCTt8m8kXu69?= =?us-ascii?Q?yN1+nJvfWFZ53ftLRylh0hVB42Zmctq9MNff1QncdrzOwGNPTAjil9T9jasI?= =?us-ascii?Q?NxgxcZBU8/6LxnImUK8ijh7wv73HRGdCnpXCCD1Jz0Qr0KWp2LTzN45d8RZo?= =?us-ascii?Q?W8NVEK8pL/8RHikXrm6qgD6sUsEZ3TvOembKCcqSjaWD9d6mEHwL+kheYK8O?= =?us-ascii?Q?AbWKUC9jeI7DbGQL0egyjiIzjJvsuK1yF5puYfd4uzMeU+PKxFCiEODTwDAa?= =?us-ascii?Q?qpNGh4+xCR8Jixbs=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 6:cYz53aUms+g8OD8XYWhOYLmItDsc/Nvw7P1rE9I3OWg867pYkLbfAwUjdeKRfiErGIjBfAch9CDYQXNuo3qRHddshNqNLXGw4pYxoJcjGj9aGT5ejZ30KM1ak4hel0AfNZZXMAIBOlBDfuELFOR5yeqE3PLHEL9MPn9Z2s73b795fDcdRnWV7Nj94HmTW6eKj2tLGBoTMU1gzg24yq0pptOThy9h+d/7Rv5fTW1WaHSQ5wLrR8t92GKBXqQZQV5infVY5GnZsPRqNfokjtNufT+vGZroreuV8G3yDF6RCpO2dbzgJWKKHYtrN4hrCOGyNxb4IS21nAFTp/OTt4NKMLwTBrwXIOxfrE4gg/NzvMQ=; 5:7Yo1a/fRAMxLeBeOPE6dqGBgABI+Mi8ij55SFrZZf1wTQAUthh4gGVk8VXDH4FZkrrNu+Kpqp5TDo1CYmmAKVjl18dAGGaE+u1qvn6Dxr7aWG3vuxC+ihYGBwtgYtvQnVNGpqX71l21WxO/TbFTw8G4UQ593r0/8acM80/wTaPw=; 24:xkFMlAekV4WaZIuVB0g8SMmC716JgsxDKO5KTpIbz/fbgEOFA51SDihwLD4LFVo7UldkPnZLD5u1ezCNIcCd5HM2qRoiPEgcWkEmz4QVtIs=; 7:mhOLXUEkhXMSeQMKbro4nWrMsZEb74npMcFPpqzMBLcAAxs2qhrncIeB8aYY+YmSepRR/ipaNfeom/2iLncbcSWpQsEy0vBe2zOlYLmW03WN/oJryHNeW96MjFYw8G12AaWapOYbWIriEbldtrE3n/VkJezVX57l051TEKA/ir8qq1P+jx14GhLXOLYGX/zktJEPnQLoxt6s/vK9Tx1kTwR7aW0or+90auPKRkg12wAqSf1kJugF6FQjpo9AMiXi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 10:02:04.5186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 840c365e-4266-4b8e-672e-08d55e5a8748 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 3/8] net/failsafe: add probed etherdev capture 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:06 -0000 Previous fail-safe code didn't support probed sub-devices capture and failed when it tried to probe them. Skip fail-safe sub-device probing when it already was probed. Signed-off-by: Matan Azrad Cc: Gaetan Rivet --- doc/guides/nics/fail_safe.rst | 17 +++++++ drivers/net/failsafe/failsafe_args.c | 2 - drivers/net/failsafe/failsafe_eal.c | 78 ++++++++++++++++++++++++--------- drivers/net/failsafe/failsafe_private.h | 2 + 4 files changed, 77 insertions(+), 22 deletions(-) diff --git a/doc/guides/nics/fail_safe.rst b/doc/guides/nics/fail_safe.rst index 5b1b47e..3f72b59 100644 --- a/doc/guides/nics/fail_safe.rst +++ b/doc/guides/nics/fail_safe.rst @@ -93,6 +93,14 @@ Fail-safe command line parameters additional sub-device parameters if need be. They will be passed on to the sub-device. +.. note:: + + In case of whitelist sub-device probed by EAL, fail-safe PMD will take the device + as is, which means that EAL device options are taken in this case. + When trying to use a PCI device automatically probed in blacklist mode, + the syntax for the fail-safe must be with the full PCI id: + Domain:Bus:Device.Function. See the usage example section. + - **exec()** parameter This parameter allows the user to provide a command to the fail-safe PMD to @@ -169,6 +177,15 @@ This section shows some example of using **testpmd** with a fail-safe PMD. $RTE_TARGET/build/app/testpmd -c 0xff -n 4 --no-pci \ --vdev='net_failsafe0,exec(echo 84:00.0)' -- -i +#. Start testpmd, automatically probing the device 84:00.0 and using it with + the fail-safe. + + .. code-block:: console + + $RTE_TARGET/build/app/testpmd -c 0xff -n 4 \ + --vdev 'net_failsafe0,dev(0000:84:00.0),dev(net_ring0)' -- -i + + Using the Fail-safe PMD from an application ------------------------------------------- diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index c711da4..583bf05 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -45,8 +45,6 @@ #include "failsafe_private.h" -#define DEVARGS_MAXLEN 4096 - /* Callback used when a new device is found in devargs */ typedef int (parse_cb)(struct rte_eth_dev *dev, const char *params, uint8_t head); diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index 19d26f5..33a5adf 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -36,39 +36,77 @@ #include "failsafe_private.h" static int +fs_ethdev_portid_get(const char *name, uint16_t *port_id) +{ + uint16_t pid; + size_t len; + + if (name == NULL) { + DEBUG("Null pointer is specified\n"); + return -EINVAL; + } + len = strlen(name); + RTE_ETH_FOREACH_DEV(pid) { + if (!strncmp(name, rte_eth_devices[pid].device->name, len)) { + *port_id = pid; + return 0; + } + } + return -ENODEV; +} + +static int fs_bus_init(struct rte_eth_dev *dev) { struct sub_device *sdev; struct rte_devargs *da; uint8_t i; - uint16_t j; + uint16_t pid; int ret; FOREACH_SUBDEV(sdev, i, dev) { if (sdev->state != DEV_PARSED) continue; da = &sdev->devargs; - ret = rte_eal_hotplug_add(da->bus->name, - da->name, - da->args); - if (ret) { - ERROR("sub_device %d probe failed %s%s%s", i, - rte_errno ? "(" : "", - rte_errno ? strerror(rte_errno) : "", - rte_errno ? ")" : ""); - continue; - } - RTE_ETH_FOREACH_DEV(j) { - if (strcmp(rte_eth_devices[j].device->name, - da->name) == 0) { - ETH(sdev) = &rte_eth_devices[j]; - break; + if (fs_ethdev_portid_get(da->name, &pid) != 0) { + ret = rte_eal_hotplug_add(da->bus->name, + da->name, + da->args); + if (ret) { + ERROR("sub_device %d probe failed %s%s%s", i, + rte_errno ? "(" : "", + rte_errno ? strerror(rte_errno) : "", + rte_errno ? ")" : ""); + continue; } + if (fs_ethdev_portid_get(da->name, &pid) != 0) { + ERROR("sub_device %d init went wrong", i); + return -ENODEV; + } + } else { + char devstr[DEVARGS_MAXLEN] = ""; + struct rte_devargs *probed_da = + rte_eth_devices[pid].device->devargs; + + /* Take control of device probed by EAL options. */ + free(da->args); + memset(da, 0, sizeof(*da)); + if (probed_da != NULL) + snprintf(devstr, sizeof(devstr), "%s,%s", + probed_da->name, probed_da->args); + else + snprintf(devstr, sizeof(devstr), "%s", + rte_eth_devices[pid].device->name); + ret = rte_eal_devargs_parse(devstr, da); + if (ret) { + ERROR("Probed devargs parsing failed with code" + " %d", ret); + return ret; + } + INFO("Taking control of a probed sub device" + " %d named %s", i, da->name); } - if (ETH(sdev) == NULL) { - ERROR("sub_device %d init went wrong", i); - return -ENODEV; - } + ETH(sdev) = &rte_eth_devices[pid]; SUB_ID(sdev) = i; sdev->fs_dev = dev; sdev->dev = ETH(sdev)->device; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 5e04ffe..9fcf72e 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -58,6 +58,8 @@ #define FAILSAFE_MAX_ETHPORTS 2 #define FAILSAFE_MAX_ETHADDR 128 +#define DEVARGS_MAXLEN 4096 + /* TYPES */ struct rxq { -- 1.8.3.1