xref: /dpdk/drivers/crypto/bcmfs/bcmfs_sym_req.h (revision cd5db556ace9f01521a039a75f0b1a35cfcd6bcb)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Broadcom
3  * All rights reserved.
4  */
5 
6 #ifndef _BCMFS_SYM_REQ_H_
7 #define _BCMFS_SYM_REQ_H_
8 
9 #include <rte_cryptodev.h>
10 
11 #include "bcmfs_dev_msg.h"
12 #include "bcmfs_sym_defs.h"
13 
14 /** Max variable length. Since we adjust AAD
15  * in same BD if it is less than BCMFS_AAD_THRESH_LEN
16  * so we add it here.
17  */
18 #define BCMFS_MAX_OMDMD_LEN	((2 * (BCMFS_MAX_KEY_SIZE)) +	\
19 				 (2 * (BCMFS_MAX_IV_SIZE)) +	\
20 				 (BCMFS_AAD_THRESH_LEN))
21 
22 /* Fixed SPU2 Metadata */
23 struct spu2_fmd {
24 	uint64_t ctrl0;
25 	uint64_t ctrl1;
26 	uint64_t ctrl2;
27 	uint64_t ctrl3;
28 };
29 
30 /*
31  * This structure hold the supportive data required to process a
32  * rte_crypto_op
33  */
34 struct bcmfs_sym_request {
35 	/*
36 	 * Only single BD for metadata so
37 	 * FMD + OMD must be in continuation
38 	 */
39 	/* spu2 engine related data */
40 	struct spu2_fmd fmd;
41 	/* variable metadata in continuation with fmd */
42 	uint8_t omd[BCMFS_MAX_OMDMD_LEN];
43 	/* digest data output from crypto h/w */
44 	uint8_t digest[BCMFS_MAX_DIGEST_SIZE];
45 	/* 2-Bytes response from crypto h/w */
46 	uint8_t resp[2];
47 	/*
48 	 * Below are all iovas for above members
49 	 * from top
50 	 */
51 	/* iova for fmd */
52 	rte_iova_t fptr;
53 	/* iova for omd */
54 	rte_iova_t optr;
55 	/* iova for digest */
56 	rte_iova_t dptr;
57 	/* iova for response */
58 	rte_iova_t rptr;
59 	/* bcmfs qp message for h/w queues to process */
60 	struct bcmfs_qp_message msgs;
61 	/* crypto op */
62 	struct rte_crypto_op *op;
63 };
64 
65 #endif /* _BCMFS_SYM_REQ_H_ */
66