From patchwork Mon Sep 14 06:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 11772975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F2EA159A for ; Mon, 14 Sep 2020 06:36:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F834217BA for ; Mon, 14 Sep 2020 06:36:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="moesCRJL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726056AbgINGgT (ORCPT ); Mon, 14 Sep 2020 02:36:19 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:6898 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgINGgM (ORCPT ); Mon, 14 Sep 2020 02:36:12 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sun, 13 Sep 2020 23:35:26 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sun, 13 Sep 2020 23:36:12 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 13 Sep 2020 23:36:12 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 14 Sep 2020 06:36:12 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 14 Sep 2020 06:36:12 +0000 Received: from mtl-vdi-864.wap.labs.mlnx. (Not Verified[10.228.136.155]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Sun, 13 Sep 2020 23:36:12 -0700 From: Yishai Hadas To: CC: , , , , Edward Srouji Subject: [PATCH rdma-core 8/8] tests: Add tests for ibv_query_gid_table and ibv_query_gid_ex Date: Mon, 14 Sep 2020 09:35:03 +0300 Message-ID: <20200914063503.192997-9-yishaih@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200914063503.192997-1-yishaih@nvidia.com> References: <20200914063503.192997-1-yishaih@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600065326; bh=umT9RbzAGBI/oJU2rcQ1nk5EPbDbYPDi9ejy+OObqs8=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: Content-Type; b=moesCRJLfkpv1Mj0yBa2MnYuCPKUDx21GSzsoHqkLTHLe2ANS3tCKObyw50roiV1h iWe+PkgNoGNR+Bd3EJguMWKFf8vlTVyMWvQoQJz0Fv3eq87VEO4zT76K4jgg4orO+i 1gtbbFO+U7WZKxfwjkaKkUtoqzOTJIZ4dBXgf8c069ME/BzJmnTSrDqbf7ISz78Wzh MpxuUHCPdLw1w1m5FeOLKxl6mGOdTexCimR5UEQwZ3I+hKb5f+QUgj0q3QyKHUj3o7 vhD9hSdVmqw15zM8fq4NofJY4pXAuE+10BjCNFcfei8J406dc4eqYphSkSDS1bOk14 Uc5SThADPl1ww== Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Avihai Horon Add a test for ibv_query_gid_table and another one for ibv_query_gid_ex. Signed-off-by: Avihai Horon Signed-off-by: Edward Srouji --- tests/test_device.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/test_device.py b/tests/test_device.py index 1eb1a81..94c0e40 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -6,6 +6,7 @@ Test module for pyverbs' device module. import unittest import resource import random +import errno from pyverbs.pyverbs_error import PyverbsError, PyverbsRDMAError from tests.base import PyverbsAPITestCase @@ -80,6 +81,37 @@ class DeviceTest(PyverbsAPITestCase): with d.Context(name=dev.name.decode()) as ctx: ctx.query_gid(port_num=1, index=0) + def test_query_gid_table(self): + """ + Test ibv_query_gid_table() + """ + devs = self.get_device_list() + with d.Context(name=devs[0].name.decode()) as ctx: + device_attr = ctx.query_device() + port_attr = ctx.query_port(1) + max_entries = device_attr.phys_port_cnt * port_attr.gid_tbl_len + try: + ctx.query_gid_table(max_entries) + except PyverbsRDMAError as ex: + if ex.error_code in [errno.EOPNOTSUPP, errno.EPROTONOSUPPORT]: + raise unittest.SkipTest('ibv_query_gid_table is not'\ + ' supported on this device') + raise ex + + def test_query_gid_ex(self): + """ + Test ibv_query_gid_ex() + """ + devs = self.get_device_list() + with d.Context(name=devs[0].name.decode()) as ctx: + try: + ctx.query_gid_ex(port_num=1, gid_index=0) + except PyverbsRDMAError as ex: + if ex.error_code in [errno.EOPNOTSUPP, errno.EPROTONOSUPPORT]: + raise unittest.SkipTest('ibv_query_gid_ex is not'\ + ' supported on this device') + raise ex + @staticmethod def verify_device_attr(attr, device): """