From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10081.outbound.protection.outlook.com [40.107.1.81]) by dpdk.org (Postfix) with ESMTP id 6BF741B1D8 for ; Thu, 18 Jan 2018 12:27:43 +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=i263nPOShYyB/iTnWdQbSmSjHnFDswg4hQ/Eph+Djzo=; b=ZT5+wsuIKUOVMCcSUFq3E41lIMIyAefimKy2IMMGLo66fNf1AUh+ojCrYSJtF2AqKmSByqVFQ9IB4CfniKnpK/8RCRsESEjiqeohfl5I41mUhLtV2bLdJP4ENU34nsNMEvUg8E/XkM+oTLwKUAvND36fWmFsWuIR3gMSx/StNE0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Thu, 18 Jan 2018 11:27:40 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Thu, 18 Jan 2018 11:27:11 +0000 Message-Id: <1516274834-19755-4-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516274834-19755-1-git-send-email-matan@mellanox.com> References: <1516220357-13013-1-git-send-email-matan@mellanox.com> <1516274834-19755-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0102CA0042.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::19) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e04bf9d2-b754-4d02-4807-08d55e667c98 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3797; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 3:TTlGwkQ9HqmcdHaN2StQkwe4ScKYL/9ArARBQZKa0h+bJk/pCfUXKFw8xOm+3Vtmc4NuqkaMII7ldtpa3fSWxzXGt6bCGjeYX/gTNQO92Q9LeLiz+sA3XWxSkccWeWmPmQvsd4WgSmbQ1kf7yoNzRnPlZV8FSQ+a8Tyub06sP3x2dn7mb8bvmidmfHEC+NtwMm3yk+ue5Wmjr+QJk3BGINByzePWC6KbEYRpL52PEAyfjrOhMrgNGBF3i9Tffa4G; 25:v7hEV9owgCxSrOYngyIqepLVoA+suudtRvAu8C1+4AgiwsSKuOrpp8hAaA2KEWihAX2ysooCR28i5eLpmIj6UN8rYMmV+QduRNUPwYP5imZsL4otDWt1uMHl/RfwpMdRUb5Vpq+WpVERTIudkXPFxMnmboYV2jRBDOrmN/TfEWNnxDQb1MKaKtdpmzk3AXxOD2HwnFit4ZpmKTagDz+m06DI9pN5/3UTsghoiQTqBt51EUFidiqTAqmTADO8fPIh78hXh+LKz0O+OdTh4UKhdK+m42yYXF04RFqj5FkWwUYC3vkeaKGBgvnqoHo/7iVOtt7c/PUBg0TH+WAccRkPwA==; 31:qt/lAUvXxb86OROgUGCI4nc1MTny/tmz7K7d4FvRWCwSLbmeW/Y86YLASg9sQK2yXVKbS6X81SU6B38d7kre6rlyzYYKdpZHKBthZFncdS5QXTiLXsLSa2g4mgZbeyWCWJABQZfw3kofuxGKEDZG8eyb0EABfELscEOkK9H7jm4sOKXoqCtErbWW5K2tp4GewoOYiFrOiE9d9JaVGto16en/8/vM5HadPP1YKJh+vSo= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:foi+MCSSXmrII0HIf6L9nSB84m6wWrDUl571mGMR5D3NvaY4hXH+uDn8MJJS3NmaJUDbsOjOtetwxWigV9jhUFSJTeSkWr7HwDBcVkVPpXofmBduIczaLVe7BWFIuW0oq/uSWUMNfogqidw8H2yVECbzkQ2NNAzGjW7/jxZ9EuLo3aKgB2lw103JheTdDbSIgfUGEj5OfjNrDvy7roRSBSh1vSdlK1UJNiMW9AWDV3Bvv35XC6fzBCVLvaIJWSONKBsZBnKBfA9Smho2UialAkqCCsxvO0g0BkktZqJY2SzvMqvO9ViaB71YWtG1U4E/UdJqh+fEMeP8o1YVDEO8nWrNGpaXAaLym0rAXHiWpMRx7wzMtp7GxfVwjMpL9uC7jH+kmAAqMyPdPKKE2C9LfQVGOfiB0AQaMALtloHuwRzCZU2zeQIvOgb7mbBkX+jHvN1Cqv1POZqHjZr+EqVdGQ01EzLN5nGeYW2i+3txwViP7z2lFFviPA/sqK1hdttR; 4:U8jeapDo+2EjqzGE51q3/iu9zQ2oKLMVoGROcyd4z1z/taJtuXHna8Glp9th0GY0HxDwV9fnKndAKccRWV+DCvWzs3ozewRWPQBqcVoedNVOS27KcqbBDXAZbnT/GATN/ruQUPmMhyLegusLsp9ibeVsH1mamrkEwOMz6LRtayb7YgnJJArBc4aJjYdcOBOG1nkDSO04SU/j4PVYWh4PrSJJ0EZcoy1eHn8eZJLG7VwWSdAs6DW++p2luEebXY5yI4FHbGnxcr9dMFKqY2aJGw== 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)(3002001)(3231023)(2400060)(944501161)(10201501046)(6055026)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:AM6PR0502MB3797; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3797; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(346002)(39380400002)(396003)(199004)(189003)(53936002)(6116002)(76176011)(386003)(4720700003)(26005)(7736002)(305945005)(50466002)(66066001)(2906002)(47776003)(16586007)(8676002)(110136005)(478600001)(316002)(25786009)(21086003)(2950100002)(48376002)(6666003)(51416003)(52116002)(7696005)(81156014)(8936002)(81166006)(4326008)(86362001)(16526018)(97736004)(68736007)(36756003)(50226002)(5660300001)(105586002)(69596002)(3846002)(106356001)(33026002)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; 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; AM6PR0502MB3797; 23:sMMQmsxNJhkPedQegnaHGucQH/TJaFi2muevJH6?= =?us-ascii?Q?BE8jUOEuw3+sTaDZuXa+vt6o2K7RaWqsz5UQyjBN32mpsH90vofV3vXjx4F1?= =?us-ascii?Q?QwccDIXjnsgKpRswYlJxWHeGlTDjG3SEviuramci0jN6Rax4XoXpUiGFusXA?= =?us-ascii?Q?yiw2YxfYBNUD80XcN7910oWKMzeqew0gwTPxQwzTNTnTsOgAMBO0+vFzi9os?= =?us-ascii?Q?rXH8+sCaqp5I+39XAXenqI3vTQAeEo059IjNptEG364OfR+uKQcNaVDgYya1?= =?us-ascii?Q?C0+YKDwNqAl3Lgw5dZOUlFrAgAPacEdnAgaFmS7646oavH+a19HSo4Ks0Vgt?= =?us-ascii?Q?ZYoPBoxK+p27tkDz6IHzSF1vQPTKxoFV3/sLdBwl3jDlSpHIitnUwPnNUqFR?= =?us-ascii?Q?ATRJSkttyd8/WUMNFG2MpYY9a/ncL3T/yHK+eLVvF8PsGtXKyPFK8vl1VLTD?= =?us-ascii?Q?BupXbhHaE2zIzsuKD4TKOZVyW/AuFW/m8E+U+zE0WnP1HPNMbjz9Xan7HaN/?= =?us-ascii?Q?7B1rAcTyKaXNcSzZI5UZnxiB7vOrmPIlIonFE6hrDUotCKitepg+eXGAcMTq?= =?us-ascii?Q?wbTzIrdxLWSDz1xDea0jn3RB5xVSZ9c/FDOpr9TgLiHMbA75RMMRpDpLlcOk?= =?us-ascii?Q?2jx8uLV1j5u/ZxW5FfCoqLPepdF7CTcS4h7EzbdcOFKksjgDqe7j/x3I1ybm?= =?us-ascii?Q?thIC36nnFbExWTWiSrEdhu+NJoJWBblCnRGABStbMDbXcCFg/F+w4ywl56LW?= =?us-ascii?Q?jea5Zuw/LMpcCjLYenzdaag7AumRSjaspC5OH5kvXDRpS3fGfo/jLCO2KKaS?= =?us-ascii?Q?uMCfgs1U1I/ASr/HxSqrZEjHjCmceVTFZLFkkOQ4z/WLZ24IG+/M46kAmMjs?= =?us-ascii?Q?sIpkSVx5OAe0NpV46EXB8by3Hr7sDgUOuCIqfkABFegQug37F/QtTrztdmoU?= =?us-ascii?Q?ZynRjSCO4tS20Y+v/HpEqAGC+zwWy8WH7wS7lRcEmq2VZoMBsiUz5Ghw24Du?= =?us-ascii?Q?y354q5b5R/4rIj649ZMGABe12/9RavLWA0T1Px8cTH7Wl376ueefC6GJKmUF?= =?us-ascii?Q?R5rXNq89c4ssA0aY2vjJRFIDKORPjuVeKmhVKFC23+t7vtzAw9MO/ADbVPQ5?= =?us-ascii?Q?t2B99dpt0w3O+iv0JhEfLbLxvwduwYxlZvs+NEcSRdfARVZRHYSy7gA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 6:IwpilTav+XxT6lnLBzaibVjRv3j21tIdZ23xbgkIMOp6dUUtxGetX/QvGAHThF+V93A5ek2BhsX62LbqJJFIS5eps+zXlK/VgSzRfnk0b0JpfvPbDICv99bXEpUwSd+b2GqzP1BtLi+HOYrq/rGB1Lw4ETWsPTMknyYn+5fzPLF2oH+e92AIONNBJIg9PUh6UO8itBwZZGpuyXgrgA1gU9GQ4Vc2clePauZ+WtY0uFVlUCkz6J1UmBaNIdr6kCh/uCtt4WwEAYFEzLLZ+LufxupMW7Umuv0MhLL+eqj9+kqGdfYebuBuX0hDimugJIdfwGq6fkqDvd2kHU8rYc59I8zrAwbNTdm1NFN+s1EQ96c=; 5:ihQijYWSjxHxXvy0tSrIkUKRZlrCGT1JLs6JSCReGyTYJFB0t/q/H6GyIOBEAKanIGKdu0t+iiw0PmX+5VyjU8NNPO9/gDvQzPjuZ4aulA07p5rBjq7V9DTZDaPytsKX6golSmo5FVwh+maM/bMPYiIx7IfX4R/2YLq7QDwaRPQ=; 24:VvvKphXZYzzVpc3Y99fAY0+5yT9ijH8ZSjNjvIdhQKwWlIic8ijZYQbvA0crPrnT1/7hLFNtZQaCJ/1NUUY1yBn8HTmudSNfvjLdA/k2N14=; 7:YkXr3LqR+iYphbK5uFf1VaBeLhmFL376xXZM1Y8xtgrZzvzShkLr19FOe/Y/DwbGnEXYOminniMmKchRj3inaUgEU2Y5l0fCEe37DkoZEEI0a+fgI1Sfefo3w2SU+lQGdb4Cn4PpHb23XJxbh2m3NEd8JW7cKuZDArpxsICt+gavXeEt878ii//vHsAjRxNIa/2Ays8QEzb5Ov9UU4P/VPImn8vvojAoHcAi40RCZDgwj+qV2bjH7yBEwRSL/rCA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 11:27:40.3291 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e04bf9d2-b754-4d02-4807-08d55e667c98 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3797 Subject: [dpdk-dev] [PATCH v6 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: Thu, 18 Jan 2018 11:27:43 -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 1c95f35..c13a2d3 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -284,6 +284,7 @@ .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 = { @@ -331,6 +332,7 @@ .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 e740a4e..aaff180 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -237,6 +237,7 @@ int mlx5_ibv_device_to_pci_addr(const struct ibv_device *, void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *); int mlx5_set_link_down(struct rte_eth_dev *dev); int mlx5_set_link_up(struct rte_eth_dev *dev); +int mlx5_is_removed(struct rte_eth_dev *dev); eth_tx_burst_t priv_select_tx_function(struct priv *, struct rte_eth_dev *); eth_rx_burst_t priv_select_rx_function(struct priv *, struct rte_eth_dev *); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 6f78adc..1c067ca 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -1453,3 +1453,23 @@ struct ethtool_link_settings { } return rx_pkt_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