From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10040.outbound.protection.outlook.com [40.107.1.40]) by dpdk.org (Postfix) with ESMTP id 8C2591B2FB for ; Thu, 18 Jan 2018 14:52:01 +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=aa7PKUoc5zc+qRKiaZaLEKPGlT/XNq+jEELBr44pR9k=; b=GL2Ho/6hHDBvTb/mDvT/vCxElZ8sW6O+GDrGVUcTOFPQKE6y7MQ8OUXMRE8HuFX3FXs4bbliT52EaAyVoU259z03z6OYBM9aZ+/0PAtQ6w3nS+azsugCl3ufoyhkFiL9bND4RD1YSj0X6n+ceFBkuYS71IsV0ZJUFRGutRbAK3o= 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:00 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Thu, 18 Jan 2018 13:51:41 +0000 Message-Id: <1516283506-21198-4-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: c10085cd-5fb1-4cc4-36b4-08d55e7aa60a 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:PVey9EGM7J8NaOiEh6qKnq0ntuVbLmBnmOhnbSwmGAaWwSrxVvuBeu04w+8s5GG2h+5ndSxwihFtCYc7dIHN2Xn7Nu09dNf0ZYUE49fg4RX+K9Ms8CVTi3gyvebdFBERcdajTYrFf4mxuU3DO94kfsW9/4PNq4qlCr9MAf4Lwcy7qX/+ZEyfuuz2VCL/pM5V2rk633Gt99b+p7XPmAcQbUBZVlsn5Ae078mhh+qCCaf57yefYjSNkrhmhk1hIVpR; 25:I1ad4oT+54w6snMn3HS7hPX+PuCUSgvZcL2ixCWeJNWDl7b8MIlFl+Kym4gOcGVEaUh+R7mqqGMFrFJeiGxpXiG4EHJ0iUDt9gimXfpA2VVI2WXgt1skvVpGakRwdHmTRQ6ro4+LKebvsh+kgkb/eYgt5mx+jH+JoEUNArPybZoOQ+jc/YshGHVn0SmZLTM/289MtLgZQ/8Ei8Z8lOIcf3BZ/UxwnYnrTGQXwV8BR/m63QtU8xl6XZNax4EjeLnYrMU7e8utxCEdYmrU08PBxFbzQi7bPAI6zCWdHBs9gW4L6rN05UHuqDKaucDDizxHfDsTHShmhb0YUgIYC9tTTA==; 31:4Rfqzgf3wCGyMWPAgHraOSRx89T/wIHnQSgNMjk1cjcuuoY+/uVe7uv0igj1kQPkSzSQf9t+IvrO0dF7Ap8eN86U4OLx1By0y9f3bp0Z9wLe8oowL0bhiITNIvhu/vJi95q+1Hhb/RYoVv6kL3Tuiab0dVkDyAa7yLd/Y9MUcm7lnM+nyFpONCI19A9ZvHQIifkEJ7FY0h5lCP+o7xlvKstKjoFHhlZ802mvCQGAblk= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3798: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3798; 20:BCUum/SMz5vgtvam4gKUvdE3bXDe+2Fuio7RQ2aDQXEXuW2yv1T5QjoojAv5xopCdkIen8nIKZ+IvyqgrV78fbeYIW4TEeuKDar0rbcuR88NTA2LQDbfPrcuB/+Cw6ByRgQZhYxDZP26v/e3fUA2OU8vJB/u08703ro6aolEi/9hGRNu04pn3+ORH2N9o3gZgBnuQUJHlhqkFST44DCxjaXCgTs5le0SDaV5t3DfFcpTfBSVUMO/Ri5WNIs5T7Rn2p7wy27y8wwfMy4EQO9eoq7v+hp91IForsOkgQjDRifwAy+Kede0EercFMm8Xv6qW/S3sAQlWyu8etqfZOIzmR+ead2nZ9VPhjrzyd9S4VY7rQgC2B8/725tjLjr7XSSWMBvzaHAeYRjnju5Qm8pXW01SQsaKEWHhFhcQX2VrKz6ACQnKSuAHRBMh2AMC7vrRyP3di8W3zJoUl22tepT7nwM6R1V1RMeoRmRh3RbSAoipWIc2knvx6FDs5sioXVI; 4:qJCgcti99vif2H3Hw6mrlz2UCIxq2kAackJkzSRL6n2h9Zs8lo0Sc7+ttfsiGehlPm8rDiYGBe2aeUrxg4BTmdcu4K5/3SCT/NlvUivKaS9YtBTD13A4gZXYsWRTD+ogV2zbHvvIT51wPYHIpBHsqxqcisB6/epWTLjnfJwTrdKTIqW6VFkzy5uapFwwB7cxRbuA/z7n/WsKNjqrO6UEZBfs4GQRuLpfAp+0HDCJvPBUdW1MZbT0x55xKUru9TJ5la9EVKr5MB84ipEUKFwHRQ== 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)(105586002)(86362001)(97736004)(3846002)(6116002)(52116002)(53936002)(6666003)(50226002)(55016002)(4720700003)(33026002)(7736002)(2950100002)(36756003)(47776003)(478600001)(16526018)(8936002)(66066001)(316002)(110136005)(48376002)(50466002)(16586007)(25786009); 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:0TVF2XIoEYMUh8UuEFGvPJQLwj+TyyBV/VG+s0w?= =?us-ascii?Q?lc3LOYcP1BLe7pwh95xlJrC8VXjuVSLkBkXFzGACMfHwaYq2hSaifZJDHOPu?= =?us-ascii?Q?GkE1wPM9ACwv6VCMQQ5zDSXZ90C44Onug/pxfb47elWFwKgar5fdpLWWPGOx?= =?us-ascii?Q?+AqNEKgr6ByfH/wS6XjYKtynuccRIUNbWYdJnyV8h06LkqYcr7y8ozgFcayl?= =?us-ascii?Q?duSVJi/vA8WZqwloXvEGlJ4dLHygd1StTIHMOu2AXPj6b6ShA8PQ+UcP9mcj?= =?us-ascii?Q?kefExndSRyTO1m70o03jPONezDyNOjVNwHuvuGcf+qDuAqjqXiJZdiT09ZgU?= =?us-ascii?Q?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eUeEymGvnL2w7oFeiVymZi8sssGfsqxGVllLXyQ4sfvde+1dLsSFh23BE7VbdtnjCTT6+8OpJr0M9mwTqlJREZAf8W02DgYQJvAHldtakZRH/0Pi2eYoQC3msbUqxGup/NuMpjeZI+4mouOWlL5t76R9H+xhwQPzHNRxoErbC8kfCibor+7wzx/35RQg87tsLXmPRZX0EjdxxogonUXrEzX42XmLFz8ZHCyVP+jlf6qGZ6n67k00YOklWOucxPDA9SkC5aPWlzx76FdLFIE/uDB18FtPc+vhIf2e1QRWOW2AjR+X3r2SvCDxChdRakq8VGAJpuWMpabdIu/yR/zg8XOZlKReHo+lsfkpFFi/EEI=; 5:JwOgNbquty433QENm1jKOTXCz/mhIvtxfEPM0AAOeywuCBnsqlF32gG958JQPOQh0cUS79CR6u/wvQ/lfHNhd6V2RJfxu8iJJ3AyODeaUIgRTXIIKazuX6On0XrwOMjt/Fn5JD/4SPp3A/+uu8Si7zV6aKJHn4d1Mjm7bjLxR6M=; 24:0byNsa2gVM+dDs4Sv4pAD3o9SOd+eUFBE32lD3/LJMxWcg3wErlkDqgyCTTYZQ3OiSQRd1Ot8Wjv+7R9P7JTMmWcPrSYOJHC0V9p3Otky5M=; 7:uo2rPEU/E5up6fnV7y5hqzOqECr03ZehtpsWam7RGOuJzKbfdpbW9fGQ7CScCpEd/qgo0Oi/VMngUsURbB11l5U6vRNbf75BxTfqexD8Whg9BMlA4bC2oFaFqh4UhYFwwnwacU5VN9iX7SKn1lEU9v2T8/R7nSFNUM6J0CanSbOGA4qVHTxkElM48xuuOwAQFL27IVNiDwl5VOTRKfEjcWOppP86VSFIfm6BTzJ9AFVvH4viN1JKN1PdxmvfcT3y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 13:52:00.0313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c10085cd-5fb1-4cc4-36b4-08d55e7aa60a 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 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 13:52:02 -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 a1fb3fa..b049b75 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