From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D6C6A057B; Mon, 23 Mar 2020 18:50:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 03C4F1C08E; Mon, 23 Mar 2020 18:50:32 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50079.outbound.protection.outlook.com [40.107.5.79]) by dpdk.org (Postfix) with ESMTP id 5F64C1C068 for ; Mon, 23 Mar 2020 18:50:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aDS3wWivn10qW1miSjwYTADnfvKbSh5w5NWKSHsevoVC53uyUsM0O6BWrxzZtNQpufm7HrVp1SMYYX4ctBsC6jK7B+HKgSlEIqjKfxzb9pAWQz9IFd+cBzFhx712W58rAYV8iDZgadIdBtujrb+JxDgz1lnOJCy8VhbIqhoq2DliQ1LS7JQ9zBAqkx9uYL252WKrnIpDMGF9I/a/qHopWSv6HyRtQD1hMGgT+ud3csCkpPKq4r60+h+2kLppOKbhxw3jzOX5ZeHq+vzvZb+lKea5Uy+kywAyfhyOrIVXrL0xaf0y+89sf7TduHb9TCW3l3El06s4OZUEIOSpB4kciQ== 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-SenderADCheck; bh=l2mFAOPB+3CYCAi0UqfUGC2vxGGZpuqVg2lo1f24ASQ=; b=cusMAKbsOVLfu3wlK4/VitPcJkd6pT30ilvy7WttM7SUh/YiMnz3YJ2y24RR3CR6ceItd4LpyTGxz1ENmirZwT/s0wDnmKQqRzmmoKjzE9EnOourUmpi500kUkb/KBrS2zWE6ZOBIa+YYJUFZMOp5JHzzdA9g91U5iQ1ILAUeuNel1/XaAo5Um/XrNtV5qECCSmGdVmdC28nWpCAydRnpBGzlEayhwM8I9e/ZWGSIEKVtcSS46TSnmuLSku452SzMp8i+/5IwLR2D2C7MzjL2HWZtBEo0Je9Aaev0FnyfDuTSkC1RA6pJgD3YGMcG50FUc8anaV5/crp/74tRLL7tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=l2mFAOPB+3CYCAi0UqfUGC2vxGGZpuqVg2lo1f24ASQ=; b=kH6D39P2Vd+i+W9SFnJb0bTTb6ZPJuo8lk+TDYftAUpCTvsDzzfSCFi2Up1/jW+nqugOeAr6Uv9u/AgspnAZnSybHfOYHg/upaAmLS6F/5mpHd3XBE+IP2KfPP0AOK2H++B8DXKlbBDxYsxpmxSo9COK59s/XP3Dsjljaz8AyOM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=asafp@mellanox.com; Received: from VI1PR05MB5693.eurprd05.prod.outlook.com (20.178.124.87) by VI1PR05MB4782.eurprd05.prod.outlook.com (20.176.3.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Mon, 23 Mar 2020 17:50:29 +0000 Received: from VI1PR05MB5693.eurprd05.prod.outlook.com ([fe80::f50f:1ae4:52bb:ce7b]) by VI1PR05MB5693.eurprd05.prod.outlook.com ([fe80::f50f:1ae4:52bb:ce7b%7]) with mapi id 15.20.2835.021; Mon, 23 Mar 2020 17:50:29 +0000 From: Asaf Penso To: dev@dpdk.org Cc: viacheslavo@mellanox.com, matan@mellanox.com Date: Mon, 23 Mar 2020 17:50:13 +0000 Message-Id: <1584985813-14883-1-git-send-email-asafp@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain X-ClientProxiedBy: PR0P264CA0136.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::28) To VI1PR05MB5693.eurprd05.prod.outlook.com (2603:10a6:803:d9::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR0P264CA0136.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Mon, 23 Mar 2020 17:50:28 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4a23212f-21ec-4b72-d465-08d7cf52ac9e X-MS-TrafficTypeDiagnostic: VI1PR05MB4782:|VI1PR05MB4782: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0351D213B3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(39860400002)(366004)(376002)(396003)(199004)(52116002)(7696005)(8886007)(316002)(107886003)(2906002)(6666004)(86362001)(55016002)(8676002)(8936002)(81166006)(81156014)(66556008)(186003)(66476007)(478600001)(5660300002)(16526019)(6916009)(2616005)(4326008)(36756003)(26005)(66946007)(956004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4782; H:VI1PR05MB5693.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Um3VzTqPvEbizyveJAKOgkEFNp1RFhHLY8syEjkDywWPsHGSzp6JI7aOkeGjmke+PjLzJ8QtPfoTqr0pzWeDjsZloKsIwJXjv0myq1sD2HYwPJGx+5p40g93e/I4FEzwbVo344Cc2Ch4Lc1NuX/+X/fu6cmbSaPjYHXN8utgD5Ii1ou/QC1SyHaVucK7LiF3nc8GNWoCeEIs0d9bD4+CaS5cQyVCF9hBMDujXuSmcGMFffNNYf3IThco0ScIKaBMnRjorvDVDJy2N0xBi1zY1f1aySEFtqvBDRtnaw4jc2sxoLXZQNVSYeE+jn40vz1XQgWQa+EkcamR5lzaTYBM12+1Vo4JJ1vF4ynoaMNe0qWvY/nqw2YUwS8S1IcsZHYoefBayXGkCW/kMrkvtkFFcxMVLtb+hOxyUkMVt4qfS58kkbVV/CJx0Un6gxEORI4V X-MS-Exchange-AntiSpam-MessageData: NsT3DIvcKjHUTQL4kMvlfJBFVVbKBz1O7UZLzDw5O/4sjTuhWFyAgZRPYm4AWL0uwYnYgipolp86SPipRHSniGs8xLmj9MgeM1cLXiSbZerYBRHPEedAy5UDilKNOdCgwMgp8aYE7dKFRcAMz3mhLA== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a23212f-21ec-4b72-d465-08d7cf52ac9e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2020 17:50:29.0290 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iCVs/ra4OFIwcjxVJcp51tlrgI/GgOk2AounYsLJ+kTyiC6pRpx3qsrx23mNFhW3wQg6yMo9nSleLOQ4/9Z0yA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4782 Subject: [dpdk-dev] [PATCH] vdpa/mlx5: set default queue indices 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The rte_vhost_get_vring_base function is being called to get the values of last_avail_idx and last_used_idx. These fields will not have the correct values in case the function returns an error. Adding a check for the function return value, and in the case of an error, set the fields to be zero and print a warning message. Signed-off-by: Asaf Penso Acked-by: Matan Azrad --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 2312331..cb2d61b 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -236,10 +236,17 @@ } attr.available_addr = gpa; } - rte_vhost_get_vring_base(priv->vid, index, &last_avail_idx, + ret = rte_vhost_get_vring_base(priv->vid, index, &last_avail_idx, &last_used_idx); - DRV_LOG(INFO, "vid %d: Init last_avail_idx=%d, last_used_idx=%d for " - "virtq %d.", priv->vid, last_avail_idx, last_used_idx, index); + if (ret) { + last_avail_idx = 0; + last_used_idx = 0; + DRV_LOG(WARNING, "Couldn't get vring base, idx are set to 0"); + } else { + DRV_LOG(INFO, "vid %d: Init last_avail_idx=%d, last_used_idx=%d for " + "virtq %d.", priv->vid, last_avail_idx, + last_used_idx, index); + } attr.hw_available_index = last_avail_idx; attr.hw_used_index = last_used_idx; attr.q_size = vq.size; -- 1.8.3.1