xref: /linux/drivers/net/ethernet/netronome/nfp/crypto/fw.h (revision 4201c9260a8d3c4ef238e51692a7e9b4e1e29efe)
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_crypto_reply_simple {
13 	struct nfp_ccm_hdr hdr;
14 	__be32 error;
15 };
16 
17 struct nfp_crypto_req_reset {
18 	struct nfp_ccm_hdr hdr;
19 	__be32 ep_id;
20 };
21 
22 #define NFP_NET_TLS_IPVER		GENMASK(15, 12)
23 #define NFP_NET_TLS_VLAN		GENMASK(11, 0)
24 #define NFP_NET_TLS_VLAN_UNUSED			4095
25 
26 struct nfp_crypto_req_add_front {
27 	struct nfp_ccm_hdr hdr;
28 	__be32 ep_id;
29 	u8 resv[3];
30 	u8 opcode;
31 	u8 key_len;
32 	__be16 ipver_vlan __packed;
33 	u8 l4_proto;
34 };
35 
36 struct nfp_crypto_req_add_back {
37 	__be16 src_port;
38 	__be16 dst_port;
39 	__be32 key[8];
40 	__be32 salt;
41 	__be32 iv[2];
42 	__be32 counter;
43 	__be32 rec_no[2];
44 	__be32 tcp_seq;
45 };
46 
47 struct nfp_crypto_req_add_v4 {
48 	struct nfp_crypto_req_add_front front;
49 	__be32 src_ip;
50 	__be32 dst_ip;
51 	struct nfp_crypto_req_add_back back;
52 };
53 
54 struct nfp_crypto_req_add_v6 {
55 	struct nfp_crypto_req_add_front front;
56 	__be32 src_ip[4];
57 	__be32 dst_ip[4];
58 	struct nfp_crypto_req_add_back back;
59 };
60 
61 struct nfp_crypto_reply_add {
62 	struct nfp_ccm_hdr hdr;
63 	__be32 error;
64 	__be32 handle[2];
65 };
66 
67 struct nfp_crypto_req_del {
68 	struct nfp_ccm_hdr hdr;
69 	__be32 ep_id;
70 	__be32 handle[2];
71 };
72 
73 struct nfp_crypto_req_update {
74 	struct nfp_ccm_hdr hdr;
75 	__be32 ep_id;
76 	u8 resv[3];
77 	u8 opcode;
78 	__be32 handle[2];
79 	__be32 rec_no[2];
80 	__be32 tcp_seq;
81 };
82 #endif
83