net/bnxt: ignore VLAN priority mask
[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
15 enum nitrox_chain {
16         NITROX_CHAIN_CIPHER_ONLY,
17         NITROX_CHAIN_CIPHER_AUTH,
18         NITROX_CHAIN_AUTH_CIPHER,
19         NITROX_CHAIN_COMBINED,
20         NITROX_CHAIN_NOT_SUPPORTED
21 };
22
23 enum nitrox_op {
24         NITROX_OP_ENCRYPT,
25         NITROX_OP_DECRYPT,
26 };
27
28 struct crypto_keys {
29         uint8_t key[AES_MAX_KEY_SIZE];
30         uint8_t iv[AES_BLOCK_SIZE];
31 };
32
33 struct auth_keys {
34         uint8_t ipad[64];
35         uint8_t opad[64];
36 };
37
38 struct flexi_crypto_context {
39         union {
40                 uint64_t flags;
41                 struct {
42 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
43                         uint64_t cipher_type : 4;
44                         uint64_t reserved_59 : 1;
45                         uint64_t aes_keylen : 2;
46                         uint64_t iv_source : 1;
47                         uint64_t hash_type : 4;
48                         uint64_t reserved_49_51 : 3;
49                         uint64_t auth_input_type : 1;
50                         uint64_t mac_len : 8;
51                         uint64_t reserved_0_39 : 40;
52 #else
53                         uint64_t reserved_0_39 : 40;
54                         uint64_t mac_len : 8;
55                         uint64_t auth_input_type : 1;
56                         uint64_t reserved_49_51 : 3;
57                         uint64_t hash_type : 4;
58                         uint64_t iv_source : 1;
59                         uint64_t aes_keylen : 2;
60                         uint64_t reserved_59 : 1;
61                         uint64_t cipher_type : 4;
62 #endif
63                 } w0;
64         };
65         struct crypto_keys crypto;
66         struct auth_keys auth;
67 };
68
69 struct nitrox_crypto_ctx {
70         struct flexi_crypto_context fctx;
71         enum nitrox_chain nitrox_chain;
72         enum rte_crypto_auth_operation auth_op;
73         enum rte_crypto_auth_algorithm auth_algo;
74         struct {
75                 uint16_t offset;
76                 uint16_t length;
77         } iv;
78         rte_iova_t iova;
79         uint16_t digest_length;
80         uint8_t opcode;
81         uint8_t req_op;
82 };
83
84 #endif /* _NITROX_SYM_CTX_H_ */