net/txgbe: add queue stats mapping
[dpdk.git] / drivers / crypto / nitrox / nitrox_sym_ctx.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #ifndef _NITROX_SYM_CTX_H_
6 #define _NITROX_SYM_CTX_H_
7
8 #include <stdbool.h>
9
10 #include <rte_crypto.h>
11
12 #define AES_MAX_KEY_SIZE 32
13 #define AES_BLOCK_SIZE 16
14 #define AES_GCM_SALT_SIZE 4
15
16 enum nitrox_chain {
17         NITROX_CHAIN_CIPHER_ONLY,
18         NITROX_CHAIN_CIPHER_AUTH,
19         NITROX_CHAIN_AUTH_CIPHER,
20         NITROX_CHAIN_COMBINED,
21         NITROX_CHAIN_NOT_SUPPORTED
22 };
23
24 enum nitrox_op {
25         NITROX_OP_ENCRYPT,
26         NITROX_OP_DECRYPT,
27 };
28
29 struct crypto_keys {
30         uint8_t key[AES_MAX_KEY_SIZE];
31         uint8_t iv[AES_BLOCK_SIZE];
32 };
33
34 struct auth_keys {
35         uint8_t ipad[64];
36         uint8_t opad[64];
37 };
38
39 struct flexi_crypto_context {
40         union {
41                 uint64_t flags;
42                 struct {
43 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
44                         uint64_t cipher_type : 4;
45                         uint64_t reserved_59 : 1;
46                         uint64_t aes_keylen : 2;
47                         uint64_t iv_source : 1;
48                         uint64_t hash_type : 4;
49                         uint64_t reserved_49_51 : 3;
50                         uint64_t auth_input_type : 1;
51                         uint64_t mac_len : 8;
52                         uint64_t reserved_0_39 : 40;
53 #else
54                         uint64_t reserved_0_39 : 40;
55                         uint64_t mac_len : 8;
56                         uint64_t auth_input_type : 1;
57                         uint64_t reserved_49_51 : 3;
58                         uint64_t hash_type : 4;
59                         uint64_t iv_source : 1;
60                         uint64_t aes_keylen : 2;
61                         uint64_t reserved_59 : 1;
62                         uint64_t cipher_type : 4;
63 #endif
64                 } w0;
65         };
66         struct crypto_keys crypto;
67         struct auth_keys auth;
68 };
69
70 struct nitrox_crypto_ctx {
71         struct flexi_crypto_context fctx;
72         enum nitrox_chain nitrox_chain;
73         struct {
74                 uint16_t offset;
75                 uint16_t length;
76         } iv;
77         rte_iova_t iova;
78         uint8_t salt[AES_GCM_SALT_SIZE];
79         uint16_t digest_length;
80         uint16_t aad_length;
81         uint8_t opcode;
82         uint8_t req_op;
83 };
84
85 #endif /* _NITROX_SYM_CTX_H_ */