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 5346CA0C45; Mon, 22 Nov 2021 07:13:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C728F4014E; Mon, 22 Nov 2021 07:13:23 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2079.outbound.protection.outlook.com [40.107.236.79]) by mails.dpdk.org (Postfix) with ESMTP id AEDDE4003C for ; Mon, 22 Nov 2021 07:13:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQ0zfLYv13g8DAWbfmUG/3NJ9tz8ZCwDfu35o828DueuoDeG1s3c0DpSdsvCWsb+5jqk7GG1nyPUzsFB9lWfz6hgV6mnFlElYrjfX3ao/H1QIjRHG8ARfW3vzuZXTTe9sIaqqilMnTl9YDuI7/JWntjNAwe7pqSwxteZl9lRYZH8AFSKpezol3Ep9GEc4ECvjN/ui+VG1pEm3riRK2nA7So70EpzlTYt0xDeVYIMng4kvykpP0DHa3yZjxgFN9B1VYTr67kB2rSN4cI0LnI3rpX3Du3EAdnzh35/YONZhZeH5KArp7UVICkQNUoeZ6Y9BfsdzIfoUfH1lLs+lk7NbQ== 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=UQOM+yjvRM+oCDnvlZv9EfHHFOCCWeXZuYnC4fQcDUE=; b=I64SN2xaNOEkz8Z1W0wdct2apMB3eStPUKRs/yPDCFH7R5U5vxbphfEnSB+0UtLEbJU68CUY+IW9USJefutaVBXlVxNjfIVEkTEh/DO3AF7W57NC0XgJfgyHS+2YmlCGUkr8aaqE/TqikGhH4qqgm8g3g6WUzqo+quKMSyPGR72uWgNSsk5+DtfvcKJY0bx8l6uHgD1dLzQ5cXSIApBsOS8nsuXuHh/RA/EpKg9D5/hNwm6sJg5IjOjS330Og2voFFsMtF6Ex3hQpMZ3x5/zLK4L137/GQYBK4ioJh00JauGiH9UYCHb/Rcr56Y6cd7t6lKRRL+fdx5rhIoeTtIKag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=ashroe.eu smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=UQOM+yjvRM+oCDnvlZv9EfHHFOCCWeXZuYnC4fQcDUE=; b=EPxhiyJTEKoqFDrpFUC35aQHzR0yMJUb75xZJ/Tza8GJSVeJQbMthlHLA6i0BZQgSk3BLBVXO3M5hunTJXooB9sD8wRwnnPtVeMU+P1g/ulRyJLFFxwCmlf7vwaJ8ehqQiSNRI09yknoKdAc3EGOhiHpRXbXo9xmInioFZzGbFFQ6y0EdvY42Y2y39aMJTaXddDvd4j2wEh9e5qB2Ewg2fAjCMRmIskbX1M6bmqozLDYjhfConrk2A9jYzuuQwkVKzEwdkN+wYv7TZXmhdkJz8TtbZYRMc+mplXgt1CVN781W6LpP5SFqI0mwG6oRLV5dk6kCtg0r/f2SatCbIcl6Q== Received: from DM6PR06CA0070.namprd06.prod.outlook.com (2603:10b6:5:54::47) by BL0PR12MB5009.namprd12.prod.outlook.com (2603:10b6:208:1c2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Mon, 22 Nov 2021 06:13:20 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::38) by DM6PR06CA0070.outlook.office365.com (2603:10b6:5:54::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20 via Frontend Transport; Mon, 22 Nov 2021 06:13:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Mon, 22 Nov 2021 06:13:18 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 22 Nov 2021 06:13:15 +0000 From: Xueming Li To: CC: , Lior Margalit , , Parav Pandit , Ray Kinsella , David Marchand Subject: [PATCH] kvargs: fix device iterator match from arguments Date: Mon, 22 Nov 2021 14:12:50 +0800 Message-ID: <20211122061250.3220823-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53e22ca0-35db-45bf-80a0-08d9ad7f2d83 X-MS-TrafficTypeDiagnostic: BL0PR12MB5009: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5OCL25xcrtI3TbwavhwyPmWIRRZuIN6/lmfDsQGF6u3IWP8F4jPrdr3E28YpCzyPv1/e486AjX/5HWd+D3P9/4+Lt1wd0suZTIvZ18OvQV/f+58aZtZHYdZfZRd9XrnzeSqwQP8YCyafX8Dcda0aHKY5xogW3IVuFuTKrZWaadUCstZd+3vih0AbzMa2e+KNLEo5DZvc1+OYJgIb991olMCi7XTAdBk0GeOb9yBkVrFlvuX6bJG0/a5VSxYBd0iknAu2f8Al0joYieGhv8sKc6V168PgTBFeQpCN3xiAkKrqwtUlB4UBPUYUxfckK0Ponr7AxMPQUe07bgCyv9ClS5/n4t0Q5TJx+WbMHpMIhdx6Hm9SALIg9ZcJKRS7Ap4W+5oaNXm7CigB3eHXKHyn4NyGcRJt3JHbxDXTO9+itcC9KtLaZOgJ1bmoh5q9GUdCtzqZX3hxID20hqD4kmUEsMv5dEz4cirxuXl9AIvN8/6al4muRqfU9cn07Zqvn9w0cm1ncWPiOKwSlvJaPKpYDu+yGPrxst4F3fW/9P40mlXMLKh9JyDOEj1y9PNxghJAOY7N9nkcIOt1CV3mBWm1dkPgrXGrSlvAp4FXI3s8GIVG63PLBVXFG1mgYAB40dtDCeUo9X2HtSjw4AIIKsz+gm+6291mKn8brHxFPLDzCFspT3JP98NqQZBzLxnPQ4L5tKLJ0C6i3Mst4i8sYqOVLA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(8676002)(2906002)(70586007)(1076003)(7696005)(47076005)(8936002)(356005)(5660300002)(508600001)(6286002)(70206006)(54906003)(7636003)(82310400003)(316002)(186003)(16526019)(426003)(4326008)(6916009)(36756003)(336012)(36860700001)(26005)(86362001)(6666004)(2616005)(55016002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2021 06:13:18.3281 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53e22ca0-35db-45bf-80a0-08d9ad7f2d83 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5009 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Device iterator RTE_DEV_FOREACH() failed to return devices from classifier like "class=vdpa", because matching name from empty kvargs returns no result. If device name not specified in kvargs, the function should iterate all devices. This patch allows empty devargs or devargs without name specified. Fixes: 6aebb942907d ("kvargs: add function to get from key and value") Cc: olivier.matz@6wind.com Signed-off-by: Xueming Li --- 21.11 specific bug, no copy to stable.org --- drivers/bus/auxiliary/auxiliary_params.c | 3 +++ drivers/bus/vdev/vdev_params.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c index a9c7853ed1d..6a6382961ea 100644 --- a/drivers/bus/auxiliary/auxiliary_params.c +++ b/drivers/bus/auxiliary/auxiliary_params.c @@ -27,6 +27,9 @@ auxiliary_dev_match(const struct rte_device *dev, const struct rte_kvargs *kvlist = _kvlist; const char *key = auxiliary_params_keys[RTE_AUXILIARY_PARAM_NAME]; + /* Iterate all devices if name not specified. */ + if (kvlist == NULL || rte_kvargs_get(kvlist, key) == NULL) + return 0; if (rte_kvargs_get_with_value(kvlist, key, dev->name) == NULL) return -1; diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c index 37d95395e7a..bab4c0d1d08 100644 --- a/drivers/bus/vdev/vdev_params.c +++ b/drivers/bus/vdev/vdev_params.c @@ -29,6 +29,9 @@ vdev_dev_match(const struct rte_device *dev, const struct rte_kvargs *kvlist = _kvlist; const char *key = vdev_params_keys[RTE_VDEV_PARAM_NAME]; + /* Iterate all devices if name not specified. */ + if (kvlist == NULL || rte_kvargs_get(kvlist, key) == NULL) + return 0; if (rte_kvargs_get_with_value(kvlist, key, dev->name) == NULL) return -1; -- 2.33.0