1*99a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2*99a2dd95SBruce Richardson * Copyright(c) 2018 Intel Corporation 3*99a2dd95SBruce Richardson */ 4*99a2dd95SBruce Richardson 5*99a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_PORT_SYM_CRYPTO_H__ 6*99a2dd95SBruce Richardson #define __INCLUDE_RTE_PORT_SYM_CRYPTO_H__ 7*99a2dd95SBruce Richardson 8*99a2dd95SBruce Richardson #ifdef __cplusplus 9*99a2dd95SBruce Richardson extern "C" { 10*99a2dd95SBruce Richardson #endif 11*99a2dd95SBruce Richardson 12*99a2dd95SBruce Richardson /** 13*99a2dd95SBruce Richardson * @file 14*99a2dd95SBruce Richardson * RTE Port sym crypto Interface 15*99a2dd95SBruce Richardson * 16*99a2dd95SBruce Richardson * crypto_reader: input port built on top of pre-initialized crypto interface 17*99a2dd95SBruce Richardson * crypto_writer: output port built on top of pre-initialized crypto interface 18*99a2dd95SBruce Richardson * 19*99a2dd95SBruce Richardson **/ 20*99a2dd95SBruce Richardson 21*99a2dd95SBruce Richardson #include <stdint.h> 22*99a2dd95SBruce Richardson 23*99a2dd95SBruce Richardson #include <rte_cryptodev.h> 24*99a2dd95SBruce Richardson 25*99a2dd95SBruce Richardson #include "rte_port.h" 26*99a2dd95SBruce Richardson 27*99a2dd95SBruce Richardson /** Function prototype for reader post action. */ 28*99a2dd95SBruce Richardson typedef void (*rte_port_sym_crypto_reader_callback_fn)(struct rte_mbuf **pkts, 29*99a2dd95SBruce Richardson uint16_t n_pkts, void *arg); 30*99a2dd95SBruce Richardson 31*99a2dd95SBruce Richardson /** Crypto_reader port parameters */ 32*99a2dd95SBruce Richardson struct rte_port_sym_crypto_reader_params { 33*99a2dd95SBruce Richardson /** Target cryptodev ID. */ 34*99a2dd95SBruce Richardson uint8_t cryptodev_id; 35*99a2dd95SBruce Richardson 36*99a2dd95SBruce Richardson /** Target cryptodev Queue Pair ID. */ 37*99a2dd95SBruce Richardson uint16_t queue_id; 38*99a2dd95SBruce Richardson 39*99a2dd95SBruce Richardson /** Crypto reader post callback function. */ 40*99a2dd95SBruce Richardson rte_port_sym_crypto_reader_callback_fn f_callback; 41*99a2dd95SBruce Richardson 42*99a2dd95SBruce Richardson /** Crypto reader post callback function arguments. */ 43*99a2dd95SBruce Richardson void *arg_callback; 44*99a2dd95SBruce Richardson }; 45*99a2dd95SBruce Richardson 46*99a2dd95SBruce Richardson /** Crypto_reader port operations. */ 47*99a2dd95SBruce Richardson extern struct rte_port_in_ops rte_port_sym_crypto_reader_ops; 48*99a2dd95SBruce Richardson 49*99a2dd95SBruce Richardson 50*99a2dd95SBruce Richardson /** Crypto_writer port parameters. */ 51*99a2dd95SBruce Richardson struct rte_port_sym_crypto_writer_params { 52*99a2dd95SBruce Richardson /** Target cryptodev ID. */ 53*99a2dd95SBruce Richardson uint8_t cryptodev_id; 54*99a2dd95SBruce Richardson 55*99a2dd95SBruce Richardson /** Target cryptodev Queue Pair ID. */ 56*99a2dd95SBruce Richardson uint16_t queue_id; 57*99a2dd95SBruce Richardson 58*99a2dd95SBruce Richardson /** offset to rte_crypto_op in the mbufs. */ 59*99a2dd95SBruce Richardson uint16_t crypto_op_offset; 60*99a2dd95SBruce Richardson 61*99a2dd95SBruce Richardson /** Burst size to crypto interface. */ 62*99a2dd95SBruce Richardson uint32_t tx_burst_sz; 63*99a2dd95SBruce Richardson }; 64*99a2dd95SBruce Richardson 65*99a2dd95SBruce Richardson /** Crypto_writer port operations. */ 66*99a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_sym_crypto_writer_ops; 67*99a2dd95SBruce Richardson 68*99a2dd95SBruce Richardson /** Crypto_writer_nodrop port parameters. */ 69*99a2dd95SBruce Richardson struct rte_port_sym_crypto_writer_nodrop_params { 70*99a2dd95SBruce Richardson /** Target cryptodev ID. */ 71*99a2dd95SBruce Richardson uint8_t cryptodev_id; 72*99a2dd95SBruce Richardson 73*99a2dd95SBruce Richardson /** Target cryptodev queue pair id. */ 74*99a2dd95SBruce Richardson uint16_t queue_id; 75*99a2dd95SBruce Richardson 76*99a2dd95SBruce Richardson /** Offset to rte_crypto_op in the mbufs. */ 77*99a2dd95SBruce Richardson uint16_t crypto_op_offset; 78*99a2dd95SBruce Richardson 79*99a2dd95SBruce Richardson /** Burst size to crypto interface. */ 80*99a2dd95SBruce Richardson uint32_t tx_burst_sz; 81*99a2dd95SBruce Richardson 82*99a2dd95SBruce Richardson /** Maximum number of retries, 0 for no limit. */ 83*99a2dd95SBruce Richardson uint32_t n_retries; 84*99a2dd95SBruce Richardson }; 85*99a2dd95SBruce Richardson 86*99a2dd95SBruce Richardson /** Crypto_writer_nodrop port operations. */ 87*99a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_sym_crypto_writer_nodrop_ops; 88*99a2dd95SBruce Richardson 89*99a2dd95SBruce Richardson #ifdef __cplusplus 90*99a2dd95SBruce Richardson } 91*99a2dd95SBruce Richardson #endif 92*99a2dd95SBruce Richardson 93*99a2dd95SBruce Richardson #endif 94