From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0050.outbound.protection.outlook.com [104.47.1.50]) by dpdk.org (Postfix) with ESMTP id 185441B1DF for ; Wed, 10 Jan 2018 13:31:29 +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=nAU6n1nVv3eLJZ6X1MM3RLxwvw88znM33VxZHPZNpFE=; b=ae9IkxUDBgn1qrBNB4bdqd0F7Tc+JFxV/Eut0zfG5b8DwwZL9NpSavTL7O53xBV4ODS4FMzRsCjL9XVnXtjrnr+kgCYKEjdYUj0cA4AB9U1E2oOJhi9kbwy9pYmF1Ft8pGoBMl/XUabnZ/uSbUNE4kszxdNCaoshrPhrpY3tn2s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM0PR0502MB3796.eurprd05.prod.outlook.com (2603:10a6:208:1e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 12:31:27 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet Cc: dev@dpdk.org Date: Wed, 10 Jan 2018 12:31:02 +0000 Message-Id: <1515587465-9304-4-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515587465-9304-1-git-send-email-matan@mellanox.com> References: <1513703415-29145-1-git-send-email-matan@mellanox.com> <1515587465-9304-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM0PR0102CA0064.eurprd01.prod.exchangelabs.com (2603:10a6:208::41) To AM0PR0502MB3796.eurprd05.prod.outlook.com (2603:10a6:208:1e::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6dfb1c28-130e-4cb5-75ca-08d558261226 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM0PR0502MB3796; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3796; 3:oLIQJQHQC/tPt9zB132kYAqZcCnpR+H+C/WfT5XZh5qN3SaEmzvrWgU7ZLl7QlGn9VCf67xWmsXep+O7JF9WC5BV11V4PmTq2QWQze2W3PfTeLL4m39DaRtLMcLem9oUcWxBCx19esrgP2ZECgaWG4vhMce4hse0bRpPHhpCAJrjT8Tqt3dfRZtEdBPHFndCdkZcsvFZWY9ANYruxZ1bhsKIkqUJ6M4CKnZ7DvhCJej8qpKkyHgE6R0CJ2vSSjbl; 25:QP9Cuie7B07PESslwdUtKosxeGu5nhqoMavEEVOT0E9sHvOKhtsa7Sz3P4XI6Vz4tZIy77hOomjQNta8AWeEg3uIF/X6vfq+STlFO1o1X+C7d9bYpbai3BZHPmnoBd98wUQVcxh6LhbdVmfGUxTCmmrfw0HVcQMRbBdOcP+25KIKaoRkpXJoopjede8WyJ8pWijDaJcRH74uWFKzJoiLGOutd+INElkuJYfZdfO8jPjjBH5cZCJET0BwJ3FBZRorMU2u454SVKXvXsrMt0IhRgOXU0aXDgNz4QUO8eeaFxoj6PjNGlR7Xi76MB6zxwj3F5PK+Oe+AKpIOBfXIbPRdA==; 31:s4ULsZIvX1v61cEVmhY0sJEbwNeuCUya0XEOzVmne9IqTrlaEd0kR4W+/bs5hUEWnea6a4E01SyKypGQfghFp/brH6HwL6O3nh9PAthQG7uXCpoc2bA64deT1j/g6VSuUMUx9Z3qwMBR/us2ZhxJeoVBi8rWRoCcqmZpx89ZGFvDHpj84jIGpGqa6wfMsG/JKxwjGl6KWBhKfO+0JE64QNytFzEphogelJagi02GfrU= X-MS-TrafficTypeDiagnostic: AM0PR0502MB3796: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3796; 20:I7XKg8aLCnOFnwfxi9HVvELVPiIuRbfpB9QqWfNzgt4w0GnrnncKBqk/JCeej/bdSNQU5OeJ5UAE8UmIjxUOxJwrih9OGJtr/EsfFvNOE3lknQ5ycjFAIWnvi2w7ZMCh0Z5n31O6gzSkLFAAFVLAP7tvOp+h3cb5n/priAavXkmP1AFIT6/jT2Tgcjf2CX4o7lgE10Kaz+ac06JoDY4JHYzF0ECPTHj78yZ+IRtB8JbqgmETX5z3DrgoISb+caFu9VXsTwAb8BqLzCYJRvnaW9er/ObucW7Kun/a6Ln8Ux8MeHVVHBcJq/v2t2IfAhl5k6qzMmn2Vxg99AR2pzz9LKhtiAmq530IglmO/LBnJQvcgsjqS4Xngjz3zk4nyLh+nYU4bBCv4dKgftbAAsSigRhgpCPJhMU3K3USWmlek5tZkIoD/4wfu7krsKTgef5pDXtd+X6JSavhvFSuA8u43RfZJt5USjfAgD5fiUb78FYOttXmw6bGf54ymPi3nGNV; 4:PSgbguOCtN9z3rTp2bty4wHzb4gri5xqXboLcQtLi5cDxPUSY3QyxboA5+U6I6C4AywOneejiiCZNL4SN2J4i+Yghyh5ys6z8E/JvE92pWWEIpyOt0hglENHJuwtIAUV4dTZO2uiezXT4ZUmeI/qmFUvA/f7h54Z/2f7Xn3lJKTu18mLA832d35Jx/ufYVrd9AbqnGpelRe2qAcWGrzaUKJtUa7kRmJ8Ni5T5lCi4LMPPaZIHIdNN+6br9e032qcEJ+MmHe2iQ9kMvgiNdTaXQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231023)(944501075)(10201501046)(3002001)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:AM0PR0502MB3796; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM0PR0502MB3796; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(39860400002)(366004)(39380400002)(199004)(189003)(55016002)(68736007)(21086003)(25786009)(6666003)(2950100002)(4720700003)(6116002)(3846002)(4326008)(81166006)(8936002)(86362001)(50226002)(97736004)(69596002)(575784001)(53936002)(16586007)(105586002)(16526018)(305945005)(7736002)(48376002)(316002)(8676002)(81156014)(36756003)(110136005)(5660300001)(50466002)(106356001)(66066001)(51416003)(33026002)(52116002)(478600001)(7696005)(386003)(76176011)(47776003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3796; 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; AM0PR0502MB3796; 23:flulAANZcrbdsI2sV2wUAkFOZXTx1dvKRsKeV3H?= =?us-ascii?Q?Lib+sjVUXj+qzV+LgVcf67tT/lukU45eptPvPIy03EiyUT05AZ4jUvvHW7tX?= =?us-ascii?Q?HB3MVEQaJxhm5SORGhQuzNO6Q7j9hplgUTkbHB0lLcQFw/BXeJGb0Q/fIA8d?= =?us-ascii?Q?EIgUaYEXnKT23MW6sVmE5K8iCfNkVJZtw4eMaFkQjqIYjLB2SnPiT/QSAaPB?= =?us-ascii?Q?y1tQUmvTnlvnSJuSs5OrDUFKN7xpIaUj+joYJGoHlIsR4XwzkYm/idBNSC95?= =?us-ascii?Q?Mhd19EyELLJX3wOTN29iZIGA8dUEKuW7F2hkSQ5ic6NA/bUM5DjmhR6djIZC?= =?us-ascii?Q?Fmw4EFHHEAVL3ENTJ8mU3iUKEXXCFUqX9dbtLKhWycSf6qvvoBoIGI8dz3Io?= =?us-ascii?Q?bUA4JtzpfNGW+KPZcHDLCrBjmh6UqMLOIUsFNlFK0clTXMt48zEkvuuF7Hrh?= =?us-ascii?Q?pa0D+64Nv5RGQ0iY50wloDfO3Ew3iZdVeOgAaIakrc5YgMiykbdBzoEBrxy2?= =?us-ascii?Q?MFks7vToR16tnzsTMJIEsVvkacf7PAGZzqbhQu/wUa1FAPo6Vhjwak3cIMnU?= =?us-ascii?Q?CZcfiIHRqlGbXJOMcuDAWOGl1XByF62wqJxGh7Xkk9tx60iSfprXSlRSc5GT?= =?us-ascii?Q?JDrtEalUvpdjBKeo9qZ0tWP0s8Yei3YW/I0wgxmwEkKsyHvsNRWGX57V6y1V?= =?us-ascii?Q?g6LwBY/VVKiyznPe1rdr+7hlyfmcuGWybMjGqTafU0YgWjWm23eCUzk3KEUX?= =?us-ascii?Q?9dsz3d8PRxL7a2vd8q56nwexrt+4NPSYV8Oml/fuH13HKQANc9VRIL0wOeou?= =?us-ascii?Q?iqzMQMPpD8nCvNLx/l2N5Fg9aSlgr7va3GjNvTDDMDgWZt/EUwLs0sKpJnK4?= =?us-ascii?Q?uUJtszLoNUEUY+RmifSf2FU0/xhpnsIoYnRBx+hpOCiv+ye961XpWavP87c+?= =?us-ascii?Q?z7onqutmRssenJBHWI5WGHsfG5s+ZWEXdbdmrDXGSZRIy9CK++voFjL5UAWQ?= =?us-ascii?Q?twBSkTGQGKkwHEatjVCvab367f9D2A+kuZLwf8JLewqKDTrjs+OAFG3ZH8mk?= =?us-ascii?Q?mw6W54T9O00tUgl8dOJeNA0PyVBog3HyXR46tZqXBMT3RlTmquyZLoJGOco+?= =?us-ascii?Q?XNqJy7XfPg3pX8TTG9MGrExSR8J9PZBlFGxwywTw5Q7pOc9VJqwq7QA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3796; 6:jno5UJ00hUQgJoqQAz/9i5qMlbW1oAOdCD8OqxRK2FyM77heT4o+KcwC92VxTBhiAkwtls6bS/GEP0Bzm3dDjBvYBAFZ/WAtJFC1FUNhJELdCGAcfgYptYXxHsiSuOb75iDm0LCRrNuXwhHQsPO9qtE/x/o3hZkE4eVhTWzjv/DaJDTeUN21QJ/Gv0b2y4xP0FAQKY9KWn/SEq+/HcsOm9/RB/j8u52IO7Khx72cZEAbqpof+VQW1Rx0TkXwk75Mx86ZNtWWzbjRLMW6zmxmOBvd5Kj0UkJEeKyw7M84luT44vxFSBaZH+wbQ0NhxC/t+g6JECo4tIwY5dkf91st5ruwLTOQTJCFpCs6cmqLYRc=; 5:mGKwWc1VqQemXlUjTNLU6wfrZVKKtwof/ielBPcnTjaR440W/5PDu44t0fNaTFD/fIa8n9/+7RRhy2K6ry8umsvS6mvfwQDK/+CbTGiXZGZJdNjXAMfNXxXKPUcfnORlUvqMVDycsmeyVbKI+1b//5/z0bV5lLMa6uUa8XGc37I=; 24:/HMUYijtuaYQHXZj6+TAL1XSLDDu4R0auHU1kZ/JljSxof49pTyaaVxQrPldNknbJhfyZ+i0/Ak4AC3E4gO1Veufm3z3DjhXCPrNayDk2BY=; 7:0z7nUptiJ3Kjjf7MYZoK54YtvzsCaqMr7r9KVYh+cmLYl6gaQYhl3mVxQfnlhz+3B8DBicld6q7pJB186ok4EviIW+jNrngFHPgLz9Xyik3dIIT9w1/+I40FeDbA34KXoTIqWD2JepDeBCYS6A1A5llmsVSjM2M7PNATyd3Iayl3HoXtE4XoguJqASBcmObbaM4aPjVDB+RFRylemvAgq023pkUh0mfJM+jl/0cGFeO6ejeSmk8cokQeF40F+XLu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 12:31:27.5398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dfb1c28-130e-4cb5-75ca-08d558261226 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3796 Subject: [dpdk-dev] [PATCH v4 3/6] net/mlx5: support a device removal check operation 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: Wed, 10 Jan 2018 12:31:29 -0000 Add support to get removal status of mlx5 device. It is not supported in secondary process. Signed-off-by: Matan Azrad --- drivers/net/mlx5/mlx5.c | 2 ++ drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_ethdev.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 0548d17..e0b781b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -303,6 +303,7 @@ struct mlx5_args { .tx_descriptor_status = mlx5_tx_descriptor_status, .rx_queue_intr_enable = mlx5_rx_intr_enable, .rx_queue_intr_disable = mlx5_rx_intr_disable, + .is_removed = mlx5_is_removed, }; static const struct eth_dev_ops mlx5_dev_sec_ops = { @@ -350,6 +351,7 @@ struct mlx5_args { .tx_descriptor_status = mlx5_tx_descriptor_status, .rx_queue_intr_enable = mlx5_rx_intr_enable, .rx_queue_intr_disable = mlx5_rx_intr_disable, + .is_removed = mlx5_is_removed, }; static struct { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index e6a69b8..2ec7ae7 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -208,6 +208,7 @@ int mlx5_ibv_device_to_pci_addr(const struct ibv_device *, int mlx5_set_link_up(struct rte_eth_dev *dev); void priv_dev_select_tx_function(struct priv *priv, struct rte_eth_dev *dev); void priv_dev_select_rx_function(struct priv *priv, struct rte_eth_dev *dev); +int mlx5_is_removed(struct rte_eth_dev *dev); /* mlx5_mac.c */ diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index a3cef68..5cf0849 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -1474,3 +1474,23 @@ struct priv * dev->rx_pkt_burst = mlx5_rx_burst; } } + +/** + * Check if mlx5 device was removed. + * + * @param dev + * Pointer to Ethernet device structure. + * + * @return + * 1 when device is removed, otherwise 0. + */ +int +mlx5_is_removed(struct rte_eth_dev *dev) +{ + struct ibv_device_attr device_attr; + struct priv *priv = dev->data->dev_private; + + if (ibv_query_device(priv->ctx, &device_attr) == EIO) + return 1; + return 0; +} -- 1.8.3.1