From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10075.outbound.protection.outlook.com [40.107.1.75]) by dpdk.org (Postfix) with ESMTP id 93F621B362 for ; Thu, 18 Jan 2018 17:35:40 +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=ZOzk2iJk2R+RtPkzqqet9/4PSL54F2RF0bEEyoExtcqRLPUDjpGp0hDaou93FO3OxHIK7NEk2V6TafYr/8f9OMbbMe/r33YFe3JwSd+/vYmCIaCWsbvPtZyMEi9uCKyJYmiv7hhauSca4oNRub6IxNNfytvCEp+pWWiwBmsfwnU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0502MB3806.eurprd05.prod.outlook.com (2603:10a6:803:12::19) 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 16:35:38 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev Date: Thu, 18 Jan 2018 16:35:16 +0000 Message-Id: <1516293317-30748-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516293317-30748-1-git-send-email-matan@mellanox.com> References: <1515318351-4756-1-git-send-email-matan@mellanox.com> <1516293317-30748-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0802CA0021.eurprd08.prod.outlook.com (2603:10a6:800:aa::31) To VI1PR0502MB3806.eurprd05.prod.outlook.com (2603:10a6:803:12::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f283cd61-4846-4b82-b2b6-08d55e91825e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:VI1PR0502MB3806; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3806; 3:St6ID0AQaj0oUCkcxRAjo6vcWM0w0M0p7NlMhCYx/triU7VosvqlYib/TDAiXn74KUOGSlkcFOLg74FbLTrA3cPIhZ8hbuo5Jkia5HaPP+vMa4Yaunf3YHz6RFMqjDFo4fIXZNSSYkgSQQlVGfwuLeMRzpk22Oa3rSK0yIqCe0p5PJYnz/CkkAcrrEdTqEVKLFqgbZkTvC4n23dTaxU1hMgjw0EDuv5/alM4yAqQC6U4Zz7msNa0nKGCeMtTNwxf; 25:zXRAGh0OdJEiMJs/Udb1hlKL+TRKl+oK9BIPADND9tgbmrp7spY8lE4RZJM9dKx2zYHc8etTIJ2ZqjfbGz2l9BKZLifs2EjtoysSbrdjbfNUIJCdVK9KI8osU5lDuKl0UOTSh7obqV2HDKV51YcNGwuS/FYI5vMQgDMlgkjuyhzs3IdH5bl36GXWFVRKMgG0KOQ2IBLm/jf1I4k+iy5nIwx9SxpXqiIqZsHM+j9RA+U1d+UcQ10ICSRWKcTrCpZE4oCTuw3XEQBgUK2/ryTNuhOYhmGLUVOzEkysNlIW/IAQiRALNBt08uoQNR0lRjFizCZDpRRWsx1rCyUmt7OxQQ==; 31:nGizWSD5DzJImT3+8MdJDbU6cxAUURGQIU9/xOF6jxuZDtlZmgmBO4mwsfreOQixkAD11f+hmOCuifLqccXqajbEv557CkAkTT8UpG31Mpa+7kf72+UATMvoRZ7LNNZqzGrOTwjg71lk2XrWZMoKNCbrXLAH9WeF1SMRLzfiVN217UYLHfJDouCCOpvi9DrMRfKhSoypQ4rovVCNgCbmjjMrZ1BaNt7Mmo4L1SK+iKQ= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3806: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3806; 20:3bFP8RbNs1iGcCQsUYdIgQJGcREqMV2BYfaWZrDIcwaWntP+HfDk25gMoDGFmY7DMsRQ9G+Z52yBP1C4k/5++KfHyCm9FJNsH71255jZ1+VyK4uIBaPtH6RvtatDTi+j2dUKkJ8tluA2ClHWigFIYqv8qjRFLs+d+caL0rUg/sv6fIy76FdeuWKmOflEXN2htfJArk4walrMAAq8vKWTv5PJMfC8XkdsPmmJyUntDKSNIMKKVioqU91EIhC2gSyWa9c9v2y8xap8X1pNl1HSU19T93/VCcaT27wD957X8ARYcTd55A0VE4Jq6XUkXHhdUJUy8mFqO/9Me8GkXbzJ7roTs0Hrys4KLhzgz1YiQg2UyVEwSZStCAxEq8+0lNgAO57mE9SMVburft1CZ3TFPh+njGyDZrY3X0Sa+pYfkIMNhrwxgu6TNkotCHRWB77zydH1o0HMuRD40ci8TQB3tUwF9wBVI6JfDnzsnaMJOdk4kcKb5qpekn4t1bCozmg+; 4:hwJN0yhYcyjrvaxfi+8h4anf70VJs/kvDInb0L4kUEGrbkUKN//DeZB2GmtlxQkIH4TjA/J4q9QphP24azYs4AHkgsAwSyXo1MekHO1ZoIjM1Pzc9qMYG087Ji7vfPga4dOxJzL1ftU/gOBWeTxRZ8CxxTeiA6LpPuXKQp2I14j8EtURvUK+/D9hsfT48HsLwpRwLkWNoWyW4ax4QYu6+CPxT12t/XsNF+OKd73dfLelqoIifuXO3jP2cS6/cHmIPOCGTWNRSv0ryK62jyw0sYskE8YAOa7Q3FlSJ3V+glKlz2yWvbqvOnKtpksnI7q3 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)(93006095)(93001095)(10201501046)(3002001)(3231023)(2400064)(944501161)(6055026)(6041268)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0502MB3806; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0502MB3806; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(396003)(376002)(39380400002)(366004)(189003)(199004)(2950100002)(47776003)(4720700003)(478600001)(21086003)(50466002)(86362001)(106356001)(7736002)(16586007)(76176011)(305945005)(36756003)(3846002)(25786009)(386003)(52116002)(55016002)(7696005)(4326008)(97736004)(33026002)(51416003)(54906003)(53936002)(68736007)(16526018)(6116002)(316002)(105586002)(110136005)(5660300001)(2906002)(6666003)(66066001)(50226002)(81156014)(81166006)(48376002)(69596002)(8676002)(26005)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3806; 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; VI1PR0502MB3806; 23:CqzwDG7Rvuh+3PxAhgalaOSZFaPdypdPez905cd?= =?us-ascii?Q?H28EXmXnxepMtoXJ1YiqxynR1IG+tu7APPb6fjkRF/PJnN8akesaXHNB2mEt?= =?us-ascii?Q?nbAuJCGgvG03r8jXFqWo8uYm/+U1gAv4G2g2mcuiPAClYFAduIGeA74gkmdR?= =?us-ascii?Q?rYWckWiNXpidCFXm+XD6rqHzpgQVGxBv2F66Mh4LRVdrGp1P72QxwOUQMw/y?= =?us-ascii?Q?j9JsbcRGJWiI06d6IIDILlB97zTP47aUwU/JQ1tDX9ThIYXFeL1WQ1q3b6q8?= =?us-ascii?Q?7a6/jxlhWOuDoPnao9n/v8BbcJI9oI7xSZt1qoXTAkfUwQmS0C9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Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3806; 6:6XxS9fAy87rnPY29x+JgSeOu+rKUgg291iW5zc5+Zp4Fyg2GU2UJ4tasrLKGECoxMlL6ImECKtIRmnPpOwKoQrjbgUGibvuqCU904MZA4rEoDK/Te8QrzDPUF1cSu+R207xORzng9YPgz1Dyvt9ZyTfgLFuEXNxLHV2jON+zv++qphJlP8Jucsnkrv/embuplCha6GtgaMcesAoHOh+sgz3k6g2oJqz/87l6vMRiLv33XNUMJAYl6+rbbyIWwODvNs5YByzBLhOJFcHiT4VqLEUaGAWkrLN6ykCGPXMePU7wpNb1bawXi6kj9Yg4/yR9gzkRqZqaA/DzRcLXZd18i7lU/La7SEHit4Mk12jESaA=; 5:EPMJtPcAqERiYN31EpzQN3U5qBmDYJ70on6f7Y8COu7WAiy6Yuk6yXbfDjcN2jKwx5JvhkylT7Bcx/92T2ufd6CJE3ILIlAKQduR5c5TfWuCU1mqos+KOyb68cnZIzdMxJTZhyw/cTLH4MxUTSpMgH+ejllnd+gBHeIuMYc74Gk=; 24:qU0KuSup/FRe7uUx35D7/xkYZk/enQYSbsu3ja8mMDwW0Twl07R59Dp7oezp6OJPBuNj38BdDvNQ/lUNBBvk7R2JhO5TpDbApkzKxGnE6h8=; 7:thuZlaLbWg+Tc+b+Yr4yolRb4Xmji0MfNDmzOEpFBFdSvarf963C5oPyp0Jz+Qg0fjsDFXQ1K1RlWnhvbIG3EjvIVNHh6WsTYKfRjHpR5Zn63lckmxwR071eLsT6Ez/EzLMLzQAuWrmPe/OGDzU9/JZ9r07wKkOSytS+bYEcJO9Qcb6jSxl4TKBS8Esuc7K0lGv1/2NyDqjnk27n2ihTu5O2RARLTXazlYvAXscmnKxR4IkoGfVqndt7e62ORMiz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 16:35:38.5649 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f283cd61-4846-4b82-b2b6-08d55e91825e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3806 Subject: [dpdk-dev] [PATCH v3 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: Thu, 18 Jan 2018 16:35:40 -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