From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30086.outbound.protection.outlook.com [40.107.3.86]) by dpdk.org (Postfix) with ESMTP id 27502A48B for ; Mon, 22 Jan 2018 17:38:53 +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=5s++c80sQCLlgXqBnIXbOjoYnDNQJ3+TgmfuIT8DVVw=; b=cbRyXZvvjtNbFjZGRjF2Cc1iQ46i3LkQUbU3zD1WFMBPzHD5NOUl94g+9XVqiL2psd3al47egn7sDbH+GaUfJPGRbL8F0/0G0Ci710q+77cF9WuDFwNiqFrLqV4otrvO/mW+IRxytaseLETVdZ5g0yUgoz16Fx4VlAIGe+qma+A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3802.eurprd05.prod.outlook.com (2603:10a6:7:86::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Mon, 22 Jan 2018 16:38:49 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev Date: Mon, 22 Jan 2018 16:38:22 +0000 Message-Id: <1516639103-27166-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516639103-27166-1-git-send-email-matan@mellanox.com> References: <1516483468-9048-1-git-send-email-matan@mellanox.com> <1516639103-27166-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0102CA0058.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::35) To HE1PR0502MB3802.eurprd05.prod.outlook.com (2603:10a6:7:86::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b98672fd-97c7-46f5-90f0-08d561b69e50 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:HE1PR0502MB3802; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3802; 3:nPaxLaXarBaYqNvrOchL5kjPbZj+an7XPO30f+IB875It0OF6a8j8JoiAYfqegLpPIU6SxN54bYfOAxCt6LB2OavDS9qsho+2NOIdLmKjYeHzEUcq5Ei+S0t9kNnLsbzdwAnLlFdGibLiL879SDttjDGqbAi9WddnzOkwK13hPavnqXEIhkR72XviuXra+Npbqa0n/6z9p+hPi5tKQjdr8j5rbSOQy8BsuExCBL+wNaSEhieduCZ84AIM/8E51Ge; 25:xRri0qSMwDIPOg92s+pABdxCe1tR3p82Zl+XmYv6oycZSqDePQeiLOQHvc0r+/H3hrIIJTcmc/smwKxBZjQkwOBhe5TedaXDDIin7mllZaZYzMgk+yB2Kv/9l1ieFx+c3gcu1FPeuI8Ra7yNsKfDn9cBy9K9+nPvGPjh0pQUcK6Yz3451DYP0RZYi3yaulbbqMQnwG/bHnoMq6J2iLfy+wuz0EE0qhlXWe8RPAsujCShuBInldNNvRWjVQu5uMb5PmbAXzdBXnIw/7hnEArj2csD/5RHS9H/r+1LQBbO88buTyvRqugFct4LlPyZRdW0vCmJQSoJCLFSdrsvVroaTg==; 31:GCQudeRbvVE5zxmGn/isV959od42vofPI+58xnbya+rWyV4k6B7UcHUyWNoX0RqnANI5a56Ab6Dn8auTYp1EbJ+MKZxSagLkUhb4CGfo67b7yHnfSd4g8tA8hxSVzpInFVkatRiOl8BTyrdrLospIQIpZsmicoX6RMMR/IP8E4tLa3QKTJz7KwvaIc+njees3t7B1wpoLUAeIj9H9XqKMwMirAQnYBPxjbew3JKSSdI= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3802: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3802; 20:Mb1LuukKq2v0oFVdr9mbkoYh6KEoeGnwK1uJO9BNifNCYsmuVUu869yYkev7wPVWwV6FI4JW4QO4tCav/8cjlKFLwJ6yvRFs8QWIQrmoBQodU5eANKzhuv4s8uVKmUqO7UpGf/ZgzVRUlDpiGeposjT7j80z8G877yp5WR3leiqyS+SO4XouGLrMqd6AmbGKaClALKA3szmq7WBz9mI14PxKr6/bBpeikHTf73Kd9v9Z2I1PKOYEINx8btBnyucLVqPS+4txn+gecRYOop9RB2inUJ5X7KswKDO3iheyeiOoG8gDVC5JBl9+Ym/EhbTcJpcVlK/gLazJdHH6mufM/eyXlymSfuXcu9fN/C2WFgToPP57MBLiBOOHSkbaNSLxzc8vUrYU/cqDgaEiNYjMjNS057ls1S1lfr+hjuMPeeDSbulOQcny668SjPO3a4UgfnURWSwi77EQiq8z1bXo6DWuCMY5PafoqAu6M+za1z/7jteKvNbxjdbGLJitQDCZ; 4:2rJhtrWEVsaZTLtiKSwjfGeOZJKV1VnnPojDScae4mloesZ+zYgYX0rnyPI9O5GCKUZwt5E+by9xQD3YLSnLBnnMUUpUvoIUSsnC94UUekk/qIzJRkVbLPQLhnPV0dChYJFgORCgsnvzjk8Kk1uq4nvZthoSgCNDdF20aJfxJTYC/a3o6M0CpV47iYLHuyY53+FXICLMi9pQZvSBwnnu6Cvf/l8kYwDL6tlUPp56M2wbRZt6imOADCI8/BmSgNtmNSBXeZyVGbrTHmEQ3DaUz9eX7sKdDVzdCh5PTQqbsM+gMhPBDOgM8GU1OxFWv1x1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(60795455431006); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231023)(2400081)(944501161)(3002001)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:HE1PR0502MB3802; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0502MB3802; X-Forefront-PRVS: 0560A2214D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(366004)(396003)(376002)(39860400002)(199004)(189003)(5660300001)(53936002)(47776003)(8936002)(50226002)(2906002)(68736007)(4720700003)(55016002)(6666003)(2950100002)(69596002)(478600001)(76176011)(7696005)(316002)(52116002)(386003)(16586007)(36756003)(51416003)(6116002)(3846002)(16526018)(8676002)(81166006)(81156014)(66066001)(110136005)(48376002)(26005)(54906003)(86362001)(575784001)(25786009)(106356001)(105586002)(50466002)(305945005)(4326008)(7736002)(97736004)(21086003)(33026002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3802; 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; HE1PR0502MB3802; 23:VJmbe79UKEKHlmGIHeNDkwEuJZdjBn4b3Wnd/kO?= =?us-ascii?Q?0OLtGVi3WgdSVf5cg4tzd2VWqLm0txKNvs2z2xOWgw94XJ6HOsHayXFesHXa?= =?us-ascii?Q?s521NkjceNP5TQbNanBZ12DbTjC0Mc6w1AAjX1jpnpRceIXumrMGpKF9CCvc?= =?us-ascii?Q?1cEMwKrAToFIEFraaFzSsvokW6QkjMZ0a1Pog3c6HLoNZBVZs3MCk+jfyn+6?= =?us-ascii?Q?F9nXL+nTwZf/wCpJnFg6ZEco1mad2Q9MeDt8Ovnx35vTmmg7tRKTa218f6EK?= =?us-ascii?Q?c0odWi/Kgg/Cus2zFZ+eXlF6HcqNl+JvZ9Yo/i/PZ0043vI87COvqxR7GnST?= =?us-ascii?Q?J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microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3802; 6:PiG/ewIoz8KuYYBctLUvQmb/N/Rqsr1RHxgOFvAN2vE/NrFIP9+EAcAMUO/jjiL0+6GSPP3iBPQo5p2mMGWznn1zUiZi0N8AJd2HpJmEpd7LJQYTZKkA8/FV8q4jCRxy+jZOsSQfsBLNI8wGJ0AWZAZF8Aa1ssb2DnrLxiOMGjauulZaRYsRq3jHV3wU7IkWkDxvhTDuOs85o10NwD40Yo8nNrGyPOIWr5eeB5E9NQ5Zl966eZ6TLX3Ik/I9lBkU2//KW0E8dx3/q3HBMV5rgrPnuhOLikxVFX6/i3xDiru6HQmwBF8NpNWVXoJW+tMaxYuMSwJIXxFO0dm56sEgP9eNKwFDj4+cFLnJbGuC+Cg=; 5:l9fSOve32IUCxSEQawMtAVTRsSu3QSAjyxYRL1EkBSHaj/C7Oj/kAsPa0fnno6mIEN/5yYSppFVHu1QYTFq7dqGSsTT35DI4eiBymAnIMlErtDwliKwydcl2vz6/uCQgsPlyGnMEoj2Xyo/7jD4jJqcpXCq0EkS9qzIw1uvnM7Q=; 24:X5JGF6u4lmvUB5+Prhp6EX4GM1bjoUfQi7xV84osPxufd/QsZDR4wChjutZD6KtxkQubpAQeJ+mCpO2RC0Q2qeW04OvE7OW0St9FwmMfczw=; 7:EwheQUR9om9/dddVKo3l8F5ffXS2KIOIgfGzeVkOmN5eZ8fVgUleSrwkwqWDfpKGLRwn4Qk+FpV1mf06+g+4tZJXCASvYTjukj8EREyvtGSunO/UjfnNKgLKL97Gs60fIsWN5ggSZmlSfipp6YlsSuY4v8750qPTIls5T7BZjVU5WCNBnV6cEinVmZ5LE5Ubswz1lmKmcIOnU1witk3pKqtgu8fyeuCgp9+LCM/KxGk6BhDJPyTkFWWsrygGCCni SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 16:38:49.9252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b98672fd-97c7-46f5-90f0-08d561b69e50 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3802 Subject: [dpdk-dev] [PATCH v5 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: Mon, 22 Jan 2018 16:38: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 | 16 ++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 2 ++ 3 files changed, 25 insertions(+) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index cb274eb..e05afbf 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..3994661 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -106,6 +106,22 @@ 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; + } else if (strncmp(rte_eth_devices[pid].device->name, da->name, + strlen(da->name)) != 0) { + /* + * The device probably was removed and its port id was + * reallocated before ownership set. + */ + rte_eth_dev_owner_unset(pid, PRIV(dev)->my_owner.id); + INFO("sub_device %d was probably removed before taking" + " ownership, will try again later", i); + 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 7754248..ef0c9df 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