199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2018 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_PORT_SYM_CRYPTO_H__ 699a2dd95SBruce Richardson #define __INCLUDE_RTE_PORT_SYM_CRYPTO_H__ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file 1099a2dd95SBruce Richardson * RTE Port sym crypto Interface 1199a2dd95SBruce Richardson * 1299a2dd95SBruce Richardson * crypto_reader: input port built on top of pre-initialized crypto interface 1399a2dd95SBruce Richardson * crypto_writer: output port built on top of pre-initialized crypto interface 143e4c5be9SThomas Monjalon */ 1599a2dd95SBruce Richardson 1699a2dd95SBruce Richardson #include <stdint.h> 1799a2dd95SBruce Richardson 1899a2dd95SBruce Richardson #include <rte_cryptodev.h> 1999a2dd95SBruce Richardson 2099a2dd95SBruce Richardson #include "rte_port.h" 2199a2dd95SBruce Richardson 22*719834a6SMattias Rönnblom #ifdef __cplusplus 23*719834a6SMattias Rönnblom extern "C" { 24*719834a6SMattias Rönnblom #endif 25*719834a6SMattias Rönnblom 2699a2dd95SBruce Richardson /** Function prototype for reader post action. */ 2799a2dd95SBruce Richardson typedef void (*rte_port_sym_crypto_reader_callback_fn)(struct rte_mbuf **pkts, 2899a2dd95SBruce Richardson uint16_t n_pkts, void *arg); 2999a2dd95SBruce Richardson 3099a2dd95SBruce Richardson /** Crypto_reader port parameters */ 3199a2dd95SBruce Richardson struct rte_port_sym_crypto_reader_params { 3299a2dd95SBruce Richardson /** Target cryptodev ID. */ 3399a2dd95SBruce Richardson uint8_t cryptodev_id; 3499a2dd95SBruce Richardson 3599a2dd95SBruce Richardson /** Target cryptodev Queue Pair ID. */ 3699a2dd95SBruce Richardson uint16_t queue_id; 3799a2dd95SBruce Richardson 3899a2dd95SBruce Richardson /** Crypto reader post callback function. */ 3999a2dd95SBruce Richardson rte_port_sym_crypto_reader_callback_fn f_callback; 4099a2dd95SBruce Richardson 4199a2dd95SBruce Richardson /** Crypto reader post callback function arguments. */ 4299a2dd95SBruce Richardson void *arg_callback; 4399a2dd95SBruce Richardson }; 4499a2dd95SBruce Richardson 4599a2dd95SBruce Richardson /** Crypto_reader port operations. */ 4699a2dd95SBruce Richardson extern struct rte_port_in_ops rte_port_sym_crypto_reader_ops; 4799a2dd95SBruce Richardson 4899a2dd95SBruce Richardson 4999a2dd95SBruce Richardson /** Crypto_writer port parameters. */ 5099a2dd95SBruce Richardson struct rte_port_sym_crypto_writer_params { 5199a2dd95SBruce Richardson /** Target cryptodev ID. */ 5299a2dd95SBruce Richardson uint8_t cryptodev_id; 5399a2dd95SBruce Richardson 5499a2dd95SBruce Richardson /** Target cryptodev Queue Pair ID. */ 5599a2dd95SBruce Richardson uint16_t queue_id; 5699a2dd95SBruce Richardson 5799a2dd95SBruce Richardson /** offset to rte_crypto_op in the mbufs. */ 5899a2dd95SBruce Richardson uint16_t crypto_op_offset; 5999a2dd95SBruce Richardson 6099a2dd95SBruce Richardson /** Burst size to crypto interface. */ 6199a2dd95SBruce Richardson uint32_t tx_burst_sz; 6299a2dd95SBruce Richardson }; 6399a2dd95SBruce Richardson 6499a2dd95SBruce Richardson /** Crypto_writer port operations. */ 6599a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_sym_crypto_writer_ops; 6699a2dd95SBruce Richardson 6799a2dd95SBruce Richardson /** Crypto_writer_nodrop port parameters. */ 6899a2dd95SBruce Richardson struct rte_port_sym_crypto_writer_nodrop_params { 6999a2dd95SBruce Richardson /** Target cryptodev ID. */ 7099a2dd95SBruce Richardson uint8_t cryptodev_id; 7199a2dd95SBruce Richardson 7299a2dd95SBruce Richardson /** Target cryptodev queue pair id. */ 7399a2dd95SBruce Richardson uint16_t queue_id; 7499a2dd95SBruce Richardson 7599a2dd95SBruce Richardson /** Offset to rte_crypto_op in the mbufs. */ 7699a2dd95SBruce Richardson uint16_t crypto_op_offset; 7799a2dd95SBruce Richardson 7899a2dd95SBruce Richardson /** Burst size to crypto interface. */ 7999a2dd95SBruce Richardson uint32_t tx_burst_sz; 8099a2dd95SBruce Richardson 8199a2dd95SBruce Richardson /** Maximum number of retries, 0 for no limit. */ 8299a2dd95SBruce Richardson uint32_t n_retries; 8399a2dd95SBruce Richardson }; 8499a2dd95SBruce Richardson 8599a2dd95SBruce Richardson /** Crypto_writer_nodrop port operations. */ 8699a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_sym_crypto_writer_nodrop_ops; 8799a2dd95SBruce Richardson 8899a2dd95SBruce Richardson #ifdef __cplusplus 8999a2dd95SBruce Richardson } 9099a2dd95SBruce Richardson #endif 9199a2dd95SBruce Richardson 9299a2dd95SBruce Richardson #endif 93