[dpdk-dev,v2,2/4] crypto/scheduler: remove socket id check

Message ID 20170621050733.88850-3-pablo.de.lara.guarch@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

De Lara Guarch, Pablo June 21, 2017, 5:07 a.m. UTC
  Socket id parsed from the user was checked
if it was in the range of available sockets.
This check is unnecessary, as the socket specified
might not have memory anyway, so it will fail
at memory allocation.

Therefore, the best solution is to remove this check.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/crypto/scheduler/scheduler_pmd.c | 22 ----------------------
 1 file changed, 22 deletions(-)
  

Comments

Doherty, Declan June 22, 2017, 11:38 a.m. UTC | #1
On 21/06/2017 6:07 AM, Pablo de Lara wrote:
> Socket id parsed from the user was checked
> if it was in the range of available sockets.
> This check is unnecessary, as the socket specified
> might not have memory anyway, so it will fail
> at memory allocation.
>
> Therefore, the best solution is to remove this check.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
>
Acked-by: Declan Doherty <declan.doherty@intel.com>
  

Patch

diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 0b63c20..29b16c9 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -219,22 +219,6 @@  cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
 	return 0;
 }
 
-static uint8_t
-number_of_sockets(void)
-{
-	int sockets = 0;
-	int i;
-	const struct rte_memseg *ms = rte_eal_get_physmem_layout();
-
-	for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
-		if (sockets < ms[i].socket_id)
-			sockets = ms[i].socket_id;
-	}
-
-	/* Number of sockets = maximum socket_id + 1 */
-	return ++sockets;
-}
-
 /** Parse integer from integer argument */
 static int
 parse_integer_arg(const char *key __rte_unused,
@@ -390,12 +374,6 @@  scheduler_parse_init_params(struct scheduler_init_params *params,
 				&parse_ordering_arg, params);
 		if (ret < 0)
 			goto free_kvlist;
-
-		if (params->def_p.socket_id >= number_of_sockets()) {
-			CDEV_LOG_ERR("Invalid socket id specified to create "
-				"the virtual crypto device on");
-			goto free_kvlist;
-		}
 	}
 
 free_kvlist: