xref: /dpdk/drivers/crypto/null/null_crypto_pmd_ops.c (revision 26c2e4ad5ad4fd671576f6847e1cbb6e98c05682)
194b0ad8eSDeclan Doherty /*-
294b0ad8eSDeclan Doherty  *   BSD LICENSE
394b0ad8eSDeclan Doherty  *
494b0ad8eSDeclan Doherty  *   Copyright(c) 2016 Intel Corporation. All rights reserved.
594b0ad8eSDeclan Doherty  *
694b0ad8eSDeclan Doherty  *   Redistribution and use in source and binary forms, with or without
794b0ad8eSDeclan Doherty  *   modification, are permitted provided that the following conditions
894b0ad8eSDeclan Doherty  *   are met:
994b0ad8eSDeclan Doherty  *
1094b0ad8eSDeclan Doherty  *     * Redistributions of source code must retain the above copyright
1194b0ad8eSDeclan Doherty  *       notice, this list of conditions and the following disclaimer.
1294b0ad8eSDeclan Doherty  *     * Redistributions in binary form must reproduce the above copyright
1394b0ad8eSDeclan Doherty  *       notice, this list of conditions and the following disclaimer in
1494b0ad8eSDeclan Doherty  *       the documentation and/or other materials provided with the
1594b0ad8eSDeclan Doherty  *       distribution.
1694b0ad8eSDeclan Doherty  *     * Neither the name of Intel Corporation nor the names of its
1794b0ad8eSDeclan Doherty  *       contributors may be used to endorse or promote products derived
1894b0ad8eSDeclan Doherty  *       from this software without specific prior written permission.
1994b0ad8eSDeclan Doherty  *
2094b0ad8eSDeclan Doherty  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2194b0ad8eSDeclan Doherty  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2294b0ad8eSDeclan Doherty  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2394b0ad8eSDeclan Doherty  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2494b0ad8eSDeclan Doherty  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2594b0ad8eSDeclan Doherty  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2694b0ad8eSDeclan Doherty  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2794b0ad8eSDeclan Doherty  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2894b0ad8eSDeclan Doherty  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2994b0ad8eSDeclan Doherty  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3094b0ad8eSDeclan Doherty  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3194b0ad8eSDeclan Doherty  */
3294b0ad8eSDeclan Doherty 
3394b0ad8eSDeclan Doherty #include <string.h>
3494b0ad8eSDeclan Doherty 
3594b0ad8eSDeclan Doherty #include <rte_common.h>
3694b0ad8eSDeclan Doherty #include <rte_malloc.h>
3794b0ad8eSDeclan Doherty #include <rte_cryptodev_pmd.h>
3894b0ad8eSDeclan Doherty 
3994b0ad8eSDeclan Doherty #include "null_crypto_pmd_private.h"
4094b0ad8eSDeclan Doherty 
41*26c2e4adSDeclan Doherty static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {
42*26c2e4adSDeclan Doherty 	{	/* NULL (AUTH) */
43*26c2e4adSDeclan Doherty 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
44*26c2e4adSDeclan Doherty 		.sym = {
45*26c2e4adSDeclan Doherty 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
46*26c2e4adSDeclan Doherty 			.auth = {
47*26c2e4adSDeclan Doherty 				.algo = RTE_CRYPTO_AUTH_NULL,
48*26c2e4adSDeclan Doherty 				.block_size = 1,
49*26c2e4adSDeclan Doherty 				.key_size = {
50*26c2e4adSDeclan Doherty 					.min = 0,
51*26c2e4adSDeclan Doherty 					.max = 0,
52*26c2e4adSDeclan Doherty 					.increment = 0
53*26c2e4adSDeclan Doherty 				},
54*26c2e4adSDeclan Doherty 				.digest_size = {
55*26c2e4adSDeclan Doherty 					.min = 0,
56*26c2e4adSDeclan Doherty 					.max = 0,
57*26c2e4adSDeclan Doherty 					.increment = 0
58*26c2e4adSDeclan Doherty 				},
59*26c2e4adSDeclan Doherty 				.aad_size = { 0 }
60*26c2e4adSDeclan Doherty 			}
61*26c2e4adSDeclan Doherty 		}
62*26c2e4adSDeclan Doherty 	},
63*26c2e4adSDeclan Doherty 	{	/* NULL (CIPHER) */
64*26c2e4adSDeclan Doherty 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
65*26c2e4adSDeclan Doherty 		.sym = {
66*26c2e4adSDeclan Doherty 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
67*26c2e4adSDeclan Doherty 			.cipher = {
68*26c2e4adSDeclan Doherty 				.algo = RTE_CRYPTO_CIPHER_NULL,
69*26c2e4adSDeclan Doherty 				.block_size = 1,
70*26c2e4adSDeclan Doherty 				.key_size = {
71*26c2e4adSDeclan Doherty 					.min = 0,
72*26c2e4adSDeclan Doherty 					.max = 0,
73*26c2e4adSDeclan Doherty 					.increment = 8
74*26c2e4adSDeclan Doherty 				},
75*26c2e4adSDeclan Doherty 				.iv_size = {
76*26c2e4adSDeclan Doherty 					.min = 0,
77*26c2e4adSDeclan Doherty 					.max = 0,
78*26c2e4adSDeclan Doherty 					.increment = 0
79*26c2e4adSDeclan Doherty 				}
80*26c2e4adSDeclan Doherty 			}
81*26c2e4adSDeclan Doherty 		}
82*26c2e4adSDeclan Doherty 	},
83*26c2e4adSDeclan Doherty 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
84*26c2e4adSDeclan Doherty };
85*26c2e4adSDeclan Doherty 
8694b0ad8eSDeclan Doherty /** Configure device */
8794b0ad8eSDeclan Doherty static int
8894b0ad8eSDeclan Doherty null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev)
8994b0ad8eSDeclan Doherty {
9094b0ad8eSDeclan Doherty 	return 0;
9194b0ad8eSDeclan Doherty }
9294b0ad8eSDeclan Doherty 
9394b0ad8eSDeclan Doherty /** Start device */
9494b0ad8eSDeclan Doherty static int
9594b0ad8eSDeclan Doherty null_crypto_pmd_start(__rte_unused struct rte_cryptodev *dev)
9694b0ad8eSDeclan Doherty {
9794b0ad8eSDeclan Doherty 	return 0;
9894b0ad8eSDeclan Doherty }
9994b0ad8eSDeclan Doherty 
10094b0ad8eSDeclan Doherty /** Stop device */
10194b0ad8eSDeclan Doherty static void
10294b0ad8eSDeclan Doherty null_crypto_pmd_stop(__rte_unused struct rte_cryptodev *dev)
10394b0ad8eSDeclan Doherty {
10494b0ad8eSDeclan Doherty }
10594b0ad8eSDeclan Doherty 
10694b0ad8eSDeclan Doherty /** Close device */
10794b0ad8eSDeclan Doherty static int
10894b0ad8eSDeclan Doherty null_crypto_pmd_close(__rte_unused struct rte_cryptodev *dev)
10994b0ad8eSDeclan Doherty {
11094b0ad8eSDeclan Doherty 	return 0;
11194b0ad8eSDeclan Doherty }
11294b0ad8eSDeclan Doherty 
11394b0ad8eSDeclan Doherty /** Get device statistics */
11494b0ad8eSDeclan Doherty static void
11594b0ad8eSDeclan Doherty null_crypto_pmd_stats_get(struct rte_cryptodev *dev,
11694b0ad8eSDeclan Doherty 		struct rte_cryptodev_stats *stats)
11794b0ad8eSDeclan Doherty {
11894b0ad8eSDeclan Doherty 	int qp_id;
11994b0ad8eSDeclan Doherty 
12094b0ad8eSDeclan Doherty 	for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
12194b0ad8eSDeclan Doherty 		struct null_crypto_qp *qp = dev->data->queue_pairs[qp_id];
12294b0ad8eSDeclan Doherty 
12394b0ad8eSDeclan Doherty 		stats->enqueued_count += qp->qp_stats.enqueued_count;
12494b0ad8eSDeclan Doherty 		stats->dequeued_count += qp->qp_stats.dequeued_count;
12594b0ad8eSDeclan Doherty 
12694b0ad8eSDeclan Doherty 		stats->enqueue_err_count += qp->qp_stats.enqueue_err_count;
12794b0ad8eSDeclan Doherty 		stats->dequeue_err_count += qp->qp_stats.dequeue_err_count;
12894b0ad8eSDeclan Doherty 	}
12994b0ad8eSDeclan Doherty }
13094b0ad8eSDeclan Doherty 
13194b0ad8eSDeclan Doherty /** Reset device statistics */
13294b0ad8eSDeclan Doherty static void
13394b0ad8eSDeclan Doherty null_crypto_pmd_stats_reset(struct rte_cryptodev *dev)
13494b0ad8eSDeclan Doherty {
13594b0ad8eSDeclan Doherty 	int qp_id;
13694b0ad8eSDeclan Doherty 
13794b0ad8eSDeclan Doherty 	for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
13894b0ad8eSDeclan Doherty 		struct null_crypto_qp *qp = dev->data->queue_pairs[qp_id];
13994b0ad8eSDeclan Doherty 
14094b0ad8eSDeclan Doherty 		memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
14194b0ad8eSDeclan Doherty 	}
14294b0ad8eSDeclan Doherty }
14394b0ad8eSDeclan Doherty 
14494b0ad8eSDeclan Doherty 
14594b0ad8eSDeclan Doherty /** Get device info */
14694b0ad8eSDeclan Doherty static void
14794b0ad8eSDeclan Doherty null_crypto_pmd_info_get(struct rte_cryptodev *dev,
14894b0ad8eSDeclan Doherty 		struct rte_cryptodev_info *dev_info)
14994b0ad8eSDeclan Doherty {
15094b0ad8eSDeclan Doherty 	struct null_crypto_private *internals = dev->data->dev_private;
15194b0ad8eSDeclan Doherty 
15294b0ad8eSDeclan Doherty 	if (dev_info != NULL) {
15394b0ad8eSDeclan Doherty 		dev_info->dev_type = dev->dev_type;
15494b0ad8eSDeclan Doherty 		dev_info->max_nb_queue_pairs = internals->max_nb_qpairs;
15594b0ad8eSDeclan Doherty 		dev_info->sym.max_nb_sessions = internals->max_nb_sessions;
156*26c2e4adSDeclan Doherty 		dev_info->feature_flags = dev->feature_flags;
157*26c2e4adSDeclan Doherty 		dev_info->capabilities = null_crypto_pmd_capabilities;
15894b0ad8eSDeclan Doherty 	}
15994b0ad8eSDeclan Doherty }
16094b0ad8eSDeclan Doherty 
16194b0ad8eSDeclan Doherty /** Release queue pair */
16294b0ad8eSDeclan Doherty static int
16394b0ad8eSDeclan Doherty null_crypto_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
16494b0ad8eSDeclan Doherty {
16594b0ad8eSDeclan Doherty 	if (dev->data->queue_pairs[qp_id] != NULL) {
16694b0ad8eSDeclan Doherty 		rte_free(dev->data->queue_pairs[qp_id]);
16794b0ad8eSDeclan Doherty 		dev->data->queue_pairs[qp_id] = NULL;
16894b0ad8eSDeclan Doherty 	}
16994b0ad8eSDeclan Doherty 	return 0;
17094b0ad8eSDeclan Doherty }
17194b0ad8eSDeclan Doherty 
17294b0ad8eSDeclan Doherty /** set a unique name for the queue pair based on it's name, dev_id and qp_id */
17394b0ad8eSDeclan Doherty static int
17494b0ad8eSDeclan Doherty null_crypto_pmd_qp_set_unique_name(struct rte_cryptodev *dev,
17594b0ad8eSDeclan Doherty 		struct null_crypto_qp *qp)
17694b0ad8eSDeclan Doherty {
17794b0ad8eSDeclan Doherty 	unsigned n = snprintf(qp->name, sizeof(qp->name),
17894b0ad8eSDeclan Doherty 			"null_crypto_pmd_%u_qp_%u",
17994b0ad8eSDeclan Doherty 			dev->data->dev_id, qp->id);
18094b0ad8eSDeclan Doherty 
18194b0ad8eSDeclan Doherty 	if (n > sizeof(qp->name))
18294b0ad8eSDeclan Doherty 		return -1;
18394b0ad8eSDeclan Doherty 
18494b0ad8eSDeclan Doherty 	return 0;
18594b0ad8eSDeclan Doherty }
18694b0ad8eSDeclan Doherty 
18794b0ad8eSDeclan Doherty /** Create a ring to place process packets on */
18894b0ad8eSDeclan Doherty static struct rte_ring *
18994b0ad8eSDeclan Doherty null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp,
19094b0ad8eSDeclan Doherty 		unsigned ring_size, int socket_id)
19194b0ad8eSDeclan Doherty {
19294b0ad8eSDeclan Doherty 	struct rte_ring *r;
19394b0ad8eSDeclan Doherty 
19494b0ad8eSDeclan Doherty 	r = rte_ring_lookup(qp->name);
19594b0ad8eSDeclan Doherty 	if (r) {
19694b0ad8eSDeclan Doherty 		if (r->prod.size >= ring_size) {
19794b0ad8eSDeclan Doherty 			NULL_CRYPTO_LOG_INFO(
19894b0ad8eSDeclan Doherty 				"Reusing existing ring %s for processed packets",
19994b0ad8eSDeclan Doherty 				qp->name);
20094b0ad8eSDeclan Doherty 			return r;
20194b0ad8eSDeclan Doherty 		}
20294b0ad8eSDeclan Doherty 
20394b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_INFO(
20494b0ad8eSDeclan Doherty 			"Unable to reuse existing ring %s for processed packets",
20594b0ad8eSDeclan Doherty 			 qp->name);
20694b0ad8eSDeclan Doherty 		return NULL;
20794b0ad8eSDeclan Doherty 	}
20894b0ad8eSDeclan Doherty 
20994b0ad8eSDeclan Doherty 	return rte_ring_create(qp->name, ring_size, socket_id,
21094b0ad8eSDeclan Doherty 			RING_F_SP_ENQ | RING_F_SC_DEQ);
21194b0ad8eSDeclan Doherty }
21294b0ad8eSDeclan Doherty 
21394b0ad8eSDeclan Doherty /** Setup a queue pair */
21494b0ad8eSDeclan Doherty static int
21594b0ad8eSDeclan Doherty null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
21694b0ad8eSDeclan Doherty 		const struct rte_cryptodev_qp_conf *qp_conf,
21794b0ad8eSDeclan Doherty 		 int socket_id)
21894b0ad8eSDeclan Doherty {
21994b0ad8eSDeclan Doherty 	struct null_crypto_private *internals = dev->data->dev_private;
22094b0ad8eSDeclan Doherty 	struct null_crypto_qp *qp;
22194b0ad8eSDeclan Doherty 	int retval;
22294b0ad8eSDeclan Doherty 
22394b0ad8eSDeclan Doherty 	if (qp_id >= internals->max_nb_qpairs) {
22494b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_ERR("Invalid qp_id %u, greater than maximum "
22594b0ad8eSDeclan Doherty 				"number of queue pairs supported (%u).",
22694b0ad8eSDeclan Doherty 				qp_id, internals->max_nb_qpairs);
22794b0ad8eSDeclan Doherty 		return (-EINVAL);
22894b0ad8eSDeclan Doherty 	}
22994b0ad8eSDeclan Doherty 
23094b0ad8eSDeclan Doherty 	/* Free memory prior to re-allocation if needed. */
23194b0ad8eSDeclan Doherty 	if (dev->data->queue_pairs[qp_id] != NULL)
23294b0ad8eSDeclan Doherty 		null_crypto_pmd_qp_release(dev, qp_id);
23394b0ad8eSDeclan Doherty 
23494b0ad8eSDeclan Doherty 	/* Allocate the queue pair data structure. */
23594b0ad8eSDeclan Doherty 	qp = rte_zmalloc_socket("Null Crypto PMD Queue Pair", sizeof(*qp),
23694b0ad8eSDeclan Doherty 					RTE_CACHE_LINE_SIZE, socket_id);
23794b0ad8eSDeclan Doherty 	if (qp == NULL) {
23894b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_ERR("Failed to allocate queue pair memory");
23994b0ad8eSDeclan Doherty 		return (-ENOMEM);
24094b0ad8eSDeclan Doherty 	}
24194b0ad8eSDeclan Doherty 
24294b0ad8eSDeclan Doherty 	qp->id = qp_id;
24394b0ad8eSDeclan Doherty 	dev->data->queue_pairs[qp_id] = qp;
24494b0ad8eSDeclan Doherty 
24594b0ad8eSDeclan Doherty 	retval = null_crypto_pmd_qp_set_unique_name(dev, qp);
24694b0ad8eSDeclan Doherty 	if (retval) {
24794b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_ERR("Failed to create unique name for null "
24894b0ad8eSDeclan Doherty 				"crypto device");
24994b0ad8eSDeclan Doherty 		goto qp_setup_cleanup;
25094b0ad8eSDeclan Doherty 	}
25194b0ad8eSDeclan Doherty 
25294b0ad8eSDeclan Doherty 	qp->processed_pkts = null_crypto_pmd_qp_create_processed_pkts_ring(qp,
25394b0ad8eSDeclan Doherty 			qp_conf->nb_descriptors, socket_id);
25494b0ad8eSDeclan Doherty 	if (qp->processed_pkts == NULL) {
25594b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_ERR("Failed to create unique name for null "
25694b0ad8eSDeclan Doherty 				"crypto device");
25794b0ad8eSDeclan Doherty 		goto qp_setup_cleanup;
25894b0ad8eSDeclan Doherty 	}
25994b0ad8eSDeclan Doherty 
26094b0ad8eSDeclan Doherty 	qp->sess_mp = dev->data->session_pool;
26194b0ad8eSDeclan Doherty 
26294b0ad8eSDeclan Doherty 	memset(&qp->qp_stats, 0, sizeof(qp->qp_stats));
26394b0ad8eSDeclan Doherty 
26494b0ad8eSDeclan Doherty 	return 0;
26594b0ad8eSDeclan Doherty 
26694b0ad8eSDeclan Doherty qp_setup_cleanup:
26794b0ad8eSDeclan Doherty 	if (qp)
26894b0ad8eSDeclan Doherty 		rte_free(qp);
26994b0ad8eSDeclan Doherty 
27094b0ad8eSDeclan Doherty 	return -1;
27194b0ad8eSDeclan Doherty }
27294b0ad8eSDeclan Doherty 
27394b0ad8eSDeclan Doherty /** Start queue pair */
27494b0ad8eSDeclan Doherty static int
27594b0ad8eSDeclan Doherty null_crypto_pmd_qp_start(__rte_unused struct rte_cryptodev *dev,
27694b0ad8eSDeclan Doherty 		__rte_unused uint16_t queue_pair_id)
27794b0ad8eSDeclan Doherty {
27894b0ad8eSDeclan Doherty 	return -ENOTSUP;
27994b0ad8eSDeclan Doherty }
28094b0ad8eSDeclan Doherty 
28194b0ad8eSDeclan Doherty /** Stop queue pair */
28294b0ad8eSDeclan Doherty static int
28394b0ad8eSDeclan Doherty null_crypto_pmd_qp_stop(__rte_unused struct rte_cryptodev *dev,
28494b0ad8eSDeclan Doherty 		__rte_unused uint16_t queue_pair_id)
28594b0ad8eSDeclan Doherty {
28694b0ad8eSDeclan Doherty 	return -ENOTSUP;
28794b0ad8eSDeclan Doherty }
28894b0ad8eSDeclan Doherty 
28994b0ad8eSDeclan Doherty /** Return the number of allocated queue pairs */
29094b0ad8eSDeclan Doherty static uint32_t
29194b0ad8eSDeclan Doherty null_crypto_pmd_qp_count(struct rte_cryptodev *dev)
29294b0ad8eSDeclan Doherty {
29394b0ad8eSDeclan Doherty 	return dev->data->nb_queue_pairs;
29494b0ad8eSDeclan Doherty }
29594b0ad8eSDeclan Doherty 
29694b0ad8eSDeclan Doherty /** Returns the size of the NULL crypto session structure */
29794b0ad8eSDeclan Doherty static unsigned
29894b0ad8eSDeclan Doherty null_crypto_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
29994b0ad8eSDeclan Doherty {
30094b0ad8eSDeclan Doherty 	return sizeof(struct null_crypto_session);
30194b0ad8eSDeclan Doherty }
30294b0ad8eSDeclan Doherty 
30394b0ad8eSDeclan Doherty /** Configure a null crypto session from a crypto xform chain */
30494b0ad8eSDeclan Doherty static void *
30594b0ad8eSDeclan Doherty null_crypto_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
30694b0ad8eSDeclan Doherty 		struct rte_crypto_sym_xform *xform, void *sess)
30794b0ad8eSDeclan Doherty {
30894b0ad8eSDeclan Doherty 	int retval;
30994b0ad8eSDeclan Doherty 
31094b0ad8eSDeclan Doherty 	if (unlikely(sess == NULL)) {
31194b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_ERR("invalid session struct");
31294b0ad8eSDeclan Doherty 		return NULL;
31394b0ad8eSDeclan Doherty 	}
31494b0ad8eSDeclan Doherty 	retval = null_crypto_set_session_parameters(
31594b0ad8eSDeclan Doherty 			(struct null_crypto_session *)sess, xform);
31694b0ad8eSDeclan Doherty 	if (retval != 0) {
31794b0ad8eSDeclan Doherty 		NULL_CRYPTO_LOG_ERR("failed configure session parameters");
31894b0ad8eSDeclan Doherty 		return NULL;
31994b0ad8eSDeclan Doherty 	}
32094b0ad8eSDeclan Doherty 
32194b0ad8eSDeclan Doherty 	return sess;
32294b0ad8eSDeclan Doherty }
32394b0ad8eSDeclan Doherty 
32494b0ad8eSDeclan Doherty /** Clear the memory of session so it doesn't leave key material behind */
32594b0ad8eSDeclan Doherty static void
32694b0ad8eSDeclan Doherty null_crypto_pmd_session_clear(struct rte_cryptodev *dev __rte_unused,
32794b0ad8eSDeclan Doherty 		void *sess)
32894b0ad8eSDeclan Doherty {
32994b0ad8eSDeclan Doherty 	if (sess)
33094b0ad8eSDeclan Doherty 		memset(sess, 0, sizeof(struct null_crypto_session));
33194b0ad8eSDeclan Doherty }
33294b0ad8eSDeclan Doherty 
33394b0ad8eSDeclan Doherty struct rte_cryptodev_ops pmd_ops = {
33494b0ad8eSDeclan Doherty 		.dev_configure		= null_crypto_pmd_config,
33594b0ad8eSDeclan Doherty 		.dev_start		= null_crypto_pmd_start,
33694b0ad8eSDeclan Doherty 		.dev_stop		= null_crypto_pmd_stop,
33794b0ad8eSDeclan Doherty 		.dev_close		= null_crypto_pmd_close,
33894b0ad8eSDeclan Doherty 
33994b0ad8eSDeclan Doherty 		.stats_get		= null_crypto_pmd_stats_get,
34094b0ad8eSDeclan Doherty 		.stats_reset		= null_crypto_pmd_stats_reset,
34194b0ad8eSDeclan Doherty 
34294b0ad8eSDeclan Doherty 		.dev_infos_get		= null_crypto_pmd_info_get,
34394b0ad8eSDeclan Doherty 
34494b0ad8eSDeclan Doherty 		.queue_pair_setup	= null_crypto_pmd_qp_setup,
34594b0ad8eSDeclan Doherty 		.queue_pair_release	= null_crypto_pmd_qp_release,
34694b0ad8eSDeclan Doherty 		.queue_pair_start	= null_crypto_pmd_qp_start,
34794b0ad8eSDeclan Doherty 		.queue_pair_stop	= null_crypto_pmd_qp_stop,
34894b0ad8eSDeclan Doherty 		.queue_pair_count	= null_crypto_pmd_qp_count,
34994b0ad8eSDeclan Doherty 
35094b0ad8eSDeclan Doherty 		.session_get_size	= null_crypto_pmd_session_get_size,
35194b0ad8eSDeclan Doherty 		.session_configure	= null_crypto_pmd_session_configure,
35294b0ad8eSDeclan Doherty 		.session_clear		= null_crypto_pmd_session_clear
35394b0ad8eSDeclan Doherty };
35494b0ad8eSDeclan Doherty 
35594b0ad8eSDeclan Doherty struct rte_cryptodev_ops *null_crypto_pmd_ops = &pmd_ops;
356