| 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 |
/* New members MUST be added within the struct_group() macro below. */ |
| 36 |
struct_group_tagged(nfp_crypto_req_add_front_hdr, __hdr, |
| 37 |
struct nfp_ccm_hdr hdr; |
| 38 |
__be32 ep_id; |
| 39 |
u8 resv[3]; |
| 40 |
u8 opcode; |
| 41 |
u8 key_len; |
| 42 |
__be16 ipver_vlan __packed; |
| 43 |
u8 l4_proto; |
| 44 |
); |
| 45 |
#define NFP_NET_TLS_NON_ADDR_KEY_LEN 8 |
| 46 |
u8 l3_addrs[]; |
| 47 |
}; |
| 48 |
static_assert(offsetof(struct nfp_crypto_req_add_front, l3_addrs) == |
| 49 |
sizeof(struct nfp_crypto_req_add_front_hdr), |
| 50 |
"struct member likely outside of struct_group_tagged()"); |
| 51 |
|
| 52 |
struct nfp_crypto_req_add_back { |
| 53 |
__be16 src_port; |
| 54 |
__be16 dst_port; |
| 55 |
__be32 key[8]; |
| 56 |
__be32 salt; |
| 57 |
__be32 iv[2]; |
| 58 |
__be32 counter; |
| 59 |
__be32 rec_no[2]; |
| 60 |
__be32 tcp_seq; |
| 61 |
}; |
| 62 |
|
| 63 |
struct nfp_crypto_req_add_v4 { |
| 64 |
struct nfp_crypto_req_add_front_hdr front; |
| 65 |
__be32 src_ip; |
| 66 |
__be32 dst_ip; |
| 67 |
struct nfp_crypto_req_add_back back; |
| 68 |
}; |
| 69 |
|
| 70 |
struct nfp_crypto_req_add_v6 { |
| 71 |
struct nfp_crypto_req_add_front_hdr front; |
| 72 |
__be32 src_ip[4]; |
| 73 |
__be32 dst_ip[4]; |
| 74 |
struct nfp_crypto_req_add_back back; |
| 75 |
}; |
| 76 |
|
| 77 |
struct nfp_crypto_reply_add { |
| 78 |
struct nfp_ccm_hdr hdr; |
| 79 |
__be32 error; |
| 80 |
__be32 handle[2]; |
| 81 |
}; |
| 82 |
|
| 83 |
struct nfp_crypto_req_del { |
| 84 |
struct nfp_ccm_hdr hdr; |
| 85 |
__be32 ep_id; |
| 86 |
__be32 handle[2]; |
| 87 |
}; |
| 88 |
|
| 89 |
struct nfp_crypto_req_update { |
| 90 |
struct nfp_ccm_hdr hdr; |
| 91 |
__be32 ep_id; |
| 92 |
u8 resv[3]; |
| 93 |
u8 opcode; |
| 94 |
__be32 handle[2]; |
| 95 |
__be32 rec_no[2]; |
| 96 |
__be32 tcp_seq; |
| 97 |
}; |
| 98 |
#endif |