From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0070.outbound.protection.outlook.com [104.47.1.70]) by dpdk.org (Postfix) with ESMTP id 0FF471B16F for ; Thu, 18 Jan 2018 09:44:09 +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=WHT6VNOhHic0q4d6SjBeFqIPmNcI8Pkfr9NfsB0Tr2Y=; b=IgWZ4HEMD3dKrMk3ekb7jLXBNWz85lGlIVNEEitwND9WDfPBsvLbRYab9el6JilRpK+0FtDc3Aq6YU2hcIseLYFfHUL0oAABLfLljgQI9V4t1cXU8F6w9DdZ8dlQC3YYNTvGkeQif+TOk6hsttyM4Qm1P6uUD3nMbtqTwksINkw= 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:08 +0000 From: Matan Azrad To: Ferruh Yigit Cc: Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org, Gaetan Rivet Date: Thu, 18 Jan 2018 08:43:41 +0000 Message-Id: <1516265026-6469-4-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: 901fd484-e256-4164-0de5-08d55e4fa3e7 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:QkPK6NMD4ixQkoS/Hm0A9vrUNoYC0Ayp/T2oecpnh9OZICLZgZCRkUxK8GGzVNwyOhjV4BOfvuWrZ4JLqRrGkze04V5fTomWKeR2Qj4jDPYeErqAgNdj0ALbLrpWP65QQq75OvkS8OrJ9ZRw9IsiL5dq8ulrdw/BmY8vNVD5D4u3EwC+/rds94gBOlXiwaGyb4hYtqXzLRn9e9Z20GYP5/T9aCzvtvmYVWnsmqq1yK0gYTOfwDrHmBYGCjBO5KAj; 25:+0HCjN6OMvYUrLteKgAAF10RBqaeFYFA/f2xijd4dkYIOp6PH09HwwL3doPR3C+BFDWSiVee9ibelO16iMz3qm7mSLOJ+wKiMZ9XwUPZq1m05cxRMFPHX9gO6IB92vcAkFyrWNieW5Mz+3k9mjwZWkFUT2lreQEqo8DG1BJsNmDumO9T/DXSo/s8+n4PlUqpIz08TfZtkA3ftGuH+J8r25LLt/ms6NQt0qi40JcPPkW4CRw4Fi8qHonSNYg3IFUxSSj+EwZ5WLbjD1EQKYsXOvu1awp1hz64yZxLiPDAD3dZW6Fd4mOICXvEOKZ+P0mcm6Z6aGtIvkMLPSgvd+A4TA==; 31:i8FgUOxWVoqcCmS+8oBCfX7/NWFZ65/2YCGN+IG3w2dz/arMgFeFW2IBI2tP2cREQP9XQAcEx7h96NnKLnsQkf+wiiz3v5HDlLfqaSbyn60m6lJiMmpXoC0oYYeFNHWqUZZGHqvZhg6UfRthYIwAaV/UMxIS7ECHdQNFOdQg/s9I1COI2hsOo5xwSZ/QbDnL9+FhpLn6zhSe3VHjq7LiT2e9HISGfL2eUMv9apE8yvU= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:YUHvO9zAGDrh70iM+7SIJeToJdkt3A1JqRvIzP4gywKJSfkXOpf1b3GQJA0KQmODBkqQeRKw+5md+mh2Dxb6Z48pRw36uAbnftMC0ntsirpnJ5HjIL/Rcw/6LJBLjlWyu/RcnN4XQmrf5kiIID9BmBTvambFDe2hBH/Vpj7PE+QRHKvb3CGC12V5ykHBQ2BtgZlvJbLPA36jmkyk1L6blGfpDnXXkse0P8/wIIPqO22amJHOrJysR/TqI1DhuwItrCix59BxaKJi+STU8HOjtx0hLJodujNLzP5Ctd2B8jDCjUBxy/tNgSShN2ebf8HSbR/j8FklOwcibHjuR6KBHI7ouVU5gAToXzavSqW3SDq++iJ7SXAcrA3TQbCPnkSuz+RhBzkuTMg6j76Y89RGQuUup9suvIiwikgMOWXGpMK53uTak35J/S44NM7mROqfOaay+Et2IPgX9iboKrLYAt0BDqSho22ZPUnY3n6UWoP6eKbHgNjv33GjNk/PscC0; 4:aJm5jVNtzX4GrmmHwiCxgRIxNAjltCncfDiKaG85AFPeqmKELoj1TLfR6uzS8fXU93w/yu0Rrn9wZlOLcg4zULtd/EEgwR1ZUE/bCEOuS9lJ9og0dQQXL9Z7Anb2XZBSr5u9BXEk1yTPHy0nn9MPGVnnrfseEnGrRozRAJO66zxjuyxUQjbzFVB6Ap93i/GFdWAQzMIWDE/CZ7+JlAOxxkEtYtwT23mKCDuNp0Ios98xgF66FNYJIeSPOsYOLfWc8IXbWaq4Zbf9Le8PUuMbUQ== 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)(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)(54906003)(8676002)(316002)(478600001); 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:uOOI6DguEvXWT1yQlDxnDc3zR2XuL9dYBW0849a?= =?us-ascii?Q?88TzOtV3UJDsIQvY25c1m1GkuMlABy2fpin5cB9XqpMpEz5/AwkuvQ1fJjez?= =?us-ascii?Q?kJTCaTkc4Ib+/SRle9KRu1uVR0nSGzaUVHf8J5soUTtKjb5KZPxVzsuY6W5q?= =?us-ascii?Q?gCYtmz6esWF/srZKXqMLplpMOQu4Ms+XKtpHmUza/w6umZSCbq+Sdv44bXfP?= =?us-ascii?Q?uQBlKcbGDRfi1uAyvHJckspMRz8rpAjPnXGffBlfNiWxfASXNqFG+SUrc4Hc?= =?us-ascii?Q?RmFCDjmJjL4dc2gc2tNgblGNd74q2B4x1WejbrS7nv+gJUbwDrxDO+9Uccpv?= =?us-ascii?Q?QD+CpKvdnG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ange-Diagnostics: 1; AM6PR0502MB3797; 6:I8RE7WSbjOyublZ8rZje7uzogl7O4BXSw+7+af8o5JKQR0gZGRPopeSEL33/Xub37Kz56Yu5QAcWPTPIi7diVf0zm7LrtOYJ3/Kk2I8iQ0gH/LjlsbmRHxBMeCZBsb0UdAfpXON8joEWvhCtdRzACfyY4ZnZRX6BPe5Sbr70dEr5TYouagvKkMwfwzGDT1P3CGSzYaAlbV+LfLc8ln87bR/TBFk0kQqXEUiM91uhj9NonquAx/ROz3DacpjuUJ/w5qDst+qCWsJdL4bVbJNbynSC08mreWw+u488jA/Q6gWBWH23JjEmwpr0oW8LkehR1371p/VWSAXYXGhDygZondcA5dFTWxg2/Abut2sN4WU=; 5:JkvtwG2PU0o4j0nwuZ42hobyIQx7yrO4vJg5gHEiKQBiat/gUwBmZuXwhZefNTDmQG3VrOTa69kb38tBgxnICO+KUNNH3zgcM4RD7UJe3Y4/1pdQaOO0nt0LjSIRR7UxItCPgXKDVypiZjWvc1d11R5SvjANsoAcvN6InnSDx2I=; 24:/VC7gTyr0nRsyToZPuZCC0UA64qLDFDO4zCGQdSr+xFacqQzi+WORv/ax7rgpUB9bw49sOhzpZUMPWOyEnBSLj+FGdse3A9jUXJDRxWDYKE=; 7:YHFKjfsgNsii/YAhTbj1AFG0HKH6S7/NCl+Oj/2Lwrm8wGHkkCm1LeIX3w0ZGEJYggzrKIl2kgnvc0EjjZdZiSgAkZaY4xZmFMyMMEVGGzHBWi2vuwElz8htpKlnoDWsRKTuJL6CTjRIVAgbmaQ4PN/asY57/bhP1+AJg1xDCA+MxkoAeTOP202IevixkDiESB37hBEfmvGuAgIWHx+mTeUInO3d0vydFzvogbLWjyGic+l1XwNcmaZELpphRKOc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 08:44:08.0705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 901fd484-e256-4164-0de5-08d55e4fa3e7 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 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 08:44:10 -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 | 5 +++ drivers/net/failsafe/failsafe_args.c | 2 - drivers/net/failsafe/failsafe_eal.c | 78 ++++++++++++++++++++++++--------- drivers/net/failsafe/failsafe_private.h | 2 + 4 files changed, 65 insertions(+), 22 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_args.c b/drivers/net/failsafe/failsafe_args.c index db5235b..daf5ed0 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