From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30065.outbound.protection.outlook.com [40.107.3.65]) by dpdk.org (Postfix) with ESMTP id E49A5325C for ; Tue, 28 Nov 2017 12:58:30 +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=QDHPnz8rMliQJxp2XUPBa8AtF1zmDPbsGQboeWfkPeu1JKvaO9bPNGPsSKwI0gBd28A61FT8DUDuYzOIiKV6HT/RETNBN/S7iQPPAnbj+6xZpFMgAzZTrHluSCRFNPz5iec9ObKdqzyG/IB3jshW8+BFNK36ofO1Jqqe/O2Yqp4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0502MB3663.eurprd05.prod.outlook.com (2603:10a6:803:f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Tue, 28 Nov 2017 11:58:28 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org Date: Tue, 28 Nov 2017 11:58:00 +0000 Message-Id: <1511870281-15282-5-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1511870281-15282-1-git-send-email-matan@mellanox.com> References: <1511870281-15282-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0801CA0078.eurprd08.prod.outlook.com (2603:10a6:800:7d::22) To VI1PR0502MB3663.eurprd05.prod.outlook.com (2603:10a6:803:f::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2095f2c9-f396-4e2b-4271-08d53657572d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603258); SRVR:VI1PR0502MB3663; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3663; 3:FCh0Q+r6nunCmnlIspPfcHQe4/s5YMB6e/2a41wKTne+zZITrPFAgaQx1f+Kxkvn5FDVm5tZ2D4wuD3YLTSCHov+K0CWZC94MKt67EPq0sWQVzIX3L3hSkwUNt9aXprHbH3I/ox3cUAW6G+MjkRrnBAGFwmLBLyJIkpnTmpP/IlAuY8scYClvZi0tXvT5BMWP9zcpz3tvVvvv0fasu6DZkP6xhlABHxnmw4Tf4ox1cOJkEfpkN4lQxNp/BErra/A; 25:9vd7zcubIrxXJmPtv7Wjw0t8Wxt6WXaYt1kSC4GRQ/7AjZM3UmVZVqGXdUlKXmFEEoD0JRA2Bo9we1wV8+yEk39fyjTu6xFD9VDpUe0mn60sHtp0Y0+f7dt+qPa0jSNg2/WNc3rAo8JzFKEoAcyowHbkahzDHRBEX0lxRqJy5iuOal1WuMB1+Tc6dRktDRaWHI6wSaGUfTQKoVv/WmjjAHiwSVjqvJKqZCgY6kTWcSpy29v8Psm2NRPswpclwG1UrKY/d/pf06lRpffxHKgsH4r2TL8F/sP+B3Kppl1B6KDoEQSEgq/nJl/EwaoxDnPXfx/xYN8UsQqzvPJ+BH4Z5g==; 31:LCGAULF3p2p1XnxvU/6nuGJ6EiXZ60Ceaa0vvB+BtwIcF88Kberr2/T6qjub+pthyp0FALCTPtIIaaEkfGtyCfyfX3H4GAOcgNGrPzlC/N7hfcpr8xkOHCfCXOSg22sAhQrSM9jADZm6TJXASUz2jo9MTP1EFjKPuK/N7vVIZck/EVV1M//IPl1IVbx8DLQ2IjY0JkoHsiTwWNG3cuk8tX5QIApmjD4cdzk8eYSMuxA= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3663: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3663; 20:ZhkmXLJTVHMXS0CXkRqzyEBxB78mW0/ga88bjrQsP6rSJRuV1Xs3pUoO6i4QOFRnEBRQUiGJ4UPJb5fUhZ5pDoKr1VoZFf60eMLZZ0Nx7vi7dzjQ24tuTjNG7sa2fqB8HB5+zA7X1Aq4v6q1SNe8mtpN7iBGwJc+KVqNwk/m/upXAJgxcUaNQTkC9mjbOeC9fuOK5P2RquWwQB1LNIhpUIvxc/qCEv55SkTwoz1BtQ9qZkNvx7IB35vT5DpmbIRzstCeZ+Sw/hCKN/lGwX/yr4eEop8AjUkkPkBwF7hcheXkUulS/qWKyzhVwbj4sW0WJD3uHEklTgXf3933O19JZA7KvnQb5VACP61Er+/Qyy1ny/r4YjFoOtiOcXjGwQeUcz4Fh7kncj1mAy+l2wabnjIqYHDdYo7Fd26GU5LTlw5q1r9gP1kPX5zCZ0W5BpfmqR+pqaJtp3k1oWJztOpcTSTUqmNoAPjHEP4PLGjsE7vgEoAsx8Et40wAaQ6+oOAh; 4:uIcyhL3l2IDbxPVyuM8KGDXT0VJt13xlGt2yFfK1gK6k5lERMjoJsteIqkD0E7QoUZvJnR4/P1iYXjvoZKYUryLWPIviRalaY3v6K6vQLaG5tZEi6l6wrLKUSbagVTNUDvSNnEaoxR7Rj5n2wj5SWRPdmlHBzyQRWBgsQv6ztYUPVKAGsshNUAmpkffHSyn7X4ILpc5vp+HXBm5iQG2bVIc1Ebkg8/pR9PUrGSrC8b8K6ex2Mbx16AM2t/jFrLN4LIVqJLXgD4c5TLxBlQ9EzKziBcOBMvKuweDW4g0kOTFhTtQrNunkxMV+4DZ2hBgv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(60795455431006); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231022)(6055026)(6041248)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(20161123560025)(6072148)(201708071742011); SRVR:VI1PR0502MB3663; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0502MB3663; X-Forefront-PRVS: 0505147DDB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(366004)(199003)(189002)(4720700003)(50226002)(189998001)(8936002)(3846002)(97736004)(110136005)(2950100002)(6666003)(6116002)(47776003)(316002)(5660300001)(16586007)(50986999)(105586002)(305945005)(76176999)(16526018)(106356001)(66066001)(21086003)(81156014)(69596002)(48376002)(50466002)(101416001)(4326008)(52116002)(55016002)(7696005)(25786009)(2906002)(51416003)(8676002)(33646002)(53936002)(68736007)(36756003)(86362001)(478600001)(33026002)(7736002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3663; 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; VI1PR0502MB3663; 23:8+TAyTz74Pd/aMr4LFLGT+hDc27+CuZULpZ1YKG?= =?us-ascii?Q?NzqYKjpJiX8P8LnXUF3POMXDoAP6UIr8uE53h7EfSwSoell0pQ3TpfGhu69w?= =?us-ascii?Q?3J+g6TDouuKeKWlDdSMcde6w1fo+hTVOuV465I2jqNDGUcwVh7g7BVaxUEqr?= =?us-ascii?Q?jjGtU6pLfPwWPPetJmAOyKwdSQ8m1T9l0eqbxmnDfeQiK+4NbPgi2BVUh99t?= =?us-ascii?Q?LqX4hK7eb5m5J7fP/tiS/pCzaNCyd9D7BMKE513uSCdF6hCsyPEhd3xGsGJO?= =?us-ascii?Q?i7QtxTleJclTsLzZP56gznKsGBNPohsPpkHJNMwAqk5BMEBjaC0mnE0p8iAP?= =?us-ascii?Q?eSka1m+PAdzZmaLqT5cIs5WLWwN/hWTV4fET2AIECY4iP2ezBGFFAlpxamfH?= =?us-ascii?Q?IVWc7G6RcanEdmdkJdUsWiJ9CusjofedUGlUT/hV+rFfDRk0oymOzNjstwLc?= =?us-ascii?Q?7VvYNk0Jql+rEvB6e6c3fpdvkJKK7CccUPLFN/7Q4owHbxWU96yyyjP4N3rL?= =?us-ascii?Q?oYxdmvXZbj0FmgSq3Z3A+UDFDXi4sWk7JE4Nj/0gFiH8P5k17mWy+1NfSRES?= =?us-ascii?Q?XbiSfp3cwGq3xj+GwFFRtq868AmX+qHSS+JopXW9YOZJItjwrWcDicXNOgJX?= =?us-ascii?Q?NCwKlo2/ynXXphPev16HyI7Tl7JtvL6xEdbLmNAVlERiO04PJcNgW4yHhUWE?= =?us-ascii?Q?4S2I5U59X5KGnvPlyu+FWlcDueJH6Lr9751nhxO6yfWXCRBkEClk/2TATDDe?= =?us-ascii?Q?lGK+FghKh5KIvgaPubIswOMySbhDkPOouv/TSnIh89gYwph428dFZ91xo2Ni?= =?us-ascii?Q?9qlo4WE3jvg7AvyA9Nj5lLaAxVurhda4BDFzzoWIXVScWVfnprCyZtNInTbm?= =?us-ascii?Q?15XAIyomq4MsGvNJquoSv7FgvAWNCg4lF48zQzcyBqo0O/lHQ/OoG5HRVtyh?= =?us-ascii?Q?jv4ejGxJRtnT3/fdvpb3+8+7hRLu4dTqi5btRY5kLzNxnmPy7vpOlPCMOk/v?= =?us-ascii?Q?qqM/Y6nea0u06ENkxsUNEm5YAoLXyGQSp3MaW6BAMQt9YkfCLuwn5W3j3snU?= =?us-ascii?Q?ghCl5e6+E8KKaXTZdI3sCnghArl1ES5+rB1MdeC4hSuPJbBThGzVv2TrLF3z?= =?us-ascii?Q?4a7Jidw8XRF5gj7tfLsLICgKFpWYAKZ5tDdt5pn1SbfG+39FLwcy8apEWXH6?= =?us-ascii?Q?PfC3jejJarXYOmDc=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3663; 6:eBWqzgHJQfXxGQgAGOjXeNiVJ3ZJowdEOyQfZp8Mh7q0e74uBoiwWSkzqbBr+/P3VSf+IL2YXBsfBFoFBYWytSI8FnoNRNsvs9uxPKj53hbn/r6EkCbMUOYEFN6XUHm+o4zrAjM9H8NcTsToo6e4a1UxHqZwa0jewSrj7vyHkykIaypbvoq9kFK2UFv3pvv6OPFtK/NCYPugHe4tKX16mHtkXctjhmXV9CE2N+zFtxyDV/tRMexrr4eNa0upLnE8KK04hy3/MYVznUqvrXrYLExpa0XeEqWEqYOnagwT/rOcRvZRkLYRB+adDVQQSRM7NwXtMZOHzWJz+MV2TSsdv8J6Pn3F2/w6PtrKpOI04AU=; 5:vJHpaWiyybqrBF/HtXGmgjfv+4zjc5bwsaqCVWrmjvk8IF/Ww43OmGfDwoC77BjdVBW0IZBUbm6zLiu3oVH6/L+A3NuUStN8V1W6J7GurQBabsVUXpV+H5vgY1yRqffpOpdBF/XFmHdr0fEQLg+3zDxMb8fbnLCv2d12/YA/A3o=; 24:cUrrxsguROcl7n0JXWu5lVmkM99Fn+N3tRSup0m/jkCh1H+BeKJdCt6CTEE/K2F62pTYepc2kQ96pPwyjPjo/EHJix6g7fD3VjWO2jE+jyE=; 7:CA6odqY0U92M4tuuWW+vy37j+bYXjISmtPfRI9HNWe8l0wxwfZXcyfjXBuYQj1ds87I37qLkm5xJW3EjwdvosWVadQo1EJWlwNG4/ZyAjJqInuXiRJg53ijXKD0J99z9zdOlUqzcB1MQFxIhAGkk7h49Hu6yXyAHPA8TnfFfUbGqsG34vKoM12W1y4QwMP3zvf+6LqgjM02eFOJX6nsbjsxky305/wBRaR9ZEXhfguuWKKuVUU2rW65Mcnt+wgZK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2017 11:58:28.8869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2095f2c9-f396-4e2b-4271-08d53657572d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3663 Subject: [dpdk-dev] [PATCH 4/5] 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: Tue, 28 Nov 2017 11:58:31 -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