From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20073.outbound.protection.outlook.com [40.107.2.73]) by dpdk.org (Postfix) with ESMTP id 2F8C31B1C4 for ; Tue, 9 Jan 2018 15:48:00 +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=7631cudRPnjfhuElLDpEj7kXZFEbicBzc5KChHXgt+I=; b=Tqvx7y+DEMDBFbLGI0NrmTZVcyvKg35VqB/oGLePrV0l/Bp7ggKc733IxFOMPi7BOpoqGY7TurCs2siZCZZfUn4THxwtWByV6HqIdSWeWa6r/bVkjvcMP5J9yscmdEfz/87VoghYEUqxt7rv0OkpgL34oYL4FWM9WgbZgA4JRVM= 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:47:57 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Gaetan Rivet Date: Tue, 9 Jan 2018 14:47:28 +0000 Message-Id: <1515509253-17834-4-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: a38b2d58-02c7-41a9-cfec-08d5576ff9f0 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:B9uSCi00Aa9tFrsRKdbAf2SGlY8gV1OfaRRyBlqVibafMDq27/ca2E62AegpQlIiNL8Mmc2eADjcTn/HXa2g2/1NNlKn4kCtTfv278crSg6J5HYr4AInqZdaEbetokN1PYHwrhf29KIrHmvWVOGlpxvR0VJ4VGRqF8FaZGaEnckEgEawjWhnMX02VNhsADGLNNoJJxmNnsL82PKhNLDRYN3W9qk7j6Pf3TfBEbBb3izJScxho72BkWWzIyCk4+1F; 25:D/+4jImgaUh9QfYVAAP8CFRl7YdMkiiO4xjbDA7yBvWwwDjmCK/ab4c0iEzLAu1pWYrm8bPGvXSRGVjV0xrjh5eLmMxKCPhtHiP9csrfUhuVlx36z+saWGnonIPP6EJmwrVRqW5Y3vzmbc9Fh3UMRF0n+048YGo3UOVSb93iVvr+wtGmCdBd6QvSGdTBuF0bZXyWl/gVLjQcFdrZC32QqYzjMiH+OZShLi0sGe85VVb4dhpOvkVNJCgFC0WDFCgFJbz2m5wJJnJ21rY6B0Itq4Ip9LZvHRhbwjpRnbI3h/uZ2Gu4MO9t4GHObTYe2RK+c6H9jr8ZFbYCrGiKKFITXA==; 31:gHnmdvpJKEf2t0WYJtKokGIVROHFh//F8D8WMjcPyNJlH7N+WkkBR7LI3egbElCPDuvzfyw1bULnW3GllD3KnbOELnvule7ICIz10h9Kd6F5b7BAO5vtvVTSAQ59qfIJw6PZU4A8stuepdfzzxn4F8d3YgwFgAH/QHD10CSZErBO9oPxQ5ndKv0IX0uAlH6KXqvxd4JqoatwppvoXsDMROQc8mnah7LmXT4yXn+8Fws= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3799: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 20:3fKSWTYEwq+xW2uMfHV1SAYtQTp/i3J+CZnihB+lgGbalsuFavJBThCQBuURLVv+899CXaHzZsEfd2KQnNsYEdNnjU1JtR9WtJwPicOgoUPPkqMitELGrYi4WqxEy+UDH75O6C4llZpmJe/0U0GkYqpMKGYRSoHrAvsnR0cCnHqYnje2/IZtzjEgCap5HyekWb8S4t0+LlHLOOZ1avQ5eAO3JgJ8esWTVVqsG/hME3wjynGsvHheOLRuKKaPl+2SWxK/pic5Xpl9gwS98AjSdIXSh2L7bSr+YwC360YVwodb8GZZYkW1Z1uiFQTbTlxoAUzZZPx93o7szIW0VP7FkD87bZ5I3t8eLVWjKHyntTRntqbmNXuypQApj/JUJmotSmu/IGaamhVrdPoitM6dSAly1pGMcWC+Ps4qwCxgnahEAq2vNrGPySfRrA3MzS78w6vl1viefmBN9MqffqgIB6TtQKvSshpBCGGIghdQRhC2v6ppGJk16UDhghpST5i1; 4:1vR/w72Q42VXgiq0rbOlOsw8OdXcX1eVuBY86VyOtI9PrTuJxUtZP/WqlGZSPETMpS5mMbxKCEcu/i7xwFfNndnXbgNb0pM2phjczv72k74+09wlIZpEecOjxd+OO61yxj3oYYe1t3MgWtqzNNa3/IBrDylZ8Sw6DFERV1NMoIpyFoSpTMEy65OkseGqu2WaZr+2sPglZEBRkg+hc7/qtf6khAj9vMZ/YCqCIjsAN4V+68CVcE4VzXtURHph4tuJEHe2Zvi1cUMpCc0xWvZdDg== 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)(8936002)(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); 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:TMCAc2q5j49QaGlYwFqU+JFr3zUs5DU2WssImr/?= =?us-ascii?Q?YTZjH+s8XBefJLwAPL37YWmJ5cueORlXuHi+dgL1y3vuedLlSk8Lv6SoUzPE?= =?us-ascii?Q?S2iehtd6EtMqgTJl9churEBZBN8a2ggcidg+QrMpCetIyUESTE8jsHtuOcY/?= =?us-ascii?Q?KjujzbZTxU2AziZaqem1iwV4AvKaQLUZBtD2iqfy0bTheg+UtJglrGMbHryU?= =?us-ascii?Q?L7MZ/qZQ5mQlXTy1UOUAFHXS8n/r9sXWQYqxRpm5modFw2xhvf18r4zco1Cb?= =?us-ascii?Q?ZL+xZ83XsmGLGbRNWWmzbF6KA9ok46w6jBxhW+NqDgqGwdjTXvsM7+SQIY/Q?= =?us-ascii?Q?M151ZrP0llgh2PcRZBTB8Oa9/5xVPPA99m3xT+MVBIy3nV+kLQ0+/WRUH56m?= =?us-ascii?Q?12JRNAC4eikVWpiyD4GPksoHavg9iwJjLdRBiqhIhS1HkVY5/Dltp9pt3xyb?= =?us-ascii?Q?FHcKnH4Iqr3EXTPrP2jAA6qWurSfc3Ltl+48HzT3l40Jzn82bpn1/WJ5jTkK?= =?us-ascii?Q?51MYPTg1La1mGTmAf43N2veBIhTtJDGgbyPmVSSEU8B+ybKxw5fR3WUDWVkh?= =?us-ascii?Q?Vvqmn4elYDlng3rJGkknRa9wgHEdDyzBFkuKXN6n7Uyx2TF6ukbG5s2isBkM?= =?us-ascii?Q?lcgQL8VU/ceqzc1Xgep8OGzXGd1LLGocRbu6KdWbAKKc/lbJJmiTNnxBZD+5?= =?us-ascii?Q?BhX0yKTkW+627yKb5QYADB1sTy0WZHdvyl8dvb8JwlKdc2Pl7AvVVgPFt7lN?= =?us-ascii?Q?ZdkBcIrT9kXO1/EevMGgpBTvJkIsgGEFezwxbbKxqj1+SlXRJMrV8Cx+mCzJ?= =?us-ascii?Q?c7vJVs3ByNritWqIYkOeilNXeuNZOBns5VPq1A8BX106GZM9nOspgCAtLJ1+?= =?us-ascii?Q?N8RdrlhKEVesw7IQ12FFZpigRB/nXGVtryusC1f6WtVQO42UXD2HoCHToVUR?= =?us-ascii?Q?yDX/eAmZu0zqYveYrfeivKJdxiY40OjQSVI1Xin9tqn94+Ailkw4+gcpa2/Y?= =?us-ascii?Q?/cy6bGzoFctyX2rDu9gLQ6RaMzkm5nm5NBonR33Deu5nwT9yBpCz5QjqoWhP?= =?us-ascii?Q?5IclOIrD+T+IE05MGQparZMtpZRnk+PleGis0a84ozy2X+v2dC0YvcojX9Xh?= =?us-ascii?Q?oXaF4LhyPhCIokxbRv8IORboUdyo8rZ3+O+PVsule256NzO6OiLvlE0RoKSX?= =?us-ascii?Q?vBQqQ15p3D82Pvic=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 6:bNjwBPWCax8vA2jXvyfM+Lyh/1PhjsNQnFSzGpPaJp4+QWB1GUIEUQt+GA1QAPVM/dCOAboJXrA443/Ktub3OTZrUx1Z+gTYmRmrMHT3Brz8IOxvlLTgAmFGF8D+Q6emUXj2eFXix0bfPP/TtsneYBCiIFvmAB3LmeqMWShlWhNZES50ya9Lf+Z/znUUNMJoJk0iM3HPnMZ27vAw0zW1Y4Bw3czTZNI7enpugIzEKRZ3y0DJhMYXEAu+HmIaiks0ksB0o/18IgEWD1cipmMx+8S+2gb6EOkMm8GZkfu39AlukWk40z0reTo6crM3zkB0jo57eiLTycMEisOLvqJtsfToqfSpJ/I9sgnuB/PwCQg=; 5:JDLLF6eIWgQcf8ND6MnIu0+Ea1anuszW8+0PsH1ykwMPysVFcVTEAolGgCXkuzQhTFYJWtG5C8xtf6xNM+UU2wF9TiVlbte+Oify+lN8WueG2Bqpmad54SHMSOo0o+GkLbZLxjM0hgwibifOnx/mouGq0MEWQD5PwOshIG/U5ok=; 24:3kSvGhEzlynj3C2H6uJndSlFkbWf5FCawfsYYoB3MFh1vjGxl3XIGHXPTLwSBN0wchiBERcjMwDKBACqVSs0+7U8C2iP3Ig1ONqt0cjM/OQ=; 7:IU6BJfLDysHyNTyiTJWJyXeIqW24OskGt+sPEjUgYFvb6gnXp6/FMlPREBs09BDjpIIVzoyFHSRQgrl7tHNEzUsmdPEVbzG4bd1OvoD5xC2+mLtNbUNFj4p2I0Rx2shhgA3fj2f4GXXeSXDvaK2ryMvrV2DqJ/KxizR/ggiAQ/p7jlDiJGoym+d1MLW9bTV+efUt6JMWXQggm0QLAtLrAR6+pkcHaasB0/9wO2oBt+YZPW7h8qFn55V/Cw+CgEno SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 14:47:57.9556 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a38b2d58-02c7-41a9-cfec-08d5576ff9f0 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 3/8] net/failsafe: support probed sub-devices getting 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:00 -0000 Previous fail-safe code didn't support getting probed sub-devices 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 | 5 ++++ drivers/net/failsafe/failsafe_eal.c | 60 ++++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/doc/guides/nics/fail_safe.rst b/doc/guides/nics/fail_safe.rst index 5b1b47e..b89e53b 100644 --- a/doc/guides/nics/fail_safe.rst +++ b/doc/guides/nics/fail_safe.rst @@ -115,6 +115,11 @@ Fail-safe command line parameters order to take only the last line into account (unlike ``exec()``) at every probe attempt. +.. 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. + - **mac** parameter [MAC address] This parameter allows the user to set a default MAC address to the fail-safe diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index 19d26f5..7bc7453 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -36,39 +36,59 @@ #include "failsafe_private.h" static int +fs_get_port_by_device_name(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_get_port_by_device_name(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_get_port_by_device_name(da->name, &pid) != 0) { + ERROR("sub_device %d init went wrong", i); + return -ENODEV; + } + } else { + /* Take control of device probed by EAL options. */ + DEBUG("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; -- 1.8.3.1