Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E743EB64DA for ; Wed, 5 Jul 2023 09:44:57 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A58AF42BAC; Wed, 5 Jul 2023 11:44:56 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id E4E1342B8C for ; Wed, 5 Jul 2023 11:44:54 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id CA921206C3; Wed, 5 Jul 2023 11:44:54 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01D9AF25.59F7C8C6" Subject: RE: [PATCH] cryptodev: fix device socket ID type Date: Wed, 5 Jul 2023 11:44:50 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87A61@smartserver.smartshare.dk> X-MimeOLE: Produced By Microsoft Exchange V6.5 In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] cryptodev: fix device socket ID type Thread-Index: AQHZqoyzIcXN8De6g0qDK1WwkMIGAa+qOSv3gAC50oA= References: <20230629132155.75075-1-ciara.power@intel.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Ji, Kai" , "Power, Ciara" , Cc: "Matz, Olivier" , "Akhil Goyal" , "Fan Zhang" , "Bruce Richardson" 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 This is a multi-part message in MIME format. ------_=_NextPart_001_01D9AF25.59F7C8C6 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In my opinion, changing the type to the conventional type used for = socket_id seems like a much better solution than just changing the = signedness, as proposed in another RFC [1]. (If we used more = specialized types, like socket_id_t, we wouldn't even have this = discussion. It is the DPDK convention to avoid specialized types, and = I'm not against this convention; I'm only mentioning it to support = changing the type here to int.) =20 And SOCKET_ID_ANY (-1) being used for multiple purposes, as discussed in = the RFC, is another issue, to be discussed separately. =20 [1]: = https://patches.dpdk.org/project/dpdk/patch/20230117101646.2521875-1-didi= er.pallard@6wind.com/ = =20 =20 Acked-by: Morten Br=F8rup =20 Acked-by: Kai Ji ________________________________ From: Power, Ciara Sent: 29 June 2023 14:21 To: dev@dpdk.org Cc: Ji, Kai ; Power, Ciara ; = Matz, Olivier ; Akhil Goyal = ; Fan Zhang Subject: [PATCH] cryptodev: fix device socket ID type=20 =20 The socket ID field for a cryptodev device data was unsigned int. Due to recent changes to the default device socket ID, this caused an issue when the socket ID was unknown and set to -1. The device socket ID wrapped around to 255, and caused errors when allocating memory. Changing this field type to int fixes the issue, as it now takes the correct -1 value. Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by = default") Cc: olivier.matz@6wind.com Signed-off-by: Ciara Power --- lib/cryptodev/cryptodev_pmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cryptodev/cryptodev_pmd.h = b/lib/cryptodev/cryptodev_pmd.h index 8710ed7558..4c98cedca6 100644 --- a/lib/cryptodev/cryptodev_pmd.h +++ b/lib/cryptodev/cryptodev_pmd.h @@ -65,7 +65,7 @@ struct rte_cryptodev_data { /** Device ID for this instance */ uint8_t dev_id; /** Socket ID where memory is allocated */ - uint8_t socket_id; + int socket_id; /** Unique identifier name */ char name[RTE_CRYPTODEV_NAME_MAX_LEN]; =20 --=20 2.25.1 ------_=_NextPart_001_01D9AF25.59F7C8C6 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

In my opinion, changing the type to the conventional type used for = socket_id seems like a much better solution than just changing the = signedness, as proposed in =A0another RFC [1]. (If we used more = specialized types, like socket_id_t, we wouldn’t even have this = discussion. It is the DPDK convention to avoid specialized types, and = I’m not against this convention; I’m only mentioning it to = support changing the type here to int.)

 

And SOCKET_ID_ANY (-1) being used for multiple purposes, as discussed = in the RFC, is another issue, to be discussed = separately.

 

[1]: https://pat= ches.dpdk.org/project/dpdk/patch/20230117101646.2521875-1-didier.pallard@= 6wind.com/

 

Acked-by: Morten Br=F8rup = <mb@smartsharesystems.com>

 

Acked-by: Kai Ji <kai.ji@intel.com>


From: Power, Ciara <ciara.power@intel.com>
Sent: 29 June = 2023 14:21
To: dev@dpdk.org <dev@dpdk.org>
Cc: = Ji, Kai <kai.ji@intel.com>; Power, Ciara = <ciara.power@intel.com>; Matz, Olivier = <olivier.matz@6wind.com>; Akhil Goyal <gakhil@marvell.com>; = Fan Zhang <fanzhang.oss@gmail.com>
Subject: [PATCH] = cryptodev: fix device socket ID type

 

The socket ID field for a cryptodev device = data was unsigned int.
Due to recent changes to the default device = socket ID,
this caused an issue when the socket ID was unknown and = set to -1.
The device socket ID wrapped around to 255,
and caused = errors when allocating memory.

Changing this field type to int = fixes the issue, as it now takes the
correct -1 value.

Fixes: = 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by = default")
Cc: olivier.matz@6wind.com

Signed-off-by: Ciara = Power = <ciara.power@intel.com>
---
 lib/cryptodev/cryptodev_pmd= .h | 2 +-
 1 file changed, 1 insertion(+), 1 = deletion(-)

diff --git a/lib/cryptodev/cryptodev_pmd.h = b/lib/cryptodev/cryptodev_pmd.h
index 8710ed7558..4c98cedca6 = 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ = b/lib/cryptodev/cryptodev_pmd.h
@@ -65,7 +65,7 @@ struct = rte_cryptodev_data {
         = /** Device ID for this instance = */
         uint8_t = dev_id;
         /** Socket = ID where memory is allocated */
-       = uint8_t socket_id;
+       int = socket_id;
         /** = Unique identifier name = */
         char = name[RTE_CRYPTODEV_NAME_MAX_LEN];
 
-- =
2.25.1

------_=_NextPart_001_01D9AF25.59F7C8C6--