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