From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E47B2A05DC for ; Mon, 10 Jun 2019 07:03:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D3851BDE8; Mon, 10 Jun 2019 07:03:22 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 1606A1BDE4 for ; Mon, 10 Jun 2019 07:03:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jun 2019 22:03:20 -0700 X-ExtLoop1: 1 Received: from unknown (HELO saesrv02-S2600CWR.intel.com) ([10.224.122.203]) by orsmga001.jf.intel.com with ESMTP; 09 Jun 2019 22:03:18 -0700 From: Vipin Varghese 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 Date: Mon, 10 Jun 2019 10:33:52 +0530 Message-Id: <20190610050352.83349-2-vipin.varghese@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610050352.83349-1-vipin.varghese@intel.com> References: <20190610050352.83349-1-vipin.varghese@intel.com> Subject: [dpdk-dev] [PATCH v1 2/2] examples/l2fwd-crypto: add callback handlers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Register user callback handlers for pre-enqueue and pst-dequeue for crypto device instance 0 with port 0. Signed-off-by: Vipin Varghese --- examples/l2fwd-crypto/main.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index e282cb7bf..db2ac2624 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -255,6 +255,20 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; /* default period is 10 seconds */ static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; +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; +} + /* Print out statistics on packets dropped */ static void print_stats(void) @@ -2783,6 +2797,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 +2817,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