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 64AD4454E9 for ; Tue, 25 Jun 2024 02:03:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6087142799; Tue, 25 Jun 2024 02:03:25 +0200 (CEST) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id BFDF440EDD for ; Tue, 25 Jun 2024 02:03:23 +0200 (CEST) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-366e70d0330so1702583f8f.1 for ; Mon, 24 Jun 2024 17:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273803; x=1719878603; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ONXCPNnHMXpvh2iAmoTcPzrclx7MeSR0dQTKa74vCOg=; b=GtEiYFAYaTtlKBzt4hOgxQGqRG/+vrAk4xcXXrDeW2sujZB3XQfl6KT7ec9Z9sXGrR wAPs0nsl9eEoNd4hioCWaRcaAJP8M0myn7+wNl+IawJnc5hfWL4jsGUp8L6zojpbC6qk HOUTBLSr8pf+vo04b+HSWbJswTHxc3zzy+hdO8zfFZTd8x1rNPZyQrI8IgJeIxym+6Vq hIdXsRbdQgRg8O5kscJ8Mpz+hDV0xCSiNF/nf3C3GBT9nWBmrAMfaHfRMWznctr4dAWW SmiFnoldJR7qYfMAQeahrU3D7w3bZM5VQzz91zPS12kmd9fMdtQUu0c/CvtXJ+IQ9FkA 20vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273803; x=1719878603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ONXCPNnHMXpvh2iAmoTcPzrclx7MeSR0dQTKa74vCOg=; b=rQjbD+lh0MsI84hfLt7Ji/Obcfg6MtI9Bd4xsQFzMuGkcM5BV/q9mFF/m8lfZqUTHV znMu+16Uh0Rhi4Rh4GUvIxfU3yXoaI/tdQeliWzCNqE2itz7FzelMIj+RIAqNT2vSpLc MBkYxMBV6j4AbubcyqasJJxQOqMULctdT7HRxqlLiwgwS2bB5Y7fOmQAifhMPMvvbriB UYPA5DRTHV5WawQHjBMZibvABVaHBcUVL1MkENhFCjhtEsAWQ1GFsPPq0zIA3ZWAKfGR Kl6A5y3/GUKForuduziUW/UgJYzr+NclVzTArTxsHJKT1h+SNALpikd7XC9gUC8jJpZN R8FQ== X-Forwarded-Encrypted: i=1; AJvYcCWfY/gWzvv2dz6UKNjn6qZHKFeJNZ530utWhah91zW4ULIQzJAxDCS1LyvGyHzHkQ846NuL9C0uJ3B1RkecBwg= X-Gm-Message-State: AOJu0Yz6dJkjoLMlRAbBCCEvdEKDW8ybxO1I5axGCOt7mSpb2r62AV2Y 7Hz1pflc8X2RJBFelwIU0Th6Iq2rsHYdb6UG+IgnXKV1gah4WiS0 X-Google-Smtp-Source: AGHT+IHMykLKKgbECW3VTcyfUVsXKr96y4EqPNBkLL4UWH9bEygUBm4iIB5YvSFXQ/P2gN0Z8TO48g== X-Received: by 2002:a05:6000:178c:b0:366:e9f2:a551 with SMTP id ffacd0b85a97d-366e9f2a667mr4817891f8f.43.1719273803222; Mon, 24 Jun 2024 17:03:23 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-366f973b7e5sm2550585f8f.14.2024.06.24.17.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:03:22 -0700 (PDT) From: luca.boccassi@gmail.com To: Akhil Goyal Cc: Ganapati Kundapura , dpdk stable Subject: patch 'test/crypto: fix enqueue/dequeue callback case' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:59:04 +0100 Message-Id: <20240624235907.885628-78-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/5cbc25e40f540b3518433c420f947ce3842a8cfe Thanks. Luca Boccassi --- >From 5cbc25e40f540b3518433c420f947ce3842a8cfe Mon Sep 17 00:00:00 2001 From: Akhil Goyal Date: Fri, 24 May 2024 22:43:27 +0530 Subject: [PATCH] test/crypto: fix enqueue/dequeue callback case [ upstream commit 4ad17a1c8fb336a182f2c1b62127d8871d45f804 ] The enqueue/dequeue callback test cases were using the test_null_burst_operation() for doing enqueue/dequeue. But this function is only designed to be run for NULL PMD. Hence for other PMDs, the callback was not getting called. Now, separate processing thread is removed, instead NULL crypto operation is created and processed so that callbacks are called. Also added a check on a global static variable to verify that the callback is actually called and fail the case if it is not getting called. Fixes: 5523a75af539 ("test/crypto: add case for enqueue/dequeue callbacks") Signed-off-by: Akhil Goyal Acked-by: Ganapati Kundapura --- app/test/test_cryptodev.c | 106 ++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 17 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index b75edb2f2b..96cd9ef7dc 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -194,6 +194,8 @@ post_process_raw_dp_op(void *user_data, uint32_t index __rte_unused, static struct crypto_testsuite_params testsuite_params = { NULL }; struct crypto_testsuite_params *p_testsuite_params = &testsuite_params; static struct crypto_unittest_params unittest_params; +static bool enq_cb_called; +static bool deq_cb_called; void process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id, @@ -12607,6 +12609,7 @@ test_enq_callback(uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, RTE_SET_USED(ops); RTE_SET_USED(user_param); + enq_cb_called = true; printf("crypto enqueue callback called\n"); return nb_ops; } @@ -12620,21 +12623,58 @@ test_deq_callback(uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, RTE_SET_USED(ops); RTE_SET_USED(user_param); + deq_cb_called = true; printf("crypto dequeue callback called\n"); return nb_ops; } /* - * Thread using enqueue/dequeue callback with RCU. + * Process enqueue/dequeue NULL crypto request to verify callback with RCU. */ static int -test_enqdeq_callback_thread(void *arg) +test_enqdeq_callback_null_cipher(void) { - RTE_SET_USED(arg); - /* DP thread calls rte_cryptodev_enqueue_burst()/ - * rte_cryptodev_dequeue_burst() and invokes callback. - */ - test_null_burst_operation(); + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + + /* Setup Cipher Parameters */ + ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; + + /* Setup Auth Parameters */ + ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL; + ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; + + /* Create Crypto session */ + ut_params->sess = rte_cryptodev_sym_session_create(ts_params->valid_devs[0], + &ut_params->auth_xform, ts_params->session_mpool); + TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); + + ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC); + TEST_ASSERT_NOT_NULL(ut_params->op, "Failed to allocate symmetric crypto op"); + + /* Allocate mbuf */ + ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); + TEST_ASSERT_NOT_NULL(ut_params->ibuf, "Failed to allocate mbuf"); + + /* Append some random data */ + TEST_ASSERT_NOT_NULL(rte_pktmbuf_append(ut_params->ibuf, sizeof(unsigned int)), + "no room to append data"); + + rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); + + ut_params->op->sym->m_src = ut_params->ibuf; + + /* Process crypto operation */ + TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], ut_params->op), + "failed to process sym crypto op"); + return 0; } @@ -12642,6 +12682,7 @@ static int test_enq_callback_setup(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_sym_capability_idx cap_idx; struct rte_cryptodev_info dev_info; struct rte_cryptodev_qp_conf qp_conf = { .nb_descriptors = MAX_NUM_OPS_INFLIGHT @@ -12649,6 +12690,19 @@ test_enq_callback_setup(void) struct rte_cryptodev_cb *cb; uint16_t qp_id = 0; + int j = 0; + + /* Verify the crypto capabilities for which enqueue/dequeue is done. */ + cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; + cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL; + if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], + &cap_idx) == NULL) + return TEST_SKIPPED; + cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; + cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL; + if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], + &cap_idx) == NULL) + return TEST_SKIPPED; /* Stop the device in case it's started so it can be configured */ rte_cryptodev_stop(ts_params->valid_devs[0]); @@ -12672,6 +12726,7 @@ test_enq_callback_setup(void) qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + enq_cb_called = false; /* Test with invalid crypto device */ cb = rte_cryptodev_add_enq_callback(RTE_CRYPTO_MAX_DEVS, qp_id, test_enq_callback, NULL); @@ -12704,12 +12759,11 @@ test_enq_callback_setup(void) rte_cryptodev_start(ts_params->valid_devs[0]); - /* Launch a thread */ - rte_eal_remote_launch(test_enqdeq_callback_thread, NULL, - rte_get_next_lcore(-1, 1, 0)); + TEST_ASSERT_SUCCESS(test_enqdeq_callback_null_cipher(), "Crypto Processing failed"); - /* Wait until reader exited. */ - rte_eal_mp_wait_lcore(); + /* Wait until callback not called. */ + while (!enq_cb_called && (j++ < 10)) + rte_delay_ms(10); /* Test with invalid crypto device */ TEST_ASSERT_FAIL(rte_cryptodev_remove_enq_callback( @@ -12734,6 +12788,8 @@ test_enq_callback_setup(void) "qp %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); + TEST_ASSERT(enq_cb_called == true, "Crypto enqueue callback not called"); + return TEST_SUCCESS; } @@ -12741,6 +12797,7 @@ static int test_deq_callback_setup(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_sym_capability_idx cap_idx; struct rte_cryptodev_info dev_info; struct rte_cryptodev_qp_conf qp_conf = { .nb_descriptors = MAX_NUM_OPS_INFLIGHT @@ -12748,6 +12805,19 @@ test_deq_callback_setup(void) struct rte_cryptodev_cb *cb; uint16_t qp_id = 0; + int j = 0; + + /* Verify the crypto capabilities for which enqueue/dequeue is done. */ + cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; + cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL; + if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], + &cap_idx) == NULL) + return TEST_SKIPPED; + cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; + cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL; + if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], + &cap_idx) == NULL) + return TEST_SKIPPED; /* Stop the device in case it's started so it can be configured */ rte_cryptodev_stop(ts_params->valid_devs[0]); @@ -12771,6 +12841,7 @@ test_deq_callback_setup(void) qp_conf.nb_descriptors, qp_id, ts_params->valid_devs[0]); + deq_cb_called = false; /* Test with invalid crypto device */ cb = rte_cryptodev_add_deq_callback(RTE_CRYPTO_MAX_DEVS, qp_id, test_deq_callback, NULL); @@ -12803,12 +12874,11 @@ test_deq_callback_setup(void) rte_cryptodev_start(ts_params->valid_devs[0]); - /* Launch a thread */ - rte_eal_remote_launch(test_enqdeq_callback_thread, NULL, - rte_get_next_lcore(-1, 1, 0)); + TEST_ASSERT_SUCCESS(test_enqdeq_callback_null_cipher(), "Crypto processing failed"); - /* Wait until reader exited. */ - rte_eal_mp_wait_lcore(); + /* Wait until callback not called. */ + while (!deq_cb_called && (j++ < 10)) + rte_delay_ms(10); /* Test with invalid crypto device */ TEST_ASSERT_FAIL(rte_cryptodev_remove_deq_callback( @@ -12833,6 +12903,8 @@ test_deq_callback_setup(void) "qp %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); + TEST_ASSERT(deq_cb_called == true, "Crypto dequeue callback not called"); + return TEST_SUCCESS; } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:17.527652919 +0100 +++ 0078-test-crypto-fix-enqueue-dequeue-callback-case.patch 2024-06-25 00:22:13.309188176 +0100 @@ -1 +1 @@ -From 4ad17a1c8fb336a182f2c1b62127d8871d45f804 Mon Sep 17 00:00:00 2001 +From 5cbc25e40f540b3518433c420f947ce3842a8cfe Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4ad17a1c8fb336a182f2c1b62127d8871d45f804 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index f2d249f6b8..94438c587a 100644 +index b75edb2f2b..96cd9ef7dc 100644 @@ -29 +30 @@ -@@ -199,6 +199,8 @@ post_process_raw_dp_op(void *user_data, uint32_t index __rte_unused, +@@ -194,6 +194,8 @@ post_process_raw_dp_op(void *user_data, uint32_t index __rte_unused, @@ -36 +37 @@ - int + void @@ -38 +39 @@ -@@ -14671,6 +14673,7 @@ test_enq_callback(uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, +@@ -12607,6 +12609,7 @@ test_enq_callback(uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, @@ -46 +47 @@ -@@ -14684,21 +14687,58 @@ test_deq_callback(uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, +@@ -12620,21 +12623,58 @@ test_deq_callback(uint16_t dev_id, uint16_t qp_id, struct rte_crypto_op **ops, @@ -112 +113 @@ -@@ -14706,6 +14746,7 @@ static int +@@ -12642,6 +12682,7 @@ static int @@ -120 +121 @@ -@@ -14713,6 +14754,19 @@ test_enq_callback_setup(void) +@@ -12649,6 +12690,19 @@ test_enq_callback_setup(void) @@ -140 +141 @@ -@@ -14736,6 +14790,7 @@ test_enq_callback_setup(void) +@@ -12672,6 +12726,7 @@ test_enq_callback_setup(void) @@ -148 +149 @@ -@@ -14768,12 +14823,11 @@ test_enq_callback_setup(void) +@@ -12704,12 +12759,11 @@ test_enq_callback_setup(void) @@ -165 +166 @@ -@@ -14798,6 +14852,8 @@ test_enq_callback_setup(void) +@@ -12734,6 +12788,8 @@ test_enq_callback_setup(void) @@ -174 +175 @@ -@@ -14805,6 +14861,7 @@ static int +@@ -12741,6 +12797,7 @@ static int @@ -182 +183 @@ -@@ -14812,6 +14869,19 @@ test_deq_callback_setup(void) +@@ -12748,6 +12805,19 @@ test_deq_callback_setup(void) @@ -202 +203 @@ -@@ -14835,6 +14905,7 @@ test_deq_callback_setup(void) +@@ -12771,6 +12841,7 @@ test_deq_callback_setup(void) @@ -210 +211 @@ -@@ -14867,12 +14938,11 @@ test_deq_callback_setup(void) +@@ -12803,12 +12874,11 @@ test_deq_callback_setup(void) @@ -227 +228 @@ -@@ -14897,6 +14967,8 @@ test_deq_callback_setup(void) +@@ -12833,6 +12903,8 @@ test_deq_callback_setup(void)