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 F174342DE7; Thu, 6 Jul 2023 12:52:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82530410FA; Thu, 6 Jul 2023 12:52:13 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 74AFB40A79; Thu, 6 Jul 2023 12:52:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688640732; x=1720176732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w95cEYnHlJc6I2alA2eOLbMfcYHsbbXLDSGqL1i1UW4=; b=Vpst1jy2GJ7M3VEV5RAkw7xVVur+e8onYYw+DZPNmIDCugBAOYnsEaPz tMXQuKWY/lmWAkFkPRxqsIBLZbWqmBfivXIV26DSvka90GgrMeYi0na3I AVtDflyaQQZONjt7/bvUXWVrpe2JD52COqZGk+vX4uhlriKZ8KYf/Q8/Y LWMpiQ0V2WFZWwLhzhxAPl+VVGGqytzyB9NubKBhNElMowc4YHduT6BJy VsMQwXSzqQnAvjF+UfJ55f1RaO0ODEY79oh5eYc1C8EuEcxXMqULwUY4V 8jbc5QsdfowgwQqI48S8rTFN2R4MHHhekMuI8963X/rKv9bQqWjmr1drD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="363604903" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="363604903" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2023 03:51:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="864070254" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="864070254" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by fmsmga001.fm.intel.com with ESMTP; 06 Jul 2023 03:51:53 -0700 From: Ciara Power To: dev@dpdk.org Cc: gakhil@marvell.com, Ciara Power , bruce.richardson@intel.com, olivier.matz@6wind.com, stable@dpdk.org, Kai Ji Subject: [PATCH v2] app/crypto-perf: fix socket ID default value Date: Thu, 6 Jul 2023 10:51:51 +0000 Message-Id: <20230706105151.1215328-1-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230705103047.1127985-1-ciara.power@intel.com> References: <20230705103047.1127985-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Due to recent changes to the default device socket ID, before being used as an index for session mempool list, the socket ID should be set to 0 if unknown (-1). Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default") Fixes: 64c469b9e7d8 ("app/crypto-perf: check range of socket id") Cc: bruce.richardson@intel.com Cc: olivier.matz@6wind.com Cc: stable@dpdk.org Signed-off-by: Ciara Power Acked-by: Kai Ji --- v2: check if socket ID equals SOCKET_ID_ANY --- app/test-crypto-perf/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index af5bd0d23b..bc1f0f9659 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -193,11 +193,10 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs) #endif struct rte_cryptodev_info cdev_info; - uint8_t socket_id = rte_cryptodev_socket_id(cdev_id); - /* range check the socket_id - negative values become big - * positive ones due to use of unsigned value - */ - if (socket_id >= RTE_MAX_NUMA_NODES) + int socket_id = rte_cryptodev_socket_id(cdev_id); + + /* Use the first socket if SOCKET_ID_ANY is returned. */ + if (socket_id == SOCKET_ID_ANY) socket_id = 0; rte_cryptodev_info_get(cdev_id, &cdev_info); @@ -650,7 +649,11 @@ main(int argc, char **argv) cdev_id = enabled_cdevs[cdev_index]; - uint8_t socket_id = rte_cryptodev_socket_id(cdev_id); + int socket_id = rte_cryptodev_socket_id(cdev_id); + + /* Use the first socket if SOCKET_ID_ANY is returned. */ + if (socket_id == SOCKET_ID_ANY) + socket_id = 0; ctx[i] = cperf_testmap[opts.test].constructor( session_pool_socket[socket_id].sess_mp, -- 2.25.1