]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
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 | #include <rte_mempool.h> | |
9 | ||
10 | /* | |
11 | * This file defines common macros and structs | |
12 | */ | |
13 | ||
14 | #define TIME_IN_RESET_COUNT 5 | |
15 | ||
16 | /* Default command timeout in seconds */ | |
17 | #define DEFAULT_COMMAND_TIMEOUT 4 | |
18 | ||
19 | #define CPT_COUNT_THOLD 32 | |
20 | #define CPT_TIMER_THOLD 0x3F | |
21 | ||
9f95a23c TL |
22 | #ifndef ROUNDUP4 |
23 | #define ROUNDUP4(val) (((val) + 3) & 0xfffffffc) | |
24 | #endif | |
25 | ||
26 | #ifndef ROUNDUP8 | |
27 | #define ROUNDUP8(val) (((val) + 7) & 0xfffffff8) | |
28 | #endif | |
29 | ||
30 | #ifndef ROUNDUP16 | |
31 | #define ROUNDUP16(val) (((val) + 15) & 0xfffffff0) | |
32 | #endif | |
33 | ||
9f95a23c TL |
34 | #define MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++) |
35 | ||
36 | struct cpt_qp_meta_info { | |
37 | struct rte_mempool *pool; | |
38 | int sg_mlen; | |
39 | int lb_mlen; | |
40 | }; | |
41 | ||
42 | struct rid { | |
43 | /** Request id of a crypto operation */ | |
44 | uintptr_t rid; | |
45 | }; | |
46 | ||
47 | /* | |
48 | * Pending queue structure | |
49 | * | |
50 | */ | |
51 | struct pending_queue { | |
52 | /** Pending requests count */ | |
53 | uint64_t pending_count; | |
54 | /** Array of pending requests */ | |
55 | struct rid *rid_queue; | |
56 | /** Tail of queue to be used for enqueue */ | |
57 | uint16_t enq_tail; | |
58 | /** Head of queue to be used for dequeue */ | |
59 | uint16_t deq_head; | |
60 | }; | |
61 | ||
62 | struct cpt_request_info { | |
63 | /** Data path fields */ | |
64 | uint64_t comp_baddr; | |
65 | volatile uint64_t *completion_addr; | |
66 | volatile uint64_t *alternate_caddr; | |
67 | void *op; | |
68 | struct { | |
69 | uint64_t ei0; | |
70 | uint64_t ei1; | |
71 | uint64_t ei2; | |
72 | uint64_t ei3; | |
73 | } ist; | |
f67539c2 | 74 | uint8_t *rptr; |
9f95a23c TL |
75 | |
76 | /** Control path fields */ | |
77 | uint64_t time_out; | |
78 | uint8_t extra_time; | |
79 | } __rte_cache_aligned; | |
80 | ||
81 | #endif /* _CPT_COMMON_H_ */ |