Skip to contentSkip to conversation

cryptodev: fix device socket ID type

PATCH Superseded Ciara Power 5 participants 6 messages Jun 29, 2023 – Jul 5, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 lib/cryptodev/cryptodev_pmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cryptodev/cryptodev_pmd.h +1 -1
index 8710ed7558..4c98cedca6 100644
@@ -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];
 
Signature · 1 line
2.25.1
Acked-by Kai Ji on v1 1/1
#1 lore raw

________________________________
From: Power, Ciara <[email protected]>
Sent: 29 June 2023 14:21
To: [email protected] <[email protected]>
Cc: Ji, Kai <[email protected]>; Power, Ciara <[email protected]>; Matz, Olivier <[email protected]>; Akhil Goyal <[email protected]>; Fan Zhang <[email protected]>
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")
---
 lib/cryptodev/cryptodev_pmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cryptodev/cryptodev_pmd.h +1 -1
index 8710ed7558..4c98cedca6 100644
@@ -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

Acked-by Acked-by Kai Ji
#2 lore raw

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.)

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

[1]: https://patches.dpdk.org/project/dpdk/patch/[email protected]/ <https://patches.dpdk.org/project/dpdk/patch/[email protected]/>

________________________________

From: Power, Ciara <[email protected]>
Sent: 29 June 2023 14:21
To: [email protected] <[email protected]>
Cc: Ji, Kai <[email protected]>; Power, Ciara <[email protected]>; Matz, Olivier <[email protected]>; Akhil Goyal <[email protected]>; Fan Zhang <[email protected]>
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")
---
 lib/cryptodev/cryptodev_pmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cryptodev/cryptodev_pmd.h +1 -1
index 8710ed7558..4c98cedca6 100644
@@ -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];
 
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 1/1 cryptodev: fix device socket ID type

In reply to Ciara Power

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")

---
v2: Added cc for stable mailing list

---
 lib/cryptodev/cryptodev_pmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cryptodev/cryptodev_pmd.h +1 -1
index 8710ed7558..4c98cedca6 100644
@@ -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];
 
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#4 lore raw

05/07/2023 11:36, Ciara Power пишет:

Quoted 28 lines

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")

---
v2: Added cc for stable mailing list

---
  lib/cryptodev/cryptodev_pmd.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/cryptodev/cryptodev_pmd.h +0 -0
index 8710ed7558..4c98cedca6 100644

lib/cryptodev/cryptodev_pmd.h struct rte_cryptodev_data { · line 71

Quoted 8 lines
lib/cryptodev/cryptodev_pmd.h +1 -1
@@ -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];
 
Acked-by Applied
#5 lore raw
Quoted 13 lines

05/07/2023 11:36, Ciara Power пишет:

Quoted 10 lines

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")

Quoted 8 lines
Quoted 7 lines

Applied to dpdk-next-crypto
Thanks.