Make IPsec defines common and remove redundant macros.
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
#include "cnxk_security.h"
+#include "roc_api.h"
+
static void
ipsec_hmac_opad_ipad_gen(struct rte_crypto_sym_xform *auth_xform,
uint8_t *hmac_opad_ipad)
/* Set direction */
switch (ipsec_xfrm->direction) {
case RTE_SECURITY_IPSEC_SA_DIR_INGRESS:
- w2->s.dir = ROC_IE_OT_SA_DIR_INBOUND;
+ w2->s.dir = ROC_IE_SA_DIR_INBOUND;
auth_xfrm = crypto_xfrm;
cipher_xfrm = crypto_xfrm->next;
break;
case RTE_SECURITY_IPSEC_SA_DIR_EGRESS:
- w2->s.dir = ROC_IE_OT_SA_DIR_OUTBOUND;
+ w2->s.dir = ROC_IE_SA_DIR_OUTBOUND;
cipher_xfrm = crypto_xfrm;
auth_xfrm = crypto_xfrm->next;
break;
/* Set protocol - ESP vs AH */
switch (ipsec_xfrm->proto) {
case RTE_SECURITY_IPSEC_SA_PROTO_ESP:
- w2->s.protocol = ROC_IE_OT_SA_PROTOCOL_ESP;
+ w2->s.protocol = ROC_IE_SA_PROTOCOL_ESP;
break;
case RTE_SECURITY_IPSEC_SA_PROTO_AH:
- w2->s.protocol = ROC_IE_OT_SA_PROTOCOL_AH;
+ w2->s.protocol = ROC_IE_SA_PROTOCOL_AH;
break;
default:
return -EINVAL;
/* Set mode - transport vs tunnel */
switch (ipsec_xfrm->mode) {
case RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT:
- w2->s.mode = ROC_IE_OT_SA_MODE_TRANSPORT;
+ w2->s.mode = ROC_IE_SA_MODE_TRANSPORT;
break;
case RTE_SECURITY_IPSEC_SA_MODE_TUNNEL:
- w2->s.mode = ROC_IE_OT_SA_MODE_TUNNEL;
+ w2->s.mode = ROC_IE_SA_MODE_TUNNEL;
break;
default:
return -EINVAL;
switch (length) {
case ROC_CPT_AES128_KEY_LEN:
- w2->s.aes_key_len = ROC_IE_OT_SA_AES_KEY_LEN_128;
+ w2->s.aes_key_len = ROC_IE_SA_AES_KEY_LEN_128;
break;
case ROC_CPT_AES192_KEY_LEN:
- w2->s.aes_key_len = ROC_IE_OT_SA_AES_KEY_LEN_192;
+ w2->s.aes_key_len = ROC_IE_SA_AES_KEY_LEN_192;
break;
case ROC_CPT_AES256_KEY_LEN:
- w2->s.aes_key_len = ROC_IE_OT_SA_AES_KEY_LEN_256;
+ w2->s.aes_key_len = ROC_IE_SA_AES_KEY_LEN_256;
break;
default:
return -EINVAL;
/* Tunnel header info */
switch (tunnel->type) {
case RTE_SECURITY_IPSEC_TUNNEL_IPV4:
- sa->w2.s.outer_ip_ver = ROC_IE_OT_SA_IP_VERSION_4;
+ sa->w2.s.outer_ip_ver = ROC_IE_SA_IP_VERSION_4;
memcpy(&sa->outer_hdr.ipv4.src_addr, &tunnel->ipv4.src_ip,
sizeof(struct in_addr));
memcpy(&sa->outer_hdr.ipv4.dst_addr, &tunnel->ipv4.dst_ip,
}
break;
case RTE_SECURITY_IPSEC_TUNNEL_IPV6:
- sa->w2.s.outer_ip_ver = ROC_IE_OT_SA_IP_VERSION_6;
+ sa->w2.s.outer_ip_ver = ROC_IE_SA_IP_VERSION_6;
memcpy(&sa->outer_hdr.ipv6.src_addr, &tunnel->ipv6.src_addr,
sizeof(struct in6_addr));
memcpy(&sa->outer_hdr.ipv6.dst_addr, &tunnel->ipv6.dst_addr,
/* CPT microcode */
#include "roc_ae.h"
#include "roc_ae_fpm_tables.h"
+#include "roc_ie.h"
#include "roc_ie_on.h"
#include "roc_ie_ot.h"
#include "roc_se.h"
#ifndef __ROC_IE_H__
#define __ROC_IE_H__
-/* CNXK IPSEC helper macros */
-#define ROC_IE_AH_HDR_LEN 12
-#define ROC_IE_AES_GCM_IV_LEN 8
-#define ROC_IE_AES_GCM_MAC_LEN 16
-#define ROC_IE_AES_CBC_IV_LEN 16
-#define ROC_IE_SHA1_HMAC_LEN 12
-#define ROC_IE_AUTH_KEY_LEN_MAX 64
+enum {
+ ROC_IE_SA_DIR_INBOUND = 0,
+ ROC_IE_SA_DIR_OUTBOUND = 1,
+};
-#define ROC_IE_AES_GCM_ROUNDUP_BYTE_LEN 4
-#define ROC_IE_AES_CBC_ROUNDUP_BYTE_LEN 16
+enum {
+ ROC_IE_SA_IP_VERSION_4 = 0,
+ ROC_IE_SA_IP_VERSION_6 = 1,
+};
+
+enum {
+ ROC_IE_SA_MODE_TRANSPORT = 0,
+ ROC_IE_SA_MODE_TUNNEL = 1,
+};
+
+enum {
+ ROC_IE_SA_PROTOCOL_AH = 0,
+ ROC_IE_SA_PROTOCOL_ESP = 1,
+};
+
+enum {
+ ROC_IE_SA_AES_KEY_LEN_128 = 1,
+ ROC_IE_SA_AES_KEY_LEN_192 = 2,
+ ROC_IE_SA_AES_KEY_LEN_256 = 3,
+};
#endif /* __ROC_IE_H__ */
/* Ucode completion codes */
#define ROC_IE_ONF_UCC_SUCCESS 0
-enum {
- ROC_IE_ON_SA_DIR_INBOUND = 0,
- ROC_IE_ON_SA_DIR_OUTBOUND = 1,
-};
-
-enum {
- ROC_IE_ON_SA_IP_VERSION_4 = 0,
- ROC_IE_ON_SA_IP_VERSION_6 = 1,
-};
-
-enum {
- ROC_IE_ON_SA_MODE_TRANSPORT = 0,
- ROC_IE_ON_SA_MODE_TUNNEL = 1,
-};
-
-enum {
- ROC_IE_ON_SA_PROTOCOL_AH = 0,
- ROC_IE_ON_SA_PROTOCOL_ESP = 1,
-};
-
-enum {
- ROC_IE_ON_SA_AES_KEY_LEN_128 = 1,
- ROC_IE_ON_SA_AES_KEY_LEN_192 = 2,
- ROC_IE_ON_SA_AES_KEY_LEN_256 = 3,
-};
-
enum {
ROC_IE_ON_SA_ENC_NULL = 0,
ROC_IE_ON_SA_ENC_DES_CBC = 1,
ROC_IE_OT_SA_INNER_PKT_L4_CSUM_DISABLE = 1,
};
-enum {
- ROC_IE_OT_SA_DIR_INBOUND = 0,
- ROC_IE_OT_SA_DIR_OUTBOUND = 1,
-};
-
-enum {
- ROC_IE_OT_SA_IP_VERSION_4 = 0,
- ROC_IE_OT_SA_IP_VERSION_6 = 1,
-};
-
-enum {
- ROC_IE_OT_SA_MODE_TRANSPORT = 0,
- ROC_IE_OT_SA_MODE_TUNNEL = 1,
-};
-
-enum {
- ROC_IE_OT_SA_PROTOCOL_AH = 0,
- ROC_IE_OT_SA_PROTOCOL_ESP = 1,
-};
-
-enum {
- ROC_IE_OT_SA_AES_KEY_LEN_128 = 1,
- ROC_IE_OT_SA_AES_KEY_LEN_192 = 2,
- ROC_IE_OT_SA_AES_KEY_LEN_256 = 3,
-};
-
enum {
ROC_IE_OT_SA_ENC_NULL = 0,
ROC_IE_OT_SA_ENC_3DES_CBC = 2,
#include "cnxk_cryptodev_ops.h"
#include "cnxk_se.h"
+#include "roc_api.h"
+
static inline struct cnxk_se_sess *
cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op)
{
sa = &sess->sa;
w2 = (union roc_ot_ipsec_sa_word2 *)&sa->in_sa.w2;
- if (w2->s.dir == ROC_IE_OT_SA_DIR_OUTBOUND)
+ if (w2->s.dir == ROC_IE_SA_DIR_OUTBOUND)
ret = process_outb_sa(op, sa, inst);
else
ret = process_inb_sa(op, sa, inst);