1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: Packet Buffers Free Manager
25 Desc: This file implements the funcitons required to isolate
26 freeing of packer buffers from Main stack processing. This will be
27 usefull in a hyper threaded environment where the freeing can be
28 done from low priority thread
32 Sid: ss_rbuf.x@@/main/TeNB_Main_BR/3 - Mon Aug 11 16:44:15 2014
36 *********************************************************************21*/
43 Void SsRngBufEnable ARGS((Void));
44 Void SsRngBufDisable ARGS((Void));
45 S16 SCreateSRngBuf ARGS((uint32_t id, Region region, Pool pool, uint32_t elmSize, uint32_t rngSize));
46 S16 SDestroySRngBuf ARGS((uint32_t id, Region region, Pool pool));
47 S16 SAttachSRngBuf ARGS((uint32_t id, uint32_t ent, uint32_t txRx));
48 S16 SEnqSRngBuf ARGS((uint32_t id, Void* elem));
49 S16 SDeqSRngBuf ARGS((uint32_t id, Void* elem));
50 Void* SRngGetWIndx ARGS((uint32_t rngId));
51 Void* SRngGetRIndx ARGS((uint32_t rngId));
52 Void SRngIncrRIndx ARGS((uint32_t rngId));
53 Void SRngIncrWIndx ARGS((uint32_t rngId));
54 S16 isRngEmpty ARGS((uint32_t rngId));
55 S16 SConnectSRngBuf ARGS((uint32_t id, uint32_t rxEnt));
56 S16 SGetNumElemInRng ARGS(( uint32_t id));
57 S16 SPrintSRngStats ARGS((Void));
58 S16 pjBatchProc ARGS((Void));
59 uint32_t ssRngBufStatus;
61 #define SS_RNG_BUF_STATUS() ssRngBufStatus
62 /* Ring Buffer Structure */
65 uint32_t size; /* Number of elements in a ring */
66 uint32_t read; /* Read Index incremented by Deque operation */
67 uint32_t write; /* Write index incremented by Enque operation */
68 uint32_t type; /* sizeof user specified ring element structure */
69 Void* elem; /* pointer to the allocated ring Elements */
79 /* Global Ring Buffer Info structure */
82 SsRngBuf* r_addr; // Address of allocated ring
83 uint32_t txEnt; // Tx Entity id
84 uint32_t rxEnt; // Rx Entity id
85 uint32_t n_write; // Number of Enque operations
86 uint32_t n_read; // Number of Deque operations
87 uint32_t nReadFail; // Number of Deque failures due to ring empty
88 uint32_t nWriteFail; // Number of Enque failures due to ring full
89 uint32_t rngState; /* Ring Buffer State */
90 uint32_t pktDrop; // Number of pkts dropped due to buffer full
91 uint32_t nPktProc; // Debug counter for pkts processed per tti
92 uint32_t pktRate; // Debug counter for icpu pkt rate
95 /* Global Structure for updating Ring buffer for Flow Control */
98 uint16_t dlRngBuffCnt; /* Dl Ring Buffer Count */
99 uint16_t ulRngBuffCnt; /* Ul Ring Buffer Count */
102 /* Ring Buffer Id Enum */
105 SS_RNG_BUF_DEBUG_COUNTER,
106 SS_RNG_BUF_ICPU_TO_DLPDCP,
107 SS_RNG_BUF_DLPDCP_TO_DLRLC,
108 SS_RNG_BUF_L2_RT_TO_FREE_MGR,
109 SS_RNG_BUF_L2_NRT_TO_FREE_MGR,
110 SS_RNG_BUF_PRC_L1D_TO_CL,
111 SS_RNG_BUF_PRC_FREE_TO_CL,
112 SS_RNG_BUF_ICPU_TO_DAM,
113 SS_RNG_BUF_L2_NRT_DLRLC_TO_FREE_MGR,
114 SS_RNG_BUF_ICPU_BATCH_START,
116 SS_RNG_BUF_ICPU_BATCH_END = SS_RNG_BUF_ICPU_BATCH_START + BC_BATCH_MGR_MAX_BKT,
118 #ifdef CIPH_BATCH_PROC
119 SS_RNG_BUF_DLPDCP_TO_CIPH,
120 SS_RNG_BUF_CIPH_TO_DLPDCP,
121 SS_RNG_BUF_ULPDCP_TO_CIPH,
122 SS_RNG_BUF_CIPH_TO_ULPDCP,
124 SS_RNG_BUF_ULMAC_TO_ULRLC,
125 SS_RNG_BUF_RX_TO_DLRLC,
126 SS_RNG_BUF_RX_TO_ULPDCP,
127 SS_RNG_BUF_DL_SMSG_REUSE,
128 SS_RNG_BUF_DLRLC_TO_DLMAC,
130 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_DAT_REQ_RBUF)
131 SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ,
132 SS_RNG_BUF_DLRLC_TO_DLMAC_STA_RSP,
133 SS_RNG_BUF_MAC_TO_RLC_HARQ_STA,
135 #ifdef MAC_FREE_RING_BUF
136 SS_RNG_BUF_MAC_FREE_RING,
138 #ifdef RLC_FREE_RING_BUF
139 SS_RNG_BUF_RLC_FREE_RING,
141 #ifdef LC_EGTP_THREAD
142 SS_RNG_BUF_EGTP_FREE_RING,
148 /* Ring Buffer User Entity Enum */
156 SS_RBUF_ENT_FREE_MGR,
159 SS_RBUF_ENT_PRC_FREE,
161 #ifdef CIPH_BATCH_PROC
168 SS_RBUF_ENT_ICCRX_DL,
170 SS_RBUF_ENT_DLRLC_DAT_REQ,
171 SS_RBUF_ENT_DLMAC_DAT_REQ,
172 SS_RBUF_ENT_DLRLC_STA_RSP,
173 SS_RBUF_ENT_DLMAC_STA_RSP,
174 SS_RBUF_ENT_MAC_HARQ_STA,
175 #ifdef MAC_FREE_RING_BUF
176 SS_RBUF_ENT_MAC_FREE_REQ,
177 SS_RBUF_ENT_MAC_BUF_FREE,
179 #ifdef RLC_FREE_RING_BUF
180 SS_RBUF_ENT_RLC_FREE_REQ,
181 SS_RBUF_ENT_RLC_BUF_FREE,
183 #ifdef LC_EGTP_THREAD
184 SS_RBUF_ENT_EGTP_FREE_REQ,
185 SS_RBUF_ENT_EGTP_BUF_FREE,
187 SS_RBUF_ENT_RLC_HARQ_STA
189 /* Ring Buffer State Enum */
202 /* User defined Ring Element structures */
208 SsRngBufTbl SsRngInfoTbl[SS_RNG_BUF_MAX];
210 #if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
211 S16 mtAddBufToRing(SsRngBufId ringId,void *bufPtr,uint8_t freeType);
212 #ifdef XEON_SPECIFIC_CHANGES
213 typedef struct rgKwBufFreeInfo
216 uint8_t freeType; /* 0- SPutMsg, 1->SPutStaticBuffer*/