1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 /* Copyright (C) 2019 Netronome Systems, Inc. */
3 
4 #ifndef NFP_CRYPTO_FW_H
5 #define NFP_CRYPTO_FW_H 1
6 
7 #include "../ccm.h"
8 
9 #define NFP_NET_CRYPTO_OP_TLS_1_2_AES_GCM_128_ENC	0
10 #define NFP_NET_CRYPTO_OP_TLS_1_2_AES_GCM_128_DEC	1
11 
12 struct nfp_net_tls_resync_req {
13 	__be32 fw_handle[2];
14 	__be32 tcp_seq;
15 	u8 l3_offset;
16 	u8 l4_offset;
17 	u8 resv[2];
18 };
19 
20 struct nfp_crypto_reply_simple {
21 	struct nfp_ccm_hdr hdr;
22 	__be32 error;
23 };
24 
25 struct nfp_crypto_req_reset {
26 	struct nfp_ccm_hdr hdr;
27 	__be32 ep_id;
28 };
29 
30 #define NFP_NET_TLS_IPVER		GENMASK(15, 12)
31 #define NFP_NET_TLS_VLAN		GENMASK(11, 0)
32 #define NFP_NET_TLS_VLAN_UNUSED			4095
33 
34 struct nfp_crypto_req_add_front {
35 	struct nfp_ccm_hdr hdr;
36 	__be32 ep_id;
37 	u8 resv[3];
38 	u8 opcode;
39 	u8 key_len;
40 	__be16 ipver_vlan __packed;
41 	u8 l4_proto;
42 #define NFP_NET_TLS_NON_ADDR_KEY_LEN	8
43 	u8 l3_addrs[];
44 };
45 
46 struct nfp_crypto_req_add_back {
47 	__be16 src_port;
48 	__be16 dst_port;
49 	__be32 key[8];
50 	__be32 salt;
51 	__be32 iv[2];
52 	__be32 counter;
53 	__be32 rec_no[2];
54 	__be32 tcp_seq;
55 };
56 
57 struct nfp_crypto_req_add_v4 {
58 	struct nfp_crypto_req_add_front front;
59 	__be32 src_ip;
60 	__be32 dst_ip;
61 	struct nfp_crypto_req_add_back back;
62 };
63 
64 struct nfp_crypto_req_add_v6 {
65 	struct nfp_crypto_req_add_front front;
66 	__be32 src_ip[4];
67 	__be32 dst_ip[4];
68 	struct nfp_crypto_req_add_back back;
69 };
70 
71 struct nfp_crypto_reply_add {
72 	struct nfp_ccm_hdr hdr;
73 	__be32 error;
74 	__be32 handle[2];
75 };
76 
77 struct nfp_crypto_req_del {
78 	struct nfp_ccm_hdr hdr;
79 	__be32 ep_id;
80 	__be32 handle[2];
81 };
82 
83 struct nfp_crypto_req_update {
84 	struct nfp_ccm_hdr hdr;
85 	__be32 ep_id;
86 	u8 resv[3];
87 	u8 opcode;
88 	__be32 handle[2];
89 	__be32 rec_no[2];
90 	__be32 tcp_seq;
91 };
92 #endif
93