aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vpp/perf/nfv_density/dcr_memif/chain/regenerate_testcases.py
blob: ec754aa26113cc407ef08321ea08d5c50131ee5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3

# Copyright (c) 2019 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from resources.libraries.python.autogen.Regenerator import Regenerator

Regenerator().regenerate_glob(u"*.robot")
Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*-
 *   BSD LICENSE
 *
 *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
 *   are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in
 *       the documentation and/or other materials provided with the
 *       distribution.
 *     * Neither the name of Intel Corporation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _RTE_CRYPTO_H_
#define _RTE_CRYPTO_H_

/**
 * @file rte_crypto.h
 *
 * RTE Cryptography Common Definitions
 *
 */

#ifdef __cplusplus
extern "C" {
#endif


#include <rte_mbuf.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_common.h>

#include "rte_crypto_sym.h"

/** Crypto operation types */
enum rte_crypto_op_type {
	RTE_CRYPTO_OP_TYPE_UNDEFINED,
	/**< Undefined operation type */
	RTE_CRYPTO_OP_TYPE_SYMMETRIC,
	/**< Symmetric operation */
};

/** Status of crypto operation */
enum rte_crypto_op_status {
	RTE_CRYPTO_OP_STATUS_SUCCESS,
	/**< Operation completed successfully */
	RTE_CRYPTO_OP_STATUS_NOT_PROCESSED,
	/**< Operation has not yet been processed by a crypto device */
	RTE_CRYPTO_OP_STATUS_AUTH_FAILED,
	/**< Authentication verification failed */
	RTE_CRYPTO_OP_STATUS_INVALID_SESSION,
	/**<
	 * Symmetric operation failed due to invalid session arguments, or if
	 * in session-less mode, failed to allocate private operation material.
	 */
	RTE_CRYPTO_OP_STATUS_INVALID_ARGS,
	/**< Operation failed due to invalid arguments in request */
	RTE_CRYPTO_OP_STATUS_ERROR,
	/**< Error handling operation */
};

/**
 * Crypto operation session type. This is used to specify whether a crypto
 * operation has session structure attached for immutable parameters or if all
 * operation information is included in the operation data structure.
 */
enum rte_crypto_op_sess_type {
	RTE_CRYPTO_OP_WITH_SESSION,	/**< Session based crypto operation */
	RTE_CRYPTO_OP_SESSIONLESS,	/**< Session-less crypto operation */
	RTE_CRYPTO_OP_SECURITY_SESSION	/**< Security session crypto operation */
};

/**
 * Cryptographic Operation.
 *
 * This structure contains data relating to performing cryptographic
 * operations. This operation structure is used to contain any operation which
 * is supported by the cryptodev API, PMDs should check the type parameter to
 * verify that the operation is a support function of the device. Crypto
 * operations are enqueued and dequeued in crypto PMDs using the
 * rte_cryptodev_enqueue_burst() / rte_cryptodev_dequeue_burst() .
 */
struct rte_crypto_op {
	uint8_t type;
	/**< operation type */
	uint8_t status;
	/**<
	 * operation status - this is reset to
	 * RTE_CRYPTO_OP_STATUS_NOT_PROCESSED on allocation from mempool and
	 * will be set to RTE_CRYPTO_OP_STATUS_SUCCESS after crypto operation
	 * is successfully processed by a crypto PMD
	 */
	uint8_t sess_type;
	/**< operation session type */

	uint8_t reserved[5];
	/**< Reserved bytes to fill 64 bits for future additions */
	struct rte_mempool *mempool;
	/**< crypto operation mempool which operation is allocated from */

	rte_iova_t phys_addr;
	/**< physical address of crypto operation */

	RTE_STD_C11
	union {
		struct rte_crypto_sym_op sym[0];
		/**< Symmetric operation parameters */
	}; /**< operation specific parameters */
};

/**
 * Reset the fields of a crypto operation to their default values.
 *
 * @param	op	The crypto operation to be reset.
 * @param	type	The crypto operation type.
 */
static inline void
__rte_crypto_op_reset(struct rte_crypto_op *op, enum rte_crypto_op_type type)
{
	op->type = type;
	op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
	op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;

	switch (type) {
	case RTE_CRYPTO_OP_TYPE_SYMMETRIC:
		__rte_crypto_sym_op_reset(op->sym);
		break;
	case RTE_CRYPTO_OP_TYPE_UNDEFINED:
	default:
		break;
	}
}

/**
 * Private data structure belonging to a crypto symmetric operation pool.
 */
struct rte_crypto_op_pool_private {
	enum rte_crypto_op_type type;
	/**< Crypto op pool type operation. */
	uint16_t priv_size;
	/**< Size of private area in each crypto operation. */
};


/**
 * Returns the size of private data allocated with each rte_crypto_op object by
 * the mempool
 *
 * @param	mempool	rte_crypto_op mempool
 *
 * @return	private data size
 */
static inline uint16_t
__rte_crypto_op_get_priv_data_size(struct rte_mempool *mempool)
{
	struct rte_crypto_op_pool_private *priv =
		(struct rte_crypto_op_pool_private *) rte_mempool_get_priv(mempool);

	return priv->priv_size;
}


/**
 * Creates a crypto operation pool
 *
 * @param	name		pool name
 * @param	type		crypto operation type, use
 *				RTE_CRYPTO_OP_TYPE_UNDEFINED for a pool which
 *				supports all operation types
 * @param	nb_elts		number of elements in pool
 * @param	cache_size	Number of elements to cache on lcore, see
 *				*rte_mempool_create* for further details about
 *				cache size
 * @param	priv_size	Size of private data to allocate with each
 *				operation
 * @param	socket_id	Socket to allocate memory on
 *
 * @return
 *  - On success pointer to mempool
 *  - On failure NULL
 */
extern struct rte_mempool *
rte_crypto_op_pool_create(const char *name, enum rte_crypto_op_type type,
		unsigned nb_elts, unsigned cache_size, uint16_t priv_size,
		int socket_id);

/**
 * Bulk allocate raw element from mempool and return as crypto operations
 *
 * @param	mempool		crypto operation mempool.
 * @param	type		crypto operation type.
 * @param	ops		Array to place allocated crypto operations
 * @param	nb_ops		Number of crypto operations to allocate
 *
 * @returns
 * - On success returns  number of ops allocated
 */
static inline int
__rte_crypto_op_raw_bulk_alloc(struct rte_mempool *mempool,
		enum rte_crypto_op_type type,
		struct rte_crypto_op **ops, uint16_t nb_ops)
{
	struct rte_crypto_op_pool_private *priv;

	priv = (struct rte_crypto_op_pool_private *) rte_mempool_get_priv(mempool);
	if (unlikely(priv->type != type &&
			priv->type != RTE_CRYPTO_OP_TYPE_UNDEFINED))
		return -EINVAL;

	if (rte_mempool_get_bulk(mempool, (void **)ops, nb_ops) == 0)
		return nb_ops;

	return 0;
}

/**
 * Allocate a crypto operation from a mempool with default parameters set
 *
 * @param	mempool	crypto operation mempool
 * @param	type	operation type to allocate
 *
 * @returns
 * - On success returns a valid rte_crypto_op structure
 * - On failure returns NULL
 */
static inline struct rte_crypto_op *
rte_crypto_op_alloc(struct rte_mempool *mempool, enum rte_crypto_op_type type)
{
	struct rte_crypto_op *op = NULL;
	int retval;

	retval = __rte_crypto_op_raw_bulk_alloc(mempool, type, &op, 1);
	if (unlikely(retval != 1))
		return NULL;

	__rte_crypto_op_reset(op, type);

	return op;
}


/**
 * Bulk allocate crypto operations from a mempool with default parameters set
 *
 * @param	mempool	crypto operation mempool
 * @param	type	operation type to allocate
 * @param	ops	Array to place allocated crypto operations
 * @param	nb_ops	Number of crypto operations to allocate
 *
 * @returns
 * - nb_ops if the number of operations requested were allocated.
 * - 0 if the requested number of ops are not available.
 *   None are allocated in this case.
 */

static inline unsigned
rte_crypto_op_bulk_alloc(struct rte_mempool *mempool,
		enum rte_crypto_op_type type,
		struct rte_crypto_op **ops, uint16_t nb_ops)
{
	int i;

	if (unlikely(__rte_crypto_op_raw_bulk_alloc(mempool, type, ops, nb_ops)
			!= nb_ops))
		return 0;

	for (i = 0; i < nb_ops; i++)
		__rte_crypto_op_reset(ops[i], type);

	return nb_ops;
}



/**
 * Returns a pointer to the private data of a crypto operation if
 * that operation has enough capacity for requested size.
 *
 * @param	op	crypto operation.
 * @param	size	size of space requested in private data.
 *
 * @returns
 * - if sufficient space available returns pointer to start of private data
 * - if insufficient space returns NULL
 */
static inline void *
__rte_crypto_op_get_priv_data(struct rte_crypto_op *op, uint32_t size)
{
	uint32_t priv_size;

	if (likely(op->mempool != NULL)) {
		priv_size = __rte_crypto_op_get_priv_data_size(op->mempool);

		if (likely(priv_size >= size))
			return (void *)((uint8_t *)(op + 1) +
					sizeof(struct rte_crypto_sym_op));
	}

	return NULL;
}

/**
 * free crypto operation structure
 * If operation has been allocate from a rte_mempool, then the operation will
 * be returned to the mempool.
 *
 * @param	op	symmetric crypto operation
 */
static inline void
rte_crypto_op_free(struct rte_crypto_op *op)
{
	if (op != NULL && op->mempool != NULL)
		rte_mempool_put(op->mempool, op);
}

/**
 * Allocate a symmetric crypto operation in the private data of an mbuf.
 *
 * @param	m	mbuf which is associated with the crypto operation, the
 *			operation will be allocated in the private data of that
 *			mbuf.
 *
 * @returns
 * - On success returns a pointer to the crypto operation.
 * - On failure returns NULL.
 */
static inline struct rte_crypto_op *
rte_crypto_sym_op_alloc_from_mbuf_priv_data(struct rte_mbuf *m)
{
	if (unlikely(m == NULL))
		return NULL;

	/*
	 * check that the mbuf's private data size is sufficient to contain a
	 * crypto operation
	 */
	if (unlikely(m->priv_size < (sizeof(struct rte_crypto_op) +
			sizeof(struct rte_crypto_sym_op))))
		return NULL;

	/* private data starts immediately after the mbuf header in the mbuf. */
	struct rte_crypto_op *op = (struct rte_crypto_op *)(m + 1);

	__rte_crypto_op_reset(op, RTE_CRYPTO_OP_TYPE_SYMMETRIC);

	op->mempool = NULL;
	op->sym->m_src = m;

	return op;
}

/**
 * Allocate space for symmetric crypto xforms in the private data space of the
 * crypto operation. This also defaults the crypto xform type and configures
 * the chaining of the xforms in the crypto operation
 *
 * @return
 * - On success returns pointer to first crypto xform in crypto operations chain
 * - On failure returns NULL
 */
static inline struct rte_crypto_sym_xform *
rte_crypto_op_sym_xforms_alloc(struct rte_crypto_op *op, uint8_t nb_xforms)
{
	void *priv_data;
	uint32_t size;

	if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
		return NULL;

	size = sizeof(struct rte_crypto_sym_xform) * nb_xforms;

	priv_data = __rte_crypto_op_get_priv_data(op, size);
	if (priv_data == NULL)
		return NULL;

	return __rte_crypto_sym_op_sym_xforms_alloc(op->sym, priv_data,
			nb_xforms);
}


/**
 * Attach a session to a crypto operation
 *
 * @param	op	crypto operation, must be of type symmetric
 * @param	sess	cryptodev session
 */
static inline int
rte_crypto_op_attach_sym_session(struct rte_crypto_op *op,
		struct rte_cryptodev_sym_session *sess)
{
	if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC))
		return -1;

	op->sess_type = RTE_CRYPTO_OP_WITH_SESSION;

	return __rte_crypto_sym_op_attach_sym_session(op->sym, sess);
}

#ifdef __cplusplus
}
#endif

#endif /* _RTE_CRYPTO_H_ */