From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 93D542C8 for ; Wed, 23 May 2018 14:11:22 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id f6-v6so8326781wmc.4 for ; Wed, 23 May 2018 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SpXo2ksRKSCGVyZDvEPl3gVbB3hHQUMOEP2N3R764QQ=; b=t3fLdjxBoY/C09Pp2y+mRpGZHE3ceIiENAWepOaZrR305FRS9TD725aVrzv81K3yD6 U9Nosy/otDVd8IuN+rIXbDrMVWfnE7vZjmDc7sgaIJIDuhwBFpplrPD9DsKQoBocioZQ yte5EyE6bPZXm5geHPoofvubP5WTBy1ICjyJlJsiTn24k+SYSdUnjAl7kYSGTqzbiII4 /nE+NxupNe+BSdSBM0Ib81sXNWouBOU8y11nGVUAndaKAJ1a+WuTOtv950A9q2fGmI0k h0JJg58oIpdj6T0Mt/rDDIGzCZY54M5PBBCR9m1xK0BRgGpVyuJP3soDai61TE5WdeYc 36WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SpXo2ksRKSCGVyZDvEPl3gVbB3hHQUMOEP2N3R764QQ=; b=gh/Up/IQSJFxBIwee8JWE4hcV52hOxs13EmmyfxES6fsDEcnFAk8RZZT8le11Py/F6 QFXdJ8feoDaAAC36qXqh9yALcGy+SIUHDuSTnV/YQwmtpfPFNTsJFkV+23IFM8jBcw30 kCiTl3mWPPtdXgAAeE/070Fcw61vnSd4HE211wgHG3HT+3qz4I+OikcGokbP4XRkEU/v KlWJ156Fbilww5vQkPgZs56bT+WmtqR8vIVCkV30ROIQ3MX5ITXd4UeGXfbeWfiD2Jj1 fjC7Xfjn8CYpyPMVIiO8wtQbWfRlY7nrNWBvP3xXqXAsDzB9IJZphNjkfIMGi+9GT89n QM/w== X-Gm-Message-State: ALKqPweoXRvZ+26vImbSYoKbkTRBEeP8YqgEgCiJYLcCsX4aPmvJXApk KhU4PaSFz7dmSHKJG9fWfzijChmQpH0= X-Google-Smtp-Source: AB8JxZpbJX6rU4MiTN2soBqK6ig1IRQT5X7PrZmmWLX/t2GtrTfUahMf4ATWAnIZYZPAiOzZkC1aOA== X-Received: by 2002:a1c:1f47:: with SMTP id f68-v6mr3668116wmf.4.1527077482273; Wed, 23 May 2018 05:11:22 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id g127-v6sm1771476wmf.42.2018.05.23.05.11.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 05:11:21 -0700 (PDT) From: luca.boccassi@gmail.com To: Kirill Rybalchenko Cc: Pablo de Lara , dpdk stable Date: Wed, 23 May 2018 13:09:52 +0100 Message-Id: <20180523121010.8385-41-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180523121010.8385-1-luca.boccassi@gmail.com> References: <20180516101323.2234-2-luca.boccassi@gmail.com> <20180523121010.8385-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'crypto/scheduler: fix 64-bit mask of workers cores' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 12:11:22 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/25/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 2c22491d2f3d73abf56c87642097974b0bd62e38 Mon Sep 17 00:00:00 2001 From: Kirill Rybalchenko Date: Mon, 21 May 2018 11:22:12 +0100 Subject: [PATCH] crypto/scheduler: fix 64-bit mask of workers cores [ upstream commit 1b78e3f26f59fd9efc5739839d8a14ebe3aa7818 ] The list of workers cores was represented by 64-bit bitmask. It doesn't work if system has cores with id higher than 63. This fix changes list of workers cores to array of uint16_t. The size of array equals to RTE_MAX_LCORE. Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode") Signed-off-by: Kirill Rybalchenko Acked-by: Pablo de Lara --- drivers/crypto/scheduler/rte_cryptodev_scheduler.h | 2 +- drivers/crypto/scheduler/scheduler_multicore.c | 4 +- drivers/crypto/scheduler/scheduler_pmd.c | 68 +++++++++++++++++----- drivers/crypto/scheduler/scheduler_pmd_private.h | 2 +- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h index 01e7646ca..1c164da7c 100644 --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h @@ -30,7 +30,7 @@ extern "C" { #endif /** Maximum number of multi-core worker cores */ -#define RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES (64) +#define RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES (RTE_MAX_LCORE - 1) /** Round-robin scheduling mode string */ #define SCHEDULER_MODE_NAME_ROUND_ROBIN round-robin diff --git a/drivers/crypto/scheduler/scheduler_multicore.c b/drivers/crypto/scheduler/scheduler_multicore.c index b4c29d72f..91fb06681 100644 --- a/drivers/crypto/scheduler/scheduler_multicore.c +++ b/drivers/crypto/scheduler/scheduler_multicore.c @@ -21,8 +21,8 @@ struct mc_scheduler_ctx { uint32_t num_workers; /**< Number of workers polling */ uint32_t stop_signal; - struct rte_ring *sched_enq_ring[RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES]; - struct rte_ring *sched_deq_ring[RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES]; + struct rte_ring *sched_enq_ring[RTE_MAX_LCORE]; + struct rte_ring *sched_deq_ring[RTE_MAX_LCORE]; }; struct mc_scheduler_qp_ctx { diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c index 51a85fa64..d7157cac1 100644 --- a/drivers/crypto/scheduler/scheduler_pmd.c +++ b/drivers/crypto/scheduler/scheduler_pmd.c @@ -20,7 +20,8 @@ struct scheduler_init_params { uint32_t nb_slaves; enum rte_cryptodev_scheduler_mode mode; uint32_t enable_ordering; - uint64_t wcmask; + uint16_t wc_pool[RTE_MAX_LCORE]; + uint16_t nb_wc; char slave_names[RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES] [RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN]; }; @@ -86,10 +87,6 @@ cryptodev_scheduler_create(const char *name, return -EFAULT; } - if (init_params->wcmask != 0) - RTE_LOG(INFO, PMD, " workers core mask = %"PRIx64"\n", - init_params->wcmask); - dev->driver_id = cryptodev_driver_id; dev->dev_ops = rte_crypto_scheduler_pmd_ops; @@ -100,15 +97,12 @@ cryptodev_scheduler_create(const char *name, if (init_params->mode == CDEV_SCHED_MODE_MULTICORE) { uint16_t i; - sched_ctx->nb_wc = 0; + sched_ctx->nb_wc = init_params->nb_wc; - for (i = 0; i < RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES; i++) { - if (init_params->wcmask & (1ULL << i)) { - sched_ctx->wc_pool[sched_ctx->nb_wc++] = i; - RTE_LOG(INFO, PMD, - " Worker core[%u]=%u added\n", - sched_ctx->nb_wc-1, i); - } + for (i = 0; i < sched_ctx->nb_wc; i++) { + sched_ctx->wc_pool[i] = init_params->wc_pool[i]; + RTE_LOG(INFO, PMD, " Worker core[%u]=%u added\n", + i, sched_ctx->wc_pool[i]); } } @@ -232,9 +226,47 @@ static int parse_coremask_arg(const char *key __rte_unused, const char *value, void *extra_args) { + int i, j, val; + uint16_t idx = 0; + char c; struct scheduler_init_params *params = extra_args; - params->wcmask = strtoull(value, NULL, 16); + params->nb_wc = 0; + + if (value == NULL) + return -1; + /* Remove all blank characters ahead and after . + * Remove 0x/0X if exists. + */ + while (isblank(*value)) + value++; + if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) + value += 2; + i = strlen(value); + while ((i > 0) && isblank(value[i - 1])) + i--; + + if (i == 0) + return -1; + + for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) { + c = value[i]; + if (isxdigit(c) == 0) { + /* invalid characters */ + return -1; + } + if (isdigit(c)) + val = c - '0'; + else if (isupper(c)) + val = c - 'A' + 10; + else + val = c - 'a' + 10; + + for (j = 0; j < 4 && idx < RTE_MAX_LCORE; j++, idx++) { + if ((1 << j) & val) + params->wc_pool[params->nb_wc++] = idx; + } + } return 0; } @@ -246,7 +278,7 @@ parse_corelist_arg(const char *key __rte_unused, { struct scheduler_init_params *params = extra_args; - params->wcmask = 0ULL; + params->nb_wc = 0; const char *token = value; @@ -254,7 +286,11 @@ parse_corelist_arg(const char *key __rte_unused, char *rval; unsigned int core = strtoul(token, &rval, 10); - params->wcmask |= 1ULL << core; + if (core >= RTE_MAX_LCORE) { + CS_LOG_ERR("Invalid worker core %u, should be smaller " + "than %u.\n", core, RTE_MAX_LCORE); + } + params->wc_pool[params->nb_wc++] = (uint16_t)core; token = (const char *)rval; if (token[0] == '\0') break; diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h b/drivers/crypto/scheduler/scheduler_pmd_private.h index dd7ca5a4e..12410b483 100644 --- a/drivers/crypto/scheduler/scheduler_pmd_private.h +++ b/drivers/crypto/scheduler/scheduler_pmd_private.h @@ -60,7 +60,7 @@ struct scheduler_ctx { char name[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN]; char description[RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN]; - uint16_t wc_pool[RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES]; + uint16_t wc_pool[RTE_MAX_LCORE]; uint16_t nb_wc; char *init_slave_names[RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES]; -- 2.14.2