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 extern Void SsRngBufEnable ARGS((Void));
44 extern Void SsRngBufDisable ARGS((Void));
45 extern S16 SCreateSRngBuf ARGS((U32 id, Region region, Pool pool, U32 elmSize, U32 rngSize));
46 extern S16 SDestroySRngBuf ARGS((U32 id, Region region, Pool pool));
47 extern S16 SAttachSRngBuf ARGS((U32 id, U32 ent, U32 txRx));
48 extern S16 SEnqSRngBuf ARGS((U32 id, Void* elem));
49 extern S16 SDeqSRngBuf ARGS((U32 id, Void* elem));
50 extern Void* SRngGetWIndx ARGS((U32 rngId));
51 extern Void* SRngGetRIndx ARGS((U32 rngId));
52 extern Void SRngIncrRIndx ARGS((U32 rngId));
53 extern Void SRngIncrWIndx ARGS((U32 rngId));
54 extern S16 isRngEmpty ARGS((U32 rngId));
55 extern S16 SConnectSRngBuf ARGS((U32 id, U32 rxEnt));
56 EXTERN S16 SGetNumElemInRng ARGS(( U32 id));
57 extern S16 SPrintSRngStats ARGS((Void));
58 extern S16 pjBatchProc ARGS((Void));
59 extern U32 ssRngBufStatus;
61 #define SS_RNG_BUF_STATUS() ssRngBufStatus
62 /* Ring Buffer Structure */
65 U32 size; /* Number of elements in a ring */
66 U32 read; /* Read Index incremented by Deque operation */
67 U32 write; /* Write index incremented by Enque operation */
68 U32 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 U32 txEnt; // Tx Entity id
84 U32 rxEnt; // Rx Entity id
85 U32 n_write; // Number of Enque operations
86 U32 n_read; // Number of Deque operations
87 U32 nReadFail; // Number of Deque failures due to ring empty
88 U32 nWriteFail; // Number of Enque failures due to ring full
89 U32 rngState; /* Ring Buffer State */
90 U32 pktDrop; // Number of pkts dropped due to buffer full
91 U32 nPktProc; // Debug counter for pkts processed per tti
92 U32 pktRate; // Debug counter for icpu pkt rate
95 /* Global Structure for updating Ring buffer for Flow Control */
98 U16 dlRngBuffCnt; /* Dl Ring Buffer Count */
99 U16 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 EXTERN SsRngBufTbl SsRngInfoTbl[SS_RNG_BUF_MAX];
210 #if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
211 extern S16 mtAddBufToRing(SsRngBufId ringId,void *bufPtr,U8 freeType);
212 #ifdef XEON_SPECIFIC_CHANGES
213 typedef struct rgKwBufFreeInfo
216 U8 freeType; /* 0- SPutMsg, 1->SPutStaticBuffer*/