From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3669142DC6; Mon, 3 Jul 2023 21:26:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E975F4111C; Mon, 3 Jul 2023 21:26:20 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 32AA4400EF for ; Mon, 3 Jul 2023 21:26:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YTZxr/ZbHdjjMbysqZBNvMv26v497boWRnOduGhT3APkt6xSWdSH+4X3A2jGudErSygRIreYBpln6T6O1Z7bBrsTkfs5Fc03vs4GwXtTw2CQ1IAMUBOFC5o6hZi6O+2FK9C7W0kWZweTrt+JmyL0eLl5DKsYvzAw2jCHM0x8nydu1GBr+VDBaSK8LhuFevFyQRraWWUPScazCskWuBqWMGy2Lf0evZl+6GfJ2TEJ7E78d29M+CzjIg6FdQrAhWGiiFl77AvI70YCCIGmJCaMhvHF8OosDNfFTdmoJF2jruBFML8/K3ZQfwHZksvgKaCaQfdoPgu2AlwwzRzhT1LKdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1Iv9SBgOwlX6dbKb7wZ+4vpu5HaPPGIRrZYZcpYaxxo=; b=b/sN4FyiKMjWaqN6Nc1Eficq4CO6MPy6uX2MwBn3l0MqrJKCbPCBPigOvBumu6HQCn4vzXFRAazDDEvCMBDtpVlLY1n0uMUemuxEOQ06agMaMC0ahf40q6g2wcTatDxFIW3nPaVRkQEdFik8U6bah/iF1J7Aw2eudFu8vSGIse/KDs/IEvB6TtS7BN9mus+Tr/06WpkpHI7coBTZakbCGq+AHmcCETtwlod/Q6fSq/y7Q8TTUYn6dB7ckCNlMAC2x+s1IhUX6wvNt/D8I5TdnClMgfS7TgPujIDaKdxUVVU2aQR3uVC0WrECSjRpaauyvY7/SPTsqKUhdiUpX4BEBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Iv9SBgOwlX6dbKb7wZ+4vpu5HaPPGIRrZYZcpYaxxo=; b=FDOuMr/OdsbkRTpiDx5wWAM+1oJ2VhWAHXxu1DdM41adzGiYkItrT0n/7ZuKcpp1nJTfamtvfJDsxmtphWK7nWEVLJDwQEMd8H1Hu1YTMe+ArQHJ9F/JJpCyLua79RJO/A+5c50xhKX7mcGgAvfwYb4JPudsmy+WsEKuR3oOdrY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from BY3PR13MB4804.namprd13.prod.outlook.com (2603:10b6:a03:355::13) by MW5PR13MB5464.namprd13.prod.outlook.com (2603:10b6:303:191::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Mon, 3 Jul 2023 19:26:16 +0000 Received: from BY3PR13MB4804.namprd13.prod.outlook.com ([fe80::5ae7:eda4:3881:4f4f]) by BY3PR13MB4804.namprd13.prod.outlook.com ([fe80::5ae7:eda4:3881:4f4f%4]) with mapi id 15.20.6544.024; Mon, 3 Jul 2023 19:26:16 +0000 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: dts@dpdk.org Cc: oss-drivers@corigine.com, Qin Ke , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 1/2] framework/pmd_output: report link speed in Mbps Date: Mon, 3 Jul 2023 21:25:41 +0200 Message-ID: <20230703192542.36809-2-niklas.soderlund@corigine.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703192542.36809-1-niklas.soderlund@corigine.com> References: <20230703192542.36809-1-niklas.soderlund@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BE1P281CA0095.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:79::10) To BY3PR13MB4804.namprd13.prod.outlook.com (2603:10b6:a03:355::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY3PR13MB4804:EE_|MW5PR13MB5464:EE_ X-MS-Office365-Filtering-Correlation-Id: b7f96e61-1658-4245-d063-08db7bfb5f1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ImWX15n2CgJTbDSTZd5vbcRFQJwApbbP+oovGT7albH486M4ssSBTg8viw2B8fwj+Aqe+uZKqmzLqrOz8xzCSgwMIpSkVfWD2RbECtD98utdISlXcHK8oEjFxmdN+HS9aXj2fg1r1RHiyAfjQPMb7WltoCY5z1rVt0+zOCiOl+vhtQhn1KNpBiplC8tz+Mne9MjBMw6BWTenFfLQpA7mGHZmXqOtA1O61qgC8SWY8+ljJzz7OUdG0UrnYt0SKxNfewDDw/ti2ngkU4DIgEN8WTlF8kd7sMR2KynUN1OvOdHba/qoterA2MF0u0DtsnK3mYEx/2l6eFumFq81/eXrquxRPVYT23+pNd90v1QL/HnOf06s6ERc3uNDVr9SPu9onqwWUHOd+QG8prwIo/aMH9Aj4zLqZ5tjIxT/VHZA1/0uf92GcqZENNf38MfMIMoolYKGg7ou47f6tWXiiwhrMGXpxBQU1b62jUUs0siQgJbdfF2r25J642p9u4aQaVFknXfqKXVQ+hYJaAN7KTXv0mzyHTSGpOVBIVIGAOekzNHrVFtyuWTfiz4zCy+p5H2O3eKaaBH42A64Out2q3TOn7DBiEHysllI799LyixDD1HQhAFYRkR/uDy5qDZjbk+M5dZ8rloPK48p6EXA+0CMgRyxlirW4JMN9l4APsD3JvY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY3PR13MB4804.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(39840400004)(136003)(346002)(366004)(451199021)(54906003)(2906002)(478600001)(26005)(41300700001)(6666004)(6486002)(86362001)(36756003)(52116002)(8936002)(8676002)(5660300002)(316002)(6512007)(66946007)(66556008)(66476007)(38350700002)(4326008)(38100700002)(6916009)(1076003)(6506007)(2616005)(186003)(83380400001)(107886003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YUVQZUV2RXdYN0RMS0hub1RqVlJEVmcrMldoelhQK0tFdkJTV2owZUp6eFpH?= =?utf-8?B?N2EyWXI3M0hqV3p2R0k4a3ZFNEdDM2FjT3V3NnBtTVRsT0tBYmpNV05oanpp?= =?utf-8?B?MWlXeDk3dTc0Z0tWVTdzTXBmbkdjdlhSYmxmSEhsa3ZNWG05cmJlMTR4WWs5?= =?utf-8?B?Yk5QODZ2ditPZ0M2UitCOVdqS1JLSVg1QkU1a1A3MzBsVHdndWNVK1F2SCt6?= =?utf-8?B?VDVrN3JlVE9GYU1jN29zN2VpV0tWUEhCZWxpVGpJbUpUV1JMOHBpRnRQdWJs?= =?utf-8?B?S0VzUEtJWnd1dDNUVHhLaUxlN01ZaWFHV2c5SDR6azZqS2JDc0FvV1IrOGVP?= =?utf-8?B?TXIyVUNMUjBqaGU4dWlTU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4Z2REQ29h?= =?utf-8?B?TVE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7f96e61-1658-4245-d063-08db7bfb5f1b X-MS-Exchange-CrossTenant-AuthSource: BY3PR13MB4804.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2023 19:26:16.7013 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RtgXzXMIwOcJixHMlMGaU4rVMWkDD/1Rm3vjVZGq7PnvIk0onvHuA8bu4NobupTOLbd/RE45m5yADSohSVw5yy0LcGmttGyic2xR+5k6Wmg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5464 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org From: Qin Ke Link speeds read with get_port_link_speed() have no documented unit. This leads to issues as different PMD reports speed in both Mbps and Gbps. The only test-case making use of get_port_link_speed(), TestSuite_speed_capabilities.py, assumes the speed is returned in Mbps or an empty string if the speed could not be read. Document this behavior and extend the get_port_link_speed() implementations to convert links speeds reported by in Gbps to Mbps. Signed-off-by: Qin Ke Reviewed-by: Niklas Söderlund --- framework/pmd_output.py | 12 +++++++++++- tests/TestSuite_pmd_bonded.py | 12 +++++++++++- tests/TestSuite_vf_pmd_bonded.py | 12 +++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/framework/pmd_output.py b/framework/pmd_output.py index c8e8b50f1711..274a02eb32da 100644 --- a/framework/pmd_output.py +++ b/framework/pmd_output.py @@ -235,8 +235,18 @@ class PmdOutput: def get_port_link_speed(self, port_id): """ Get the specified port link speed now. + Return the link speed in Mbps or an empty string if speed can't be read. """ - return self.get_detail_from_port_info("Link speed: ", "\d+", port_id) + linkspeed = self.get_detail_from_port_info("Link speed: ", ".+", port_id) + s = re.compile(r"(\d+).*([MG])") + res = s.search(linkspeed) + if res: + if res.group(2) == "M": + return res.group(1) + + if res.group(2) == "G": + return f"{res.group(1)}000" + return "" def get_port_link_duplex(self, port_id): """ diff --git a/tests/TestSuite_pmd_bonded.py b/tests/TestSuite_pmd_bonded.py index f957d4e75077..931f74c77d5a 100644 --- a/tests/TestSuite_pmd_bonded.py +++ b/tests/TestSuite_pmd_bonded.py @@ -364,8 +364,18 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)' def get_port_link_speed(self, port_id): """ Get the specified port link speed now. + Return the link speed in Mbps or an empty string if speed can't be read. """ - return self.get_detail_from_port_info("Link speed: ", "\d+", port_id) + linkspeed = self.get_detail_from_port_info("Link speed: ", ".+", port_id) + s = re.compile(r"(\d+).*([MG])") + res = s.search(linkspeed) + if res: + if res.group(2) == "M": + return res.group(1) + + if res.group(2) == "G": + return f"{res.group(1)}000" + return "" def get_port_link_duplex(self, port_id): """ diff --git a/tests/TestSuite_vf_pmd_bonded.py b/tests/TestSuite_vf_pmd_bonded.py index 8cc45380283a..ae74822ea259 100644 --- a/tests/TestSuite_vf_pmd_bonded.py +++ b/tests/TestSuite_vf_pmd_bonded.py @@ -335,8 +335,18 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d, v def get_port_link_speed(self, port_id): """ Get the specified port link speed now. + Return the link speed in Mbps or an empty string if speed can't be read. """ - return self.get_detail_from_port_info("Link speed: ", "\d+", port_id) + linkspeed = self.get_detail_from_port_info("Link speed: ", ".+", port_id) + s = re.compile(r"(\d+).*([MG])") + res = s.search(linkspeed) + if res: + if res.group(2) == "M": + return res.group(1) + + if res.group(2) == "G": + return f"{res.group(1)}000" + return "" def get_port_link_duplex(self, port_id): """ -- 2.41.0