[v4,1/2] cryptodev: fix crypto callbacks on unsetting callbacks macro
Checks
Commit Message
Crypto callbacks APIs are available in header files but when
the macro RTE_CRYPTO_CALLBACKS unset, test application need to
put #ifdef in its code.
The test application should be able to build and run, regardless
DPDK library is built with RTE_CRYPTO_CALLBACKS defined or not.
Added ENOTSUP from the beginning of the APIs implementation
if RTE_CRYPTO_CALLBACKS macro is unset/undefined.
Fixes: 1c3ffb95595e ("cryptodev: add enqueue and dequeue callbacks")
Fixes: 5523a75af539 ("test/crypto: add case for enqueue/dequeue callbacks")
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v4:
* replaced ifdef with ifndef in APIs implementation
* Removed TEST_SKIP macro
* checked for ENOTSUP for first usage only
v3:
* Added NOTSUP from the beginning of the APIs
Comments
> Crypto callbacks APIs are available in header files but when
> the macro RTE_CRYPTO_CALLBACKS unset, test application need to
> put #ifdef in its code.
>
> The test application should be able to build and run, regardless
> DPDK library is built with RTE_CRYPTO_CALLBACKS defined or not.
>
> Added ENOTSUP from the beginning of the APIs implementation
> if RTE_CRYPTO_CALLBACKS macro is unset/undefined.
>
> Fixes: 1c3ffb95595e ("cryptodev: add enqueue and dequeue callbacks")
> Fixes: 5523a75af539 ("test/crypto: add case for enqueue/dequeue callbacks")
Cc: stable@dpdk.org
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Applied to dpdk-next-crypto
@@ -14794,6 +14794,12 @@ test_enq_callback_setup(void)
/* Test with invalid crypto device */
cb = rte_cryptodev_add_enq_callback(RTE_CRYPTO_MAX_DEVS,
qp_id, test_enq_callback, NULL);
+ if (rte_errno == ENOTSUP) {
+ RTE_LOG(ERR, USER1, "%s line %d: "
+ "rte_cryptodev_add_enq_callback() "
+ "Not supported, skipped\n", __func__, __LINE__);
+ return TEST_SKIPPED;
+ }
TEST_ASSERT_NULL(cb, "Add callback on qp %u on "
"cryptodev %u did not fail",
qp_id, RTE_CRYPTO_MAX_DEVS);
@@ -14909,6 +14915,12 @@ test_deq_callback_setup(void)
/* Test with invalid crypto device */
cb = rte_cryptodev_add_deq_callback(RTE_CRYPTO_MAX_DEVS,
qp_id, test_deq_callback, NULL);
+ if (rte_errno == ENOTSUP) {
+ RTE_LOG(ERR, USER1, "%s line %d: "
+ "rte_cryptodev_add_deq_callback() "
+ "Not supported, skipped\n", __func__, __LINE__);
+ return TEST_SKIPPED;
+ }
TEST_ASSERT_NULL(cb, "Add callback on qp %u on "
"cryptodev %u did not fail",
qp_id, RTE_CRYPTO_MAX_DEVS);
@@ -1491,6 +1491,10 @@ rte_cryptodev_add_enq_callback(uint8_t dev_id,
rte_cryptodev_callback_fn cb_fn,
void *cb_arg)
{
+#ifndef RTE_CRYPTO_CALLBACKS
+ rte_errno = ENOTSUP;
+ return NULL;
+#endif
struct rte_cryptodev *dev;
struct rte_cryptodev_cb_rcu *list;
struct rte_cryptodev_cb *cb, *tail;
@@ -1556,6 +1560,9 @@ rte_cryptodev_remove_enq_callback(uint8_t dev_id,
uint16_t qp_id,
struct rte_cryptodev_cb *cb)
{
+#ifndef RTE_CRYPTO_CALLBACKS
+ return -ENOTSUP;
+#endif
struct rte_cryptodev *dev;
RTE_ATOMIC(struct rte_cryptodev_cb *) *prev_cb;
struct rte_cryptodev_cb *curr_cb;
@@ -1630,6 +1637,10 @@ rte_cryptodev_add_deq_callback(uint8_t dev_id,
rte_cryptodev_callback_fn cb_fn,
void *cb_arg)
{
+#ifndef RTE_CRYPTO_CALLBACKS
+ rte_errno = ENOTSUP;
+ return NULL;
+#endif
struct rte_cryptodev *dev;
struct rte_cryptodev_cb_rcu *list;
struct rte_cryptodev_cb *cb, *tail;
@@ -1696,6 +1707,9 @@ rte_cryptodev_remove_deq_callback(uint8_t dev_id,
uint16_t qp_id,
struct rte_cryptodev_cb *cb)
{
+#ifndef RTE_CRYPTO_CALLBACKS
+ return -ENOTSUP;
+#endif
struct rte_cryptodev *dev;
RTE_ATOMIC(struct rte_cryptodev_cb *) *prev_cb;
struct rte_cryptodev_cb *curr_cb;