kbp_xpt.h (2580B)
1 /** \file kbp_xpt.h 2 * 3 * Functions and defines for handling jericho2 kbp xpt function. 4 */ 5 /* 6 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 7 * 8 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 9 */ 10 #if defined(INCLUDE_KBP) 11 12 #ifndef _KBP_XPT_INCLUDED__ 13 /* 14 * { 15 */ 16 17 #define _KBP_XPT_INCLUDED__ 18 19 /************* 20 * INCLUDES * 21 */ 22 /* 23 * { 24 */ 25 26 #include <soc/kbp/alg_kbp/include/default_allocator.h> 27 #include <soc/kbp/alg_kbp/include/xpt_12k.h> 28 #include <soc/kbp/alg_kbp/include/xpt_op.h> 29 30 /* 31 * } 32 */ 33 34 /************* 35 * DEFINES * 36 */ 37 /* 38 * { 39 */ 40 41 /* 42 * } 43 */ 44 /************* 45 * MACROS * 46 */ 47 /* 48 * { 49 */ 50 51 #define NlmXpt kbp_xpt 52 #define NlmXptRqt kbp_xpt_rqt 53 #define NlmRequestId kbp_xpt_rqt_id 54 #define NlmXpt_operations kbp_xpt_operations 55 56 /* 57 * } 58 */ 59 60 /************* 61 * ENUMS * 62 */ 63 /* 64 * { 65 */ 66 67 /* 68 * } 69 */ 70 71 /************* 72 * TYPE DEFS * 73 */ 74 /* 75 * { 76 */ 77 78 /* NlmXptRqtQue is a list of requests */ 79 typedef struct NlmDnxXptRqt_t 80 { 81 NlmXptRqt m_nlm_rqt; 82 /* 83 * If the request is serviced 84 */ 85 NlmBool m_done; 86 /* 87 * Request id assigned by the xpt 88 */ 89 NlmRequestId m_rqt_id; 90 struct NlmDnxXptRqt_t *next; 91 nlm_u32 dnxxpt_rqt_magic; 92 93 } NlmDnxXptRqt; 94 95 typedef struct NlmXptRqtQue_t 96 { 97 /* 98 * how many results on the que 99 */ 100 nlm_u32 count; 101 /* 102 * head of the queue 103 */ 104 NlmDnxXptRqt *head; 105 /* 106 * tail of the queue 107 */ 108 NlmDnxXptRqt *tail; 109 110 } NlmXptRqtQue; 111 112 typedef struct NlmDnxXpt_t 113 { 114 /* 115 * Pointer to virtual xpt object 116 */ 117 NlmXpt *xpt; 118 /* 119 * General purpose memory Allocator 120 */ 121 NlmCmAllocator *m_alloc_p; 122 /* 123 * Max request count 124 */ 125 nlm_u32 m_max_rqt_count; 126 /* 127 * Max rslt cnt 128 */ 129 nlm_u32 m_max_rslt_count; 130 /* 131 * Request being used 132 */ 133 NlmXptRqtQue m_in_use_requests; 134 /* 135 * Free requests 136 */ 137 NlmXptRqtQue m_free_requests; 138 /* 139 * Used for storing a single request in flat xpt without queuing 140 */ 141 NlmDnxXptRqt *m_single_rqt_p; 142 NlmRequestId m_next_rqt_id; 143 nlm_u32 dnxxpt_magic; 144 /* 145 * Unit and Core number of DNX side 146 */ 147 int unit; 148 int core; 149 } NlmDnxXpt; 150 151 /* 152 * } 153 */ 154 155 /************* 156 * GLOBALS * 157 */ 158 /* 159 * { 160 */ 161 /* 162 * } 163 */ 164 /************* 165 * FUNCTIONS * 166 */ 167 /* 168 * { 169 */ 170 shr_error_e dnx_kbp_xpt_init( 171 int unit); 172 173 shr_error_e dnx_kbp_xpt_deinit( 174 int unit); 175 176 /* 177 * } 178 */ 179 #endif /* __KBP_XPT_INCLUDED__ */ 180 #endif /* defined(INCLUDE_KBP) */