common/cnxk: add lmtline initialization
[dpdk.git] / drivers / common / cnxk / roc_ie_on.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef __ROC_IE_ON_H__
6 #define __ROC_IE_ON_H__
7
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
13
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
17
18 /* Ucode completion codes */
19 #define ROC_IE_ONF_UCC_SUCCESS 0
20
21 enum {
22         ROC_IE_ON_SA_DIR_INBOUND = 0,
23         ROC_IE_ON_SA_DIR_OUTBOUND = 1,
24 };
25
26 enum {
27         ROC_IE_ON_SA_IP_VERSION_4 = 0,
28         ROC_IE_ON_SA_IP_VERSION_6 = 1,
29 };
30
31 enum {
32         ROC_IE_ON_SA_MODE_TRANSPORT = 0,
33         ROC_IE_ON_SA_MODE_TUNNEL = 1,
34 };
35
36 enum {
37         ROC_IE_ON_SA_PROTOCOL_AH = 0,
38         ROC_IE_ON_SA_PROTOCOL_ESP = 1,
39 };
40
41 enum {
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,
45 };
46
47 enum {
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,
55 };
56
57 enum {
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,
67 };
68
69 enum {
70         ROC_IE_ON_SA_FRAG_POST = 0,
71         ROC_IE_ON_SA_FRAG_PRE = 1,
72 };
73
74 enum {
75         ROC_IE_ON_SA_ENCAP_NONE = 0,
76         ROC_IE_ON_SA_ENCAP_UDP = 1,
77 };
78
79 struct roc_ie_onf_sa_ctl {
80         uint32_t spi;
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;
85         uint64_t esn_en : 1;
86         uint64_t rsvd_44_45 : 2;
87         uint64_t encap_type : 2;
88         uint64_t enc_type : 3;
89         uint64_t rsvd_48 : 1;
90         uint64_t auth_type : 4;
91         uint64_t valid : 1;
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;
98 };
99
100 struct roc_onf_ipsec_outb_sa {
101         /* w0 */
102         struct roc_ie_onf_sa_ctl ctl;
103
104         /* w1 */
105         uint8_t nonce[4];
106         uint16_t udp_src;
107         uint16_t udp_dst;
108
109         /* w2 */
110         uint32_t ip_src;
111         uint32_t ip_dst;
112
113         /* w3-w6 */
114         uint8_t cipher_key[32];
115
116         /* w7-w12 */
117         uint8_t hmac_key[48];
118 };
119
120 struct roc_onf_ipsec_inb_sa {
121         /* w0 */
122         struct roc_ie_onf_sa_ctl ctl;
123
124         /* w1 */
125         uint8_t nonce[4]; /* Only for AES-GCM */
126         uint32_t unused;
127
128         /* w2 */
129         uint32_t esn_hi;
130         uint32_t esn_low;
131
132         /* w3-w6 */
133         uint8_t cipher_key[32];
134
135         /* w7-w12 */
136         uint8_t hmac_key[48];
137 };
138
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)
142
143 #define ROC_ONF_IPSEC_INB_RES_OFF    80
144 #define ROC_ONF_IPSEC_INB_SPI_SEQ_SZ 16
145
146 struct roc_onf_ipsec_outb_hdr {
147         uint32_t ip_id;
148         uint32_t seq;
149         uint8_t iv[16];
150 };
151
152 #endif /* __ROC_IE_ON_H__ */