From: Vipin Varghese <vipin.varghese@intel.com>
To: keith.wiles@intel.com, dev@dpdk.org,
pablo.de.lara.guarch@intel.com, akhil.goyal@nxp.com,
declan.doherty@intel.com
Cc: sanjay.padubidri@intel.com, Vipin Varghese <vipin.varghese@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/2] examples/l2fwd-crypto: add callback handlers
Date: Mon, 10 Jun 2019 12:00:26 +0530 [thread overview]
Message-ID: <20190610063026.89020-2-vipin.varghese@intel.com> (raw)
In-Reply-To: <20190610063026.89020-1-vipin.varghese@intel.com>
Register user callback handlers for pre-enqueue and pst-dequeue
for crypto device instance 0 with port 0.
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
examples/l2fwd-crypto/main.c | 38 ++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index e282cb7bf..c42b352f8 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -255,6 +255,22 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS];
/* default period is 10 seconds */
static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000;
+#ifdef RTE_CRYPTODEV_ENQDEQ_CALLBACKS
+static uint16_t dump_crypto(__rte_unused uint8_t dev_id,
+ __rte_unused uint8_t qp_id,
+ __rte_unused struct rte_crypto_op **ops,
+ __rte_unused uint16_t nb_ops,
+ __rte_unused void *cb_arg)
+{
+ if (nb_ops)
+ RTE_LOG(DEBUG, L2FWD, " dev_id (%u) qp_id (%u)"
+ " ops (%p) nb_ops (%u)\n",
+ dev_id, qp_id, ops, nb_ops);
+
+ return nb_ops;
+}
+#endif
+
/* Print out statistics on packets dropped */
static void
print_stats(void)
@@ -2783,6 +2799,18 @@ main(int argc, char **argv)
(unsigned)cdev_id);
}
+#ifdef RTE_CRYPTODEV_ENQDEQ_CALLBACKS
+ ret = rte_cryptodev_preenq_callback_register(0, 0, dump_crypto, NULL);
+ if (ret != 0)
+ RTE_LOG(ERR, L2FWD, " failed to preenq callback register\n");
+ RTE_LOG(INFO, L2FWD, " preenq callback register success\n");
+
+ ret = rte_cryptodev_pstdeq_callback_register(0, 0, dump_crypto, NULL);
+ if (ret != 0)
+ RTE_LOG(ERR, L2FWD, " failed to pstdeq callback register\n");
+ RTE_LOG(INFO, L2FWD, " pstdeq callback register success\n");
+#endif
+
/* launch per-lcore init on every lcore */
rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, (void *)&options,
CALL_MASTER);
@@ -2791,5 +2819,15 @@ main(int argc, char **argv)
return -1;
}
+#ifdef RTE_CRYPTODEV_ENQDEQ_CALLBACKS
+ ret = rte_cryptodev_preenq_callback_unregister(0, 0, dump_crypto, NULL);
+ if (ret != 0)
+ printf(" faield rte_cryptodev_preenq_callback_unregister\n");
+
+ ret = rte_cryptodev_pstdeq_callback_unregister(0, 0, dump_crypto, NULL);
+ if (ret != 0)
+ printf(" failed rte_cryptodev_pstdeq_callback_unregister\n");
+#endif
+
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2019-06-10 6:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 5:03 [dpdk-dev] [PATCH v1 1/2] lib/crypto: add callback handlers for crypto Vipin Varghese
2019-06-10 5:03 ` [dpdk-dev] [PATCH v1 2/2] examples/l2fwd-crypto: add callback handlers Vipin Varghese
2019-06-10 6:30 ` [dpdk-dev] [PATCH v2 1/2] lib/crypto: add callback handlers for crypto Vipin Varghese
2019-06-10 6:30 ` Vipin Varghese [this message]
2019-06-21 7:06 ` [dpdk-dev] [PATCH v2 2/2] examples/l2fwd-crypto: add callback handlers Ruifeng Wang (Arm Technology China)
2019-07-04 5:03 ` Varghese, Vipin
2019-06-27 14:25 ` [dpdk-dev] [PATCH v2 1/2] lib/crypto: add callback handlers for crypto Akhil Goyal
2019-07-04 5:03 ` Varghese, Vipin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190610063026.89020-2-vipin.varghese@intel.com \
--to=vipin.varghese@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
--cc=pablo.de.lara.guarch@intel.com \
--cc=sanjay.padubidri@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).