1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #ifndef __ROC_IE_ON_H__
6 #define __ROC_IE_ON_H__
8 /* CN9K IPSEC LA opcodes */
9 #define ROC_IE_ONL_MAJOR_OP_WRITE_IPSEC_OUTBOUND 0x20
10 #define ROC_IE_ONL_MAJOR_OP_WRITE_IPSEC_INBOUND 0x21
11 #define ROC_IE_ONL_MAJOR_OP_PROCESS_OUTBOUND_IPSEC 0x23
12 #define ROC_IE_ONL_MAJOR_OP_PROCESS_INBOUND_IPSEC 0x24
14 /* CN9K IPSEC FP opcodes */
15 #define ROC_IE_ONF_MAJOR_OP_PROCESS_OUTBOUND_IPSEC 0x25UL
16 #define ROC_IE_ONF_MAJOR_OP_PROCESS_INBOUND_IPSEC 0x26UL
18 /* Ucode completion codes */
19 #define ROC_IE_ONF_UCC_SUCCESS 0
22 ROC_IE_ON_SA_DIR_INBOUND = 0,
23 ROC_IE_ON_SA_DIR_OUTBOUND = 1,
27 ROC_IE_ON_SA_IP_VERSION_4 = 0,
28 ROC_IE_ON_SA_IP_VERSION_6 = 1,
32 ROC_IE_ON_SA_MODE_TRANSPORT = 0,
33 ROC_IE_ON_SA_MODE_TUNNEL = 1,
37 ROC_IE_ON_SA_PROTOCOL_AH = 0,
38 ROC_IE_ON_SA_PROTOCOL_ESP = 1,
42 ROC_IE_ON_SA_AES_KEY_LEN_128 = 1,
43 ROC_IE_ON_SA_AES_KEY_LEN_192 = 2,
44 ROC_IE_ON_SA_AES_KEY_LEN_256 = 3,
48 ROC_IE_ON_SA_ENC_NULL = 0,
49 ROC_IE_ON_SA_ENC_DES_CBC = 1,
50 ROC_IE_ON_SA_ENC_3DES_CBC = 2,
51 ROC_IE_ON_SA_ENC_AES_CBC = 3,
52 ROC_IE_ON_SA_ENC_AES_CTR = 4,
53 ROC_IE_ON_SA_ENC_AES_GCM = 5,
54 ROC_IE_ON_SA_ENC_AES_CCM = 6,
58 ROC_IE_ON_SA_AUTH_NULL = 0,
59 ROC_IE_ON_SA_AUTH_MD5 = 1,
60 ROC_IE_ON_SA_AUTH_SHA1 = 2,
61 ROC_IE_ON_SA_AUTH_SHA2_224 = 3,
62 ROC_IE_ON_SA_AUTH_SHA2_256 = 4,
63 ROC_IE_ON_SA_AUTH_SHA2_384 = 5,
64 ROC_IE_ON_SA_AUTH_SHA2_512 = 6,
65 ROC_IE_ON_SA_AUTH_AES_GMAC = 7,
66 ROC_IE_ON_SA_AUTH_AES_XCBC_128 = 8,
70 ROC_IE_ON_SA_FRAG_POST = 0,
71 ROC_IE_ON_SA_FRAG_PRE = 1,
75 ROC_IE_ON_SA_ENCAP_NONE = 0,
76 ROC_IE_ON_SA_ENCAP_UDP = 1,
79 struct roc_ie_onf_sa_ctl {
81 uint64_t exp_proto_inter_frag : 8;
82 uint64_t rsvd_41_40 : 2;
83 /* Disable SPI, SEQ data in RPTR for Inbound inline */
84 uint64_t spi_seq_dis : 1;
86 uint64_t rsvd_44_45 : 2;
87 uint64_t encap_type : 2;
88 uint64_t enc_type : 3;
90 uint64_t auth_type : 4;
92 uint64_t direction : 1;
93 uint64_t outer_ip_ver : 1;
94 uint64_t inner_ip_ver : 1;
95 uint64_t ipsec_mode : 1;
96 uint64_t ipsec_proto : 1;
97 uint64_t aes_key_len : 2;
100 struct roc_onf_ipsec_outb_sa {
102 struct roc_ie_onf_sa_ctl ctl;
114 uint8_t cipher_key[32];
117 uint8_t hmac_key[48];
120 struct roc_onf_ipsec_inb_sa {
122 struct roc_ie_onf_sa_ctl ctl;
125 uint8_t nonce[4]; /* Only for AES-GCM */
133 uint8_t cipher_key[32];
136 uint8_t hmac_key[48];
139 #define ROC_ONF_IPSEC_INB_MAX_L2_SZ 32UL
140 #define ROC_ONF_IPSEC_OUTB_MAX_L2_SZ 30UL
141 #define ROC_ONF_IPSEC_OUTB_MAX_L2_INFO_SZ (ROC_ONF_IPSEC_OUTB_MAX_L2_SZ + 2)
143 #define ROC_ONF_IPSEC_INB_RES_OFF 80
144 #define ROC_ONF_IPSEC_INB_SPI_SEQ_SZ 16
146 struct roc_onf_ipsec_outb_hdr {
152 #endif /* __ROC_IE_ON_H__ */