1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2020 Beijing WangXun Technology Co., Ltd.
3 * Copyright(c) 2010-2017 Intel Corporation
9 #include <rte_ethdev.h>
10 #include <rte_ethdev_core.h>
11 #include <rte_security.h>
13 #define IPSRXMOD_VALID 0x00000001
14 #define IPSRXMOD_PROTO 0x00000004
15 #define IPSRXMOD_DECRYPT 0x00000008
16 #define IPSRXMOD_IPV6 0x00000010
18 #define IPSEC_MAX_RX_IP_COUNT 128
19 #define IPSEC_MAX_SA_COUNT 1024
21 #define ESP_ICV_SIZE 16
22 #define ESP_TRAILER_SIZE 2
24 enum txgbe_operation {
25 TXGBE_OP_AUTHENTICATED_ENCRYPTION,
26 TXGBE_OP_AUTHENTICATED_DECRYPTION
30 * Generic IP address structure
31 * TODO: Find better location for this rte_net.h possibly.
38 /**< IP Address Type - IPv4/IPv6 */
46 /** inline crypto private session structure */
47 struct txgbe_crypto_session {
48 enum txgbe_operation op;
56 struct rte_eth_dev *dev;
57 } __rte_cache_aligned;
59 struct txgbe_crypto_rx_ip_table {
63 struct txgbe_crypto_rx_sa_table {
70 struct txgbe_crypto_tx_sa_table {
75 union txgbe_crypto_tx_desc_md {
78 /**< SA table index */
80 /**< ICV and ESP trailer length */
82 /**< enable encryption */
88 struct txgbe_crypto_rx_ip_table rx_ip_tbl[IPSEC_MAX_RX_IP_COUNT];
89 struct txgbe_crypto_rx_sa_table rx_sa_tbl[IPSEC_MAX_SA_COUNT];
90 struct txgbe_crypto_tx_sa_table tx_sa_tbl[IPSEC_MAX_SA_COUNT];
93 int txgbe_crypto_enable_ipsec(struct rte_eth_dev *dev);
94 int txgbe_crypto_add_ingress_sa_from_flow(const void *sess,
98 #endif /*TXGBE_IPSEC_H_*/