From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0083.outbound.protection.outlook.com [104.47.0.83]) by dpdk.org (Postfix) with ESMTP id B36BC1B1D3 for ; Sun, 7 Jan 2018 10:46:32 +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=moHGrdNnS9jGxwkExyTfbmbXrbXoVaZO3DPOEM6aznA=; b=SOANVFEo2ztUmEQI8RMzCBP9wrkTdBsjOPzgIgh+960G51S70hfDwidnzKh6tzuL7DHYLk/nZoOYFzA7G4J3jInHjLXhUiAGoIVf4p/KnU8bye3R3U1l8fG7xkbc5pbQrK+8kubJPkvyHC960oFQxM3cUfNGTbaBpzqrvHTLUeI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM0PR0502MB3793.eurprd05.prod.outlook.com (2603:10a6:208:1e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Sun, 7 Jan 2018 09:46:30 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev Date: Sun, 7 Jan 2018 09:45:50 +0000 Message-Id: <1515318351-4756-6-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515318351-4756-1-git-send-email-matan@mellanox.com> References: <1511870281-15282-1-git-send-email-matan@mellanox.com> <1515318351-4756-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB3PR0202CA0016.eurprd02.prod.outlook.com (2603:10a6:8:1::29) To AM0PR0502MB3793.eurprd05.prod.outlook.com (2603:10a6:208:1e::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d4435ca5-60d7-47e4-084c-08d555b387f5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM0PR0502MB3793; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3793; 3:jks5yNHXWTfnF9IwHFthG5hlTkD6i500X6ZxCPLLqru6NgHT1q+TCOm1PvHVBKbuozPnosd3Q6t0OFpr2AE93RFuyPzod8D1chIJSOg6x5QJXvoUjxrL9Z1Et8e8156mmTgdE6WFA6FC3VZy3rRSrqH8pfN0XOgf9v3Ew1mJYanxymuMmwsUDqe3LGuYejLT9mWqY89it3R28ZoiZAjuZZDqFlQuTwaiUuRW0JfZU0MAXx1rXRyhtu+0DBdsY87M; 25:JljRCNtEvgHNUU7zyt5Qm+X5ZcF56QDqd92x1p8fQPmbpqFS++r8dTCftLWWzr4wIgRNCMfpacvHdCnfd+zdKYqlkx+dadJtzb9Qo8Wcw6zvToBTE/cMBHBW0W4urhpvF8pTgPd73V/mzh+RRQMlCLfAkB4JCCMKRWgGAx0RjlElJFcmh+eSz0LYfO8wGyX5oC+T7DNL7gPAxDKCSr19EHR+7St35GR1a1oeolSa3nQJGTGuUe/I5zyJUUUmx3wPpYh+x1SpcLTaYxmxCpNv4MMWU0L/taGzSG2ZBud21Jwue8utuU2wYH9XeuR46+lWvNQkCqw/7qDb/KlPuDRHJQ==; 31:AYxshjPLoefQFiWoibaZYcPrCCUiWGiK5SWqp+PsqlDmAnNT1OoBQtbCo3wMLWmyGBMiwYrlYBhL7w2nV7cTq9rmtzRZSyWeZTBi36X4jSFA9b95/Ym+ZA7NJECwvo9jDHOZ4Mm/xcov+/0HdUpEkVhkbsKB6w3V70cJwgTkWkt4Nrqiuq8MvVF2LLzgbtB6kQJBUs2yBIlv/Ddd3oFBcclGT3cYN1rO7tPJmemFN1o= X-MS-TrafficTypeDiagnostic: AM0PR0502MB3793: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3793; 20:4sV/1FMv069OB5oD4TEmjH4cBtwgSAeLx2SHINIWu7SZeId102LzKRiymhnWe2Zd0G4JV+zA5aXA4EtqniK0cJ0RMJ0XRXhy8bGpYg2PPnVY9tkUTMfTRBDlqGoNOeT6oUQiKzA7YPUQRvqbbARzJLbqcTYOGJDkx0Z+/3bHWA/ES4CwbFMyP6E8FapOg7wlXJKsWQpwLhzJJ8dXsMByhQjpecF965RM6BUS9XNL2ctByFTMoNarUcaGSVboga3btz/EAjbZklXZ8pRxD1dIt1JTJmBEiHORjeF9GLCyCUh64mYxqGNPa+Z8h4S5SUNaLN/7lQaMfw6X9D8uTQy5hjCVcARWRhmhJ50y7mftTYrT8+vAXjOrHcoGaGv4pPhweHhD65X5cGmS52KX5ipzelXMJCQR4lKU3+Qr4A6fabTYwjQkyekvaZeprV7sBkKBgaPxWOG1lbXu/FxX9zwzmgQ2db71EWInu5RiPKJURV+YjsmbjxR9kumzXLRRxB47; 4:CDNNB+eu27ENqgD1ntOoHZgtEhhx0HygL9p0xvpb2dDemJavgle5qzXVqYg9ODAwLpoPTi+VKchT/CmCfIIfllglZlNrXzINVW1UNEm3qALEqgk8zlcYs5HG9UkbLPaqAO9Dhmht1cQHfcZeQdD9da6vH1p8HRlaOPCOzbgUXh4vM6cAd8qaNFZ+S6a/4lZ3NZl+Ym5RHhWeSX3RvLX/jwNksSJVPuIGFKtPm3v/f7rVpwMuFcEQ4oMndXWCJqCrFruK41g+G7RrWSNHvNn5NSTagWAYcipJEeXIDxWROQCEw87Lr4iYV6wGzJFZvBzw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(60795455431006); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:AM0PR0502MB3793; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM0PR0502MB3793; X-Forefront-PRVS: 0545EFAC9A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(366004)(39860400002)(39380400002)(376002)(199004)(189003)(105586002)(66066001)(8676002)(305945005)(52116002)(47776003)(68736007)(7696005)(76176011)(7736002)(2950100002)(25786009)(81156014)(478600001)(69596002)(55016002)(106356001)(51416003)(48376002)(2906002)(4720700003)(6666003)(6116002)(81166006)(97736004)(50226002)(16586007)(54906003)(53936002)(33026002)(36756003)(50466002)(16526018)(5660300001)(4326008)(386003)(316002)(3846002)(21086003)(86362001)(110136005)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3793; 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; AM0PR0502MB3793; 23:LrtOksOc74HAhzvv7jcUUbB/Kh4zWJ+Cu6cNtsM?= =?us-ascii?Q?gz1y4CYQmQ9Wq/7B7Kk2vCy00k7BVLNf94XaQrIaXpSe+Uu5XCS7VoOxfxrJ?= =?us-ascii?Q?b0RLOLNdVXX6KmdUrRKecDgm7PNLGxjlCVnpDBf+yJoPD69g4Kn2mzb3KHdi?= =?us-ascii?Q?2kgiP8N2yneezDAidUz8IyLa5bxuhio7JBwB5YQcN+mhZ+ludoIwpd72iUZm?= =?us-ascii?Q?v1c/9gQxlXgnx2c7apZQwaWEeCMZEo/IMnmEnYW9tFNxQ5KjXG1oWDhIzDKq?= =?us-ascii?Q?/W3NJykosQVTuIIsy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q=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3793; 6:3XYsSgr4/i5SnqTMt0RAcsaIqlJCVBKi5nUSyNWrbJ61O/ozwgvZVs+UEdZHqnYRQvrp4F/Vgmj0CLgNlgzRuc3eO2RKMFz5LHskfHXI7EZk4p2REb/epbnnGBIF8/IKD88XJw5cjLLrwS7h7Ve44wuGvlkPWMoUoc0pWFpXIAPE1rJ8L1yVJHGVxTi+zvxRS+3Z88z4AmQfsNesk9S0fm/bGifzeKU/oUOsLid6zYPPFX4qBC3o3n0xYw8F7dK+cz+rnq4CedQGRhHdABLF4R/FwKonviGo24TbrGPPiiA8U/PwOZdq4E/FWDY1/da2lXIULTagKH4FEkizZSRzHF1I9ZWa3DpWIOU3BhkP5ys=; 5:3GKj9wja6ExPc9Y/lCoxRGO1hq9tBM+wrJ3GKu3rZrxmaNi6EBsWRESKq6LH6vBqafnRkYcX/RT8HC3uLZmyKUvAsF/Ygi53+9M+RbWWjB7hjAgHWPqLLpO5tzMhEbqEAW73gOJwk+YNikchuIt60M0BqB7Y0Ur1lFMMDUd+Ods=; 24:YpA8w4zeAgXF7P4nBFzj+E7chew3q4uzXjkog93mh9UxHd08ZzEsCuxoZdBuybpjHGOeuSce4IPE0yQJCqZlYDef/iwRN0Ls6q6NU8zVv5s=; 7:4Boxw44DI1/uN1Jl7XBWOnYeNwAgDgJP7idzMQ2d45pJix0DIdZzEa9VPnVMkzW1Dei+Y0vByOcMMcx+NYCSC1Hw9Ga8tv+fukoyFoHLpqJinnCvQUcqutrPl6803A/epn1tmLAhfVLBYsZbWaXPKmAwn9/yzOxkZ2Ucm1fVmewNJpTXssKtYlIodvdr6yqABwGYKZ3nu24mn50/RoqpxzDXYQn87PaeT9Ox72FwsrmsppbzTf0D/UhB6E/4SHan SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2018 09:46:30.1438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4435ca5-60d7-47e4-084c-08d555b387f5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3793 Subject: [dpdk-dev] [PATCH v2 5/6] 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: Sun, 07 Jan 2018 09:46:33 -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 --- drivers/net/failsafe/failsafe.c | 7 +++++++ drivers/net/failsafe/failsafe_eal.c | 10 ++++++++++ drivers/net/failsafe/failsafe_private.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 6bc5aba..d413c20 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -191,6 +191,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 19d26f5..b4628fb 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -69,6 +69,16 @@ ERROR("sub_device %d init went wrong", i); return -ENODEV; } + ret = rte_eth_dev_owner_set(j, &PRIV(dev)->my_owner); + if (ret) { + /* + * It is unexpected for a fail-safe sub-device + * to be owned by another DPDK entity. + */ + ERROR("sub_device %d owner set failed (%s)", i, + strerror(ret)); + return ret; + } 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 d81cc3c..9936875 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" @@ -139,6 +140,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