crypto/octeontx: add session management operations
[dpdk.git] / drivers / common / cpt / cpt_common.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Cavium, Inc
3  */
4
5 #ifndef _CPT_COMMON_H_
6 #define _CPT_COMMON_H_
7
8 /*
9  * This file defines common macros and structs
10  */
11
12 /*
13  * Macros to determine CPT model. Driver makefile will define CPT_MODEL
14  * accordingly
15  */
16 #define CRYPTO_OCTEONTX         0x1
17
18 #define CPT_COUNT_THOLD         32
19 #define CPT_TIMER_THOLD         0x3F
20
21 #define AE_TYPE 1
22 #define SE_TYPE 2
23
24 #ifndef ROUNDUP4
25 #define ROUNDUP4(val)   (((val) + 3) & 0xfffffffc)
26 #endif
27
28 #ifndef ROUNDUP8
29 #define ROUNDUP8(val)   (((val) + 7) & 0xfffffff8)
30 #endif
31
32 #ifndef ROUNDUP16
33 #define ROUNDUP16(val)  (((val) + 15) & 0xfffffff0)
34 #endif
35
36 #ifndef __hot
37 #define __hot __attribute__((hot))
38 #endif
39
40 #define MOD_INC(i, l)   ((i) == (l - 1) ? (i) = 0 : (i)++)
41
42 struct cptvf_meta_info {
43         void *cptvf_meta_pool;
44         int cptvf_op_mlen;
45         int cptvf_op_sb_mlen;
46 };
47
48 struct rid {
49         /** Request id of a crypto operation */
50         uintptr_t rid;
51 };
52
53 /*
54  * Pending queue structure
55  *
56  */
57 struct pending_queue {
58         /** Tail of queue to be used for enqueue */
59         uint16_t enq_tail;
60         /** Head of queue to be used for dequeue */
61         uint16_t deq_head;
62         /** Array of pending requests */
63         struct rid *rid_queue;
64         /** Pending requests count */
65         uint64_t pending_count;
66 };
67
68 struct cpt_request_info {
69         /** Data path fields */
70         uint64_t comp_baddr;
71         volatile uint64_t *completion_addr;
72         volatile uint64_t *alternate_caddr;
73         void *op;
74         struct {
75                 uint64_t ei0;
76                 uint64_t ei1;
77                 uint64_t ei2;
78                 uint64_t ei3;
79         } ist;
80
81         /** Control path fields */
82         uint64_t time_out;
83         uint8_t extra_time;
84 };
85
86 #endif /* _CPT_COMMON_H_ */