From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60079.outbound.protection.outlook.com [40.107.6.79]) by dpdk.org (Postfix) with ESMTP id 9DB3E1B016 for ; Sat, 20 Jan 2018 22:24:52 +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=Z7PC2DTk/vhE0G+qHfelAIBzwJVjvivC9kOPsO3q/jU=; b=TISl7eEvL8SH8+tpje04YyVh/Y42KY+/HHeoROXb3OgykBPIMv4PJ1TW1zafBnUAemBefjIXYajMC1gWEOqlQ2JL1EXnW1rdptDVcWBVJuBoXl8B8AMathjGU/p3A7i2ScsIwW0QDkUFYbF/6cnAv82oTGKBnSViCDzq6dXphZQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3804.eurprd05.prod.outlook.com (2603:10a6:7:86::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Sat, 20 Jan 2018 21:24:50 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev Date: Sat, 20 Jan 2018 21:24:27 +0000 Message-Id: <1516483468-9048-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516483468-9048-1-git-send-email-matan@mellanox.com> References: <1516293317-30748-1-git-send-email-matan@mellanox.com> <1516483468-9048-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0402CA0047.eurprd04.prod.outlook.com (2603:10a6:7:7c::36) To HE1PR0502MB3804.eurprd05.prod.outlook.com (2603:10a6:7:86::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b239052-c542-4269-425a-08d5604c3df9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:HE1PR0502MB3804; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 3:Bu4J+/LMQQTuVsrO+ye3he1HZn5ldSiAw9K0cnmy6wiKDEzVWDUlhEXVWyqpb1hJstJ8OZBOLtiYooPPrIft00iFizHRc64FmmHvOxAw6ePBaz+epfkZ15XtSmwapaL0Kus3drWkqORlqisomGylKjgbmguJnsAPhMjetBvbjX0edKeDJhL6amZDNvNTd29zaQnmHqYXXTNj73XkyUh3I83a+OZLjPbTarQrJlVJ2TVuJJ0WbDnCv+RRu8qR/8bb; 25:tTnvhjJrHtg0WBP++DWwn/z2ACRzfmxqhCdnrfrs1dG3hNX7ft4qqFJ6YiQrWd2AVzsPO+hnkhOosQSAOdRj7uSzCJqWVju7PPJLy3QgdoEGoqLxk50DRV35/mj4LCzImKr5BnwNNolG9Lu3veHEy1+3IL99xEd+e3HWatCGM9RrbylXptzrjhLtZ4qvz7fMqjhp7g+u3g05zsGkDdsj2dJxLd8KOjo9k1CmLR5YVWSfH8l0DMCg/gf7JJby2AwJmvjtoVNeAEzehEH7+1bti2hm82iJHgWcD5zbt7yEbJrjoNcFr3mV3g/NqNG9WZ4Wgz3vsT8P04cRdm8iQD6reQ==; 31:rXwToa0/5+/2m6sVRnNdFttSU8nKwozM6LRvZV/Wd3vvLfVrEG/1cLnssd8d/92DqaxLhRMFO8WBOGYjSjif6YHFFHn4MkmbMxXEbliiPCBIs9Qp5cUJz6Uv4VegNKCk2jnmn8lGVAualTtKqOewmuXUNoWpaoH/Yxv9KQgaBKhXAioLsuQLfM2J+z2e8sMt3/BtAbrxgz/B2OK6q8R8ThPl6BTvh0ZF8rj4zeSoMLE= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3804: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 20:v3d+JyRzvrtZOaJP8XncE3jAq57MsXw/sRKbdQNeBExyhwMKUYaxz9zguoeNfSKRJ8ME613OSaODNp96EPMcM+tFEEeo+AuG1e2uDeaAGUT6ojOn8YYj3JNnVRWMafNwhaGFzC1v7vLxyabNDSydvRFypOuv2SjhEt8Ratdyf9hr9CauyYORQUeJC/X2mlSuVtw0NIz3Kk5f0YaucVi0tWv+SUgaW3FCkdU2u92Hnm8gjRxis8aFyB5tbNITXvwpxQmAbB2OTjvl9t1Fi7GUI43pNX9nbTCCYzhSyCVa6jqy3e24Or+UuvRqJCub0yzswXirPYc5Mrl3wfk5b8hZkl9mstPcYC3UpHvACxv9s74hKVXLJqYcA2d1VBUgJHpftDlemIvW4MR2ABNpLEArfo3Aa6eQforPqkElwZJlsEBXXmIlWjy9Ibqo5qJo8EcA9KVdLjeUKsLhhjZgAUs1gtqmHYuqG75BdwVVPYw93+htJI/TZLtWnRl1kVd/K3QF; 4:w6RV5HEdIC2IGkVD39UWyZmpBWAvbdCPmNakAV1bV7SDoAjqTA7BhJQ86w4turp42ZYuX7QsJ/xSPpGhxD7VqLs0lU3vQHhvO3AWcjA/wuu779As6lFmpJZ91LHrbKFMeMLeRXQ32tneMUKbthqehEVYr5IccPfEDdQkBeOHJWAmcmLjExBJ08+ciGrDj4uF13Cv7Pn+94GXlmcnAShJFnXBRG4rzabjjQcuXPQgV+/AEQ0kowhoJO8z4Le+6xUFhJ2zJcgDnjZv6KgU+NmC9+EuqikXHzd7t7+0rVLpcqq1dDNNCry51Q5eLboureAw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(60795455431006); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231023)(2400081)(944501161)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0502MB3804; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0502MB3804; X-Forefront-PRVS: 0558D3C5AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(376002)(366004)(346002)(199004)(189003)(97736004)(53936002)(26005)(8676002)(305945005)(66066001)(2950100002)(6666003)(69596002)(86362001)(55016002)(68736007)(50466002)(4720700003)(21086003)(48376002)(6116002)(50226002)(478600001)(25786009)(36756003)(2906002)(5660300001)(4326008)(47776003)(110136005)(52116002)(54906003)(33026002)(105586002)(8936002)(81166006)(386003)(7736002)(106356001)(316002)(81156014)(16526018)(7696005)(51416003)(76176011)(3846002)(16586007); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3804; 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; HE1PR0502MB3804; 23:3ps+apaHtrOoLjOP3gCzygfqZF1IFSLvVSDFlox?= =?us-ascii?Q?XFBwPRHTn499YM+fPQrMKj898VdgloFjP0JJmnI3NUkC35KdkGaDWFYSgCj5?= =?us-ascii?Q?j8a1SARbN/RR8yo7I6PdesthBZu4c27ljDPAtl2pSkLOhL/hIruu5nG7k2kD?= =?us-ascii?Q?9CKZxHBjxwB+VtCCQ/FVVff35x5bbIXWGNlDj37go2cNQwriT9rN/Q1d8ftI?= =?us-ascii?Q?jTp6c0NexKvvoAU+Jv/d6Ufi/nb+M7/AYe4nEPKgu4rtB+1PH0PcsR5OVPge?= =?us-ascii?Q?nMxJNNQ3BZCCuwVk6NZ/rnvdidtjCVXnGzQslfhGn4kz+noHYyNSE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D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 6:ZvBEQTiLGICS8m3ZrChuu9b12pGfnPheucr0RRrQs7rcyiz9nJ/Ogp1/O0kyfxxgnPbLtD/j2ZNVH1F9+rAOR8eorxZ3UdxPU7QRElwpzq8sIiDesYwy50lCdrRcNxhvZdasP4nNw6pk8tWoDu0wDzTRuSkNZSgXA3yxS1W7SjT0AKzCej2NfL1SHmh3sw/M2CGkSjwx05aiGEDey5LBi4Zghu9XSFbWNUwBkGqBPZUr5WsXrqMG6HAuOIqHj6VHZMy3nan/8WkwB0edM7ZtBFav2KT+X7urpaUefuVN8c9ts78GlOJDpbwPQiuGlnT/sv19YP0xmSX8s9cs1CUefzYE+/Heo7ppY23ysECBdCY=; 5:OPV3smEjt7chxzcbWlBRlKrUPupdc+HHtp3YS4bN5LRfphXmkxFcD+S57fDKwINwFIWf1gAYlKod/IwwCh8feNPqndwAFLUCj0DVTu88wQ57F4T0hw8IbrQ52QqrEbKNZ6Yy8jc5WNIVFmUpjj78ZjfiJjdqMbaKIdSaFfoDcp8=; 24:vHUXeqXPPTyZIQOWrR2CKN+kV1yUfbyGK2pLk54xANw7Q4ZeSqZPMWpMIePNZFywtESYjXfjVhIYBbQDNJny2Xdc3PO/KHUeTvu9vIVqG2A=; 7:GrpGbRBWJBVjf9oJB1S2K9TmyAG0t6ZXeeG5Dfsj2VvYRDze+nEcdIJmj/7PdimgiOQy2bGPOI92dMmojurnbTtsybEI5SduAMLndWUTbkQnUPsA+SwaAnFm67yRd0GdpnS0ldAFJv3MHfnWZhILVHzykzPzlG2m6WIUFSPWelgzcSCJFrFMDg+JoQEXBXgiLY/yliT8s4q2jxlgfeC7wZPX7vzRqIRqrBXDDsfrB9y5WI5pFEW84IqHioPLbD6i SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2018 21:24:50.4288 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b239052-c542-4269-425a-08d5604c3df9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3804 Subject: [dpdk-dev] [PATCH v4 6/7] net/failsafe: use ownership mechanism to own ports 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: Sat, 20 Jan 2018 21:24:53 -0000 Fail-safe PMD sub devices management is based on ethdev port mechanism. So, the sub-devices management structures are exposed to other DPDK entities which may use them in parallel to fail-safe PMD. Use the new port ownership mechanism to avoid multiple managments of fail-safe PMD sub-devices. Signed-off-by: Matan Azrad Acked-by: Gaetan Rivet --- drivers/net/failsafe/failsafe.c | 7 +++++++ drivers/net/failsafe/failsafe_eal.c | 6 ++++++ drivers/net/failsafe/failsafe_private.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index b767352..a1e1c7a 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -196,6 +196,13 @@ ret = failsafe_args_parse(dev, params); if (ret) goto free_subs; + ret = rte_eth_dev_owner_new(&priv->my_owner.id); + if (ret) { + ERROR("Failed to get unique owner identifier"); + goto free_args; + } + snprintf(priv->my_owner.name, sizeof(priv->my_owner.name), + FAILSAFE_OWNER_NAME); ret = failsafe_eal_init(dev); if (ret) goto free_args; diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index 33a5adf..5f3da06 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -106,6 +106,12 @@ INFO("Taking control of a probed sub device" " %d named %s", i, da->name); } + ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner); + if (ret) { + INFO("sub_device %d owner set failed (%s)," + " will try again later", i, strerror(ret)); + continue; + } ETH(sdev) = &rte_eth_devices[pid]; SUB_ID(sdev) = i; sdev->fs_dev = dev; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 4916365..b377046 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -42,6 +42,7 @@ #include #define FAILSAFE_DRIVER_NAME "Fail-safe PMD" +#define FAILSAFE_OWNER_NAME "Fail-safe" #define PMD_FAILSAFE_MAC_KVARG "mac" #define PMD_FAILSAFE_HOTPLUG_POLL_KVARG "hotplug_poll" @@ -145,6 +146,7 @@ struct fs_priv { uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR]; /* current capabilities */ struct rte_eth_dev_info infos; + struct rte_eth_dev_owner my_owner; /* Unique owner. */ /* * Fail-safe state machine. * This level will be tracking state of the EAL and eth -- 1.8.3.1