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 C667841C82; Mon, 13 Feb 2023 06:08:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5EC2B40DDB; Mon, 13 Feb 2023 06:08:28 +0100 (CET) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) by mails.dpdk.org (Postfix) with ESMTP id 1DA2640A81 for ; Mon, 13 Feb 2023 06:08:27 +0100 (CET) Received: by mail-ua1-f46.google.com with SMTP id bx25so561015uab.9 for ; Sun, 12 Feb 2023 21:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EvhQf/OaSQuM/thjOrQwR/TLQ3C5GF+l83yOjH4cB9M=; b=ogrNK1jKZfct8Uz2akK5LsGwE3r2yhXJJCuHMWqTXSXsgJQ3hIwb/h/IwDUYFh/Sdz Q64+DEIfzKs96fEYctUbQ1Uve/cak9ZSik7NPe8hXNja6UoG6xL43LzmwAtckdaO/wM4 zEHp3i5OT1Difm2VIdjGBW6mIbXahOo0r30cVUmYXw6VIUqJblWGehBtcrGMrE5j8chP k20H46LcsfxkVLB1/uWWQj0GXQrYGCU7NMNzV+NlyU2aQhMo7AXkoR+kCkbXOJmk1CiO DhNK37YW+yXJTcyb2GIfTbIt+bQi6HogSXZx5gYy/Ejr0z0suliGo/N16ZxkG6mk6V70 47jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EvhQf/OaSQuM/thjOrQwR/TLQ3C5GF+l83yOjH4cB9M=; b=A7NfMA+kZvyGBfLq9+qVg3w+sihoDKXIfxQ0HRMsoix5klRo/yQXUrVa9KmVskzrcG rjtDgrAdUKFGbgwrkUuU6d6RYmW6tOZnEZ49UavDRut2LWQmQAp4YADblqX5crdtRUXT BJLdnwGk6WrOPsG5naLt4ndiTW3ZGk4IGqwuK1kRNrv9KlResdltWxqCrVVaHfK0L5qf uZvj+Kl9iaf9FQthwnd2nzl1ZL8jcYd3vnNwxWrb3vRmoKsxrQ+KhHTe2gywmUDQ35Bl zU3g53Njfwj57HTJPOoUVmWqAVVQVyL3A/L2wenF1ISn41EdfCFlUjQOtSEGKoOvCsOe n2tQ== X-Gm-Message-State: AO0yUKVohQ7kfL+fZsiwDspIkKjR9tEf9Y9eTn70QFg15Asnzy0xLnKW 4rmp3CsIpTMz7WgOLWl4tDFfEQQ54s78kM6DiAs= X-Google-Smtp-Source: AK7set92sAGYn7Zd3jvZS9HMG+JjhulTFGekEDvMpUBj5iBbDJZjw5cwvotx9plmf+nGHjTpjt0+1mPnUpuuGNEBcS4= X-Received: by 2002:ab0:26ca:0:b0:68a:6270:3453 with SMTP id b10-20020ab026ca000000b0068a62703453mr626259uap.8.1676264906311; Sun, 12 Feb 2023 21:08:26 -0800 (PST) MIME-Version: 1.0 References: <20230210134646.3407253-1-s.v.naga.harish.k@intel.com> <20230210173744.3597666-1-s.v.naga.harish.k@intel.com> <20230210173744.3597666-3-s.v.naga.harish.k@intel.com> In-Reply-To: <20230210173744.3597666-3-s.v.naga.harish.k@intel.com> From: Jerin Jacob Date: Mon, 13 Feb 2023 10:38:00 +0530 Message-ID: Subject: Re: [PATCH v6 3/3] eventdev/crypto: add params set/get APIs To: Naga Harish K S V Cc: jerinj@marvell.com, erik.g.carrillo@intel.com, abhinandan.gujjar@intel.com, dev@dpdk.org, jay.jayatheerthan@intel.com Content-Type: text/plain; charset="UTF-8" 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 On Fri, Feb 10, 2023 at 11:08 PM Naga Harish K S V wrote: > > The adapter runtime configuration parameters defined in the > struct rte_event_crypto_adapter_runtime_params can be configured > and retrieved using rte_event_crypto_adapter_runtime_params_set() > and rte_event_eth_rx_adapter_runtime_params_get() respectively. Typo: rte_event_crypto_adapter_runtime_params_get() Series-Acked-by: Jerin Jacob Updated the git commit as follows and series applied to dpdk-next-net-eventdev/for-main. Thanks commit 44fe1187305af8ac6d31c46113c1ca35405de77b (HEAD -> for-main, origin/for-main, origin/HEAD) Author: Naga Harish K S V Date: Fri Feb 10 11:37:44 2023 -0600 eventdev/crypto: support runtime set/get parameters The adapter runtime configuration parameters defined in the struct rte_event_crypto_adapter_runtime_params can be configured and retrieved using rte_event_crypto_adapter_runtime_params_set() and rte_event_crypto_adapter_runtime_params_get() respectively. Signed-off-by: Naga Harish K S V Acked-by: Jerin Jacob commit 122812d1586437a6a09da132c23b6b6b41e90bef Author: Naga Harish K S V Date: Fri Feb 10 11:37:43 2023 -0600 eventdev/eth_tx: support runtime set/get parameters The adapter runtime configuration parameters defined in the struct rte_event_eth_tx_adapter_runtime_params can be configured and retrieved using rte_event_eth_tx_adapter_runtime_params_set() and rte_event_eth_tx_adapter_runtime_params_get() respectively. Signed-off-by: Naga Harish K S V Acked-by: Jerin Jacob commit 496f7d5567ecb3c480ede0a90a3b4e987f6c7359 Author: Naga Harish K S V Date: Fri Feb 10 11:37:42 2023 -0600 eventdev/eth_rx: support runtime set/get parameters The adapter runtime configuration parameters defined in the struct rte_event_eth_rx_adapter_runtime_params can be configured and retrieved using rte_event_eth_rx_adapter_runtime_params_set() and rte_event_eth_rx_adapter_runtime_params_get() respectively. Signed-off-by: Naga Harish K S V Acked-by: Jerin Jacob > > Signed-off-by: Naga Harish K S V > --- > v6: > * updated doxygen comments as per review comments > --- > --- > app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++ > .../prog_guide/event_crypto_adapter.rst | 8 ++ > lib/eventdev/rte_event_crypto_adapter.c | 101 ++++++++++++++++ > lib/eventdev/rte_event_crypto_adapter.h | 85 ++++++++++++++ > lib/eventdev/version.map | 3 + > 5 files changed, 306 insertions(+) > > diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c > index a38e389abd..264d6f731e 100644 > --- a/app/test/test_event_crypto_adapter.c > +++ b/app/test/test_event_crypto_adapter.c > @@ -272,6 +272,111 @@ test_crypto_adapter_stats(void) > return TEST_SUCCESS; > } > > +static int > +test_crypto_adapter_params(void) > +{ > + int err; > + struct rte_event_crypto_adapter_runtime_params in_params; > + struct rte_event_crypto_adapter_runtime_params out_params; > + uint32_t cap; > + struct rte_event_crypto_adapter_queue_conf queue_conf = { > + .ev = response_info, > + }; > + > + err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap); > + TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n"); > + > + if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) { > + err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID, > + TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf); > + } else > + err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID, > + TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL); > + > + TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n"); > + > + err = rte_event_crypto_adapter_runtime_params_init(&in_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + err = rte_event_crypto_adapter_runtime_params_init(&out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + /* Case 1: Get the default value of mbufs processed by adapter */ > + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, > + &out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */ > + in_params.max_nb = 32; > + > + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, > + &in_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, > + &out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u", > + in_params.max_nb, out_params.max_nb); > + > + /* Case 3: Set max_nb = 192 */ > + in_params.max_nb = 192; > + > + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, > + &in_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, > + &out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u", > + in_params.max_nb, out_params.max_nb); > + > + /* Case 4: Set max_nb = 256 */ > + in_params.max_nb = 256; > + > + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, > + &in_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, > + &out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u", > + in_params.max_nb, out_params.max_nb); > + > + /* Case 5: Set max_nb = 30( + in_params.max_nb = 30; > + > + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, > + &in_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, > + &out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u", > + in_params.max_nb, out_params.max_nb); > + > + /* Case 6: Set max_nb = 512 */ > + in_params.max_nb = 512; > + > + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, > + &in_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + > + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, > + &out_params); > + TEST_ASSERT(err == 0, "Expected 0 got %d", err); > + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u", > + in_params.max_nb, out_params.max_nb); > + > + err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID, > + TEST_CDEV_ID, TEST_CDEV_QP_ID); > + TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n"); > + > + return TEST_SUCCESS; > +} > + > static int > test_op_forward_mode(uint8_t session_less) > { > @@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = { > test_crypto_adapter_free, > test_crypto_adapter_stats), > > + TEST_CASE_ST(test_crypto_adapter_create, > + test_crypto_adapter_free, > + test_crypto_adapter_params), > + > TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode, > test_crypto_adapter_stop, > test_session_with_op_forward_mode), > diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst > index 46b3dc2f1c..1b6d4a0966 100644 > --- a/doc/guides/prog_guide/event_crypto_adapter.rst > +++ b/doc/guides/prog_guide/event_crypto_adapter.rst > @@ -350,3 +350,11 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and > enqueued event counts are a sum of the counts from the eventdev PMD callbacks > if the callback is supported, and the counts maintained by the service function, > if one exists. > + > +Set/Get adapter runtime configuration parameters > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +The runtime configuration parameters of adapter can be set/get using > +``rte_event_crypto_adapter_runtime_params_set()`` and > +``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that > +can be set/get are defined in ``struct rte_event_crypto_adapter_runtime_params``. > diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c > index 7f0a25a4cc..f6c1e5380d 100644 > --- a/lib/eventdev/rte_event_crypto_adapter.c > +++ b/lib/eventdev/rte_event_crypto_adapter.c > @@ -1335,6 +1335,107 @@ rte_event_crypto_adapter_stats_reset(uint8_t id) > return 0; > } > > +int > +rte_event_crypto_adapter_runtime_params_init( > + struct rte_event_crypto_adapter_runtime_params *params) > +{ > + if (params == NULL) > + return -EINVAL; > + > + memset(params, 0, sizeof(*params)); > + params->max_nb = DEFAULT_MAX_NB; > + > + return 0; > +} > + > +static int > +crypto_adapter_cap_check(struct event_crypto_adapter *adapter) > +{ > + int ret; > + uint32_t caps; > + > + if (!adapter->nb_qps) > + return -EINVAL; > + ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id, > + adapter->next_cdev_id, > + &caps); > + if (ret) { > + RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8 > + " cdev %" PRIu8, adapter->eventdev_id, > + adapter->next_cdev_id); > + return ret; > + } > + > + if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) || > + (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) > + return -ENOTSUP; > + > + return 0; > +} > + > +int > +rte_event_crypto_adapter_runtime_params_set(uint8_t id, > + struct rte_event_crypto_adapter_runtime_params *params) > +{ > + struct event_crypto_adapter *adapter; > + int ret; > + > + if (eca_memzone_lookup()) > + return -ENOMEM; > + > + EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > + > + if (params == NULL) { > + RTE_EDEV_LOG_ERR("params pointer is NULL\n"); > + return -EINVAL; > + } > + > + adapter = eca_id_to_adapter(id); > + if (adapter == NULL) > + return -EINVAL; > + > + ret = crypto_adapter_cap_check(adapter); > + if (ret) > + return ret; > + > + rte_spinlock_lock(&adapter->lock); > + adapter->max_nb = params->max_nb; > + rte_spinlock_unlock(&adapter->lock); > + > + return 0; > +} > + > +int > +rte_event_crypto_adapter_runtime_params_get(uint8_t id, > + struct rte_event_crypto_adapter_runtime_params *params) > +{ > + struct event_crypto_adapter *adapter; > + int ret; > + > + if (eca_memzone_lookup()) > + return -ENOMEM; > + > + > + EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > + > + if (params == NULL) { > + RTE_EDEV_LOG_ERR("params pointer is NULL\n"); > + return -EINVAL; > + } > + > + adapter = eca_id_to_adapter(id); > + if (adapter == NULL) > + return -EINVAL; > + > + ret = crypto_adapter_cap_check(adapter); > + if (ret) > + return ret; > + > + params->max_nb = adapter->max_nb; > + > + return 0; > +} > + > int > rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id) > { > diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h > index fad4543506..4e1f1bb3a8 100644 > --- a/lib/eventdev/rte_event_crypto_adapter.h > +++ b/lib/eventdev/rte_event_crypto_adapter.h > @@ -138,6 +138,9 @@ > * - rte_event_crypto_adapter_stop() > * - rte_event_crypto_adapter_stats_get() > * - rte_event_crypto_adapter_stats_reset() > + * - rte_event_crypto_adapter_runtime_params_get() > + * - rte_event_crypto_adapter_runtime_params_init() > + * - rte_event_crypto_adapter_runtime_params_set() > > * The application creates an instance using rte_event_crypto_adapter_create() > * or rte_event_crypto_adapter_create_ext(). > @@ -253,6 +256,31 @@ struct rte_event_crypto_adapter_conf { > */ > }; > > +/** > + * Adapter runtime configuration parameters > + */ > +struct rte_event_crypto_adapter_runtime_params { > + uint32_t max_nb; > + /**< The adapter can return early if it has processed at least > + * max_nb crypto ops. This isn't treated as a requirement; batching > + * may cause the adapter to process more than max_nb crypto ops. > + * > + * rte_event_crypto_adapter_create() configures the > + * adapter with default value of max_nb. > + * rte_event_crypto_adapter_create_ext() configures the adapter with > + * user provided value of max_nb through > + * rte_event_crypto_adapter_conf::max_nb parameter. > + * rte_event_cryptoadapter_runtime_params_set() allows to re-configure > + * max_nb during runtime (after adding at least one queue pair) > + * > + * This is valid for the devices without > + * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD or > + * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW capability. > + */ > + uint32_t rsvd[15]; > + /**< Reserved fields for future expansion */ > +}; > + > #define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1 > /**< This flag indicates that crypto operations processed on the crypto > * adapter need to be vectorized > @@ -608,6 +636,63 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id); > int > rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id); > > +/** > + * Initialize the adapter runtime configuration parameters > + * > + * @param params > + * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_crypto_adapter_runtime_params_init( > + struct rte_event_crypto_adapter_runtime_params *params); > + > +/** > + * Set the adapter runtime configuration parameters > + * > + * @param id > + * Adapter identifier > + * > + * @param params > + * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params > + * with configuration parameter values. The reserved fields of this structure > + * must be initialized to zero and the valid fields need to be set appropriately. > + * This struct can be initialized using > + * rte_event_crypto_adapter_runtime_params_init() API to default values or > + * application may reset this struct and update required fields. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_crypto_adapter_runtime_params_set(uint8_t id, > + struct rte_event_crypto_adapter_runtime_params *params); > + > +/** > + * Get the adapter runtime configuration parameters > + * > + * @param id > + * Adapter identifier > + * > + * @param[out] params > + * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params > + * containing valid adapter parameters when return value is 0. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_crypto_adapter_runtime_params_get(uint8_t id, > + struct rte_event_crypto_adapter_runtime_params *params); > + > /** > * @warning > * @b EXPERIMENTAL: this API may change without prior notice > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map > index 7b93736dff..3b17c84eae 100644 > --- a/lib/eventdev/version.map > +++ b/lib/eventdev/version.map > @@ -121,6 +121,9 @@ EXPERIMENTAL { > rte_event_eth_tx_adapter_queue_stop; > > # added in 23.03 > + rte_event_crypto_adapter_runtime_params_get; > + rte_event_crypto_adapter_runtime_params_init; > + rte_event_crypto_adapter_runtime_params_set; > rte_event_eth_rx_adapter_runtime_params_get; > rte_event_eth_rx_adapter_runtime_params_init; > rte_event_eth_rx_adapter_runtime_params_set; > -- > 2.25.1 >