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 8FF36A0351 for ; Thu, 24 Feb 2022 14:24:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8311D426E9; Thu, 24 Feb 2022 14:24:36 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2059.outbound.protection.outlook.com [40.107.243.59]) by mails.dpdk.org (Postfix) with ESMTP id 543B94114D; Thu, 24 Feb 2022 14:24:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrF7jX/bogVe4MwhnNIAjlKxyV6kohf3nqttWn1FErRWIp38g5VMfdX0Mx0OEdTzZTRHsEeqGr9vcc8f2/hloCLNbf4JTf6XlS1/1p1dRyCZXFbUHXwwqckWPBpf+PsOP5F30NTyhilK3HEW9urLmjDzVYuV282/zlhGJ0rYPc1lG30V//TpVuIWmIXehPQ4+/DTDLinjruR3DKT7VDCx+qNRRaNznVQ5tZdmQHieWlpT4AunTiQyASREgXYJzTJ1DItXt4lnIGn/LUGgZuRGlY406r5Nmd49B/3KE6JbiKAoFFX4luduucB/3fHrmA/zFSzIxZm8bygA67mQLM9Cw== 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=RvE94eHAYsDtheW+Szp0G1X2nB5zu657Rz+8EOE+K5Q=; b=RJsSU3o99F2WJrBZx3Q/gHlsP8pa9Vp3IZKCS2qd8Xlq0bILwDs8/irlO7N1+wieaIs5jnMfNeiSr8rlIwzWEF/C8IB+HmxBtRBHYsk9/tIW8KJHQbVanwhSx44fXdUC9QJq4GRlRHkxfZBw7dE/wDF+fs9hHhnoUfxTaSKgIV5MqY0gFKYgbP3TmouLLwO2b30r2wzMdu0RezjTpktBaim4AcypQPKO+C7ghtL6D9jauDRvQw0VigOZGjGKFP0AhmqfUwqbJoWDLDv9T6UKn46fW+aH9BLYSryGDA+E4MBmkDuTn2zkwGOgsYyV4ek2PhCfI/RRB+6cxdxfMN/X3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RvE94eHAYsDtheW+Szp0G1X2nB5zu657Rz+8EOE+K5Q=; b=A2bYiK+HLyQckCBgG/xMORKX5XeYMYewLM86thm/IjfBgcyeW9Z6hGUdJtVYGf+ehDU9ydUiMfPCEGNY5l+K+/iRyYXRNp54m4M6vUCtjVHoD1/QUEySlEKIvHRiG0jRAsJftc9eXfcnPiMLBkCbx3cKpSUG7oWenfhuEGY4TOtHNB7hRt9LtD+gB4QgbfVoDyDvWBTISplRvE/Mmf2XE2m6jyq/TePAhfP+mwpEMvFrkCsQi9bHjGYtAbjAhy0lfZl2Ub+NO7EKgf6wyQrPjP0fxgd+P3PeXR3sdwJFxjGeAC1raWhDOpE/eHECh+RIBYxhyukEOG91qRMNHsojAg== Received: from DM3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:0:50::31) by BYAPR12MB3382.namprd12.prod.outlook.com (2603:10b6:a03:a9::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Thu, 24 Feb 2022 13:24:32 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:0:50:cafe::c7) by DM3PR03CA0021.outlook.office365.com (2603:10b6:0:50::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23 via Frontend Transport; Thu, 24 Feb 2022 13:24:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 13:24:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 13:24:31 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Thu, 24 Feb 2022 05:24:27 -0800 From: Xueming Li To: CC: , , Maxime Coquelin , Chenbo Xia , Matan Azrad Subject: [PATCH] examples/vdpa: fix disabled VirtQ statistics query Date: Thu, 24 Feb 2022 21:24:05 +0800 Message-ID: <20220224132405.1939006-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d62b621-d282-46f6-24aa-08d9f798fe2f X-MS-TrafficTypeDiagnostic: BYAPR12MB3382:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jCm8SQulF9V4svTsQj117jqvZ0E6VWVx9C/uJdktflU10d1FqnwK3u+LV6l6kbppybiEfF61ORpNBnGSP5kdZVcxqnbqZ8CAq+tc7dNwRQYMoqnOu0VwvzJRmzKiOs/41UEdFvWH6r+UfNHCxGGE2/CjpPy288k2zQZNKf40YMSAJ596hHA3IlOlNFMwTMYC6Fpn5mH6/NnFp5OuaZcMI/i8p33kiue10c80Ls/S5rnDh9AzPi4hzZ5ti52iaA1t1c2L0oIWVDiULkf3urUAIMUmsJqqPJKzGyiwsLa5BdSVIt/Iv/VSgpUJkUq81sYD4jyLWF5c9oyJL2wZvKIZ1NsEgMNCPvrCWbhdbt4XMcl5Rn+IJ/VRlvFMTbm+trsNYmPZrxgvg1mlgItOg47YlsvQVdzzJS71bR8nMPzVySQze0oftsX2o877WbbmR1uDzG0hQEWx7pqKwAkEDD2/EOxna8VgCmUY6+YvqMXCwpBszEMw1y13c3OYQpkH3A/NVvDafaOkk28t9QNnh1whK/P/6NHcsKN5GGkI9mxTInXJ5dhAWdM2mVeyVQSCgzlyWj0cFgUU8GfNLxJqb/qFAJLMrWw+yMJDn3CapAgr3zZmepbQC2BugYXeQzJbXyYaz8PUVYhYBtkFjK/R7edV6wGNfD4zPaMd6oZipbysFOISB180os5APt/cHtYBEzVWHHTTqyS0jBZMLsJOdfYHmQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(426003)(336012)(8936002)(2616005)(36756003)(107886003)(1076003)(2906002)(508600001)(186003)(55016003)(47076005)(5660300002)(16526019)(26005)(6286002)(7696005)(83380400001)(6666004)(316002)(54906003)(81166007)(36860700001)(40460700003)(6916009)(86362001)(70206006)(4326008)(8676002)(70586007)(356005)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 13:24:31.9977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d62b621-d282-46f6-24aa-08d9f798fe2f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3382 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Quit VirtQ statistics query instead of reporting error. Fixes: 6505865aa8ed ("examples/vdpa: add statistics show command") Cc: stable@dpdk.org Signed-off-by: Xueming Li --- examples/vdpa/main.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c index 5ab07655aed..bd66deca85c 100644 --- a/examples/vdpa/main.c +++ b/examples/vdpa/main.c @@ -391,7 +391,9 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl, struct rte_vdpa_device *vdev = rte_vdpa_find_device_by_name(res->bdf); struct vdpa_port *vport = NULL; uint32_t first, last; + int vq_disabled = -1; int i; + int ret; if (!vdev) { RTE_LOG(ERR, VDPA, "Invalid device: %s.\n", @@ -449,8 +451,20 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl, cmdline_printf(cl, "\nDevice %s:\n", res->bdf); for (; first <= last; first++) { memset(vport->stats, 0, sizeof(*vport->stats) * vport->stats_n); - if (rte_vdpa_get_stats(vport->dev, (int)first, vport->stats, - vport->stats_n) <= 0) { + ret = rte_vdpa_get_stats(vport->dev, (int)first, vport->stats, + vport->stats_n); + if (ret == 0) { + /* VQ disabled. */ + if (vq_disabled == -1) + vq_disabled = (int)first; + continue; + } + if (vq_disabled != -1) { + cmdline_printf(cl, "\tVirtq %d - %d disabled\n", + vq_disabled, (int)first - 1); + vq_disabled = -1; + } + if (ret < 0) { RTE_LOG(ERR, VDPA, "Failed to get vdpa queue statistics" " for device %s qid %d.\n", res->bdf, (int)first); @@ -464,6 +478,9 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl, vport->stats[i].value); } } + if (vq_disabled != -1) + cmdline_printf(cl, "\tVirtq %d - %d disabled\n", + vq_disabled, (int)first - 1); } cmdline_parse_token_string_t cmd_device_stats_ = -- 2.35.1