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: RLC service user (PDCP) lower interface
25 Desc: This file Contains the RLC service user lower interface
26 primitive implementain
30 *********************************************************************21*/
32 /* header (.h) include files */
33 #include "envopt.h" /* environment options */
34 #include "envdep.h" /* environment dependent */
35 #include "envind.h" /* environment independent */
37 #include "gen.h" /* general */
38 #include "ssi.h" /* system services */
39 #include "cm5.h" /* common timer defines */
40 #include "cm_tkns.h" /* common tokens defines */
41 #include "cm_mblk.h" /* common memory allocation library defines */
42 #include "cm_llist.h" /* common link list defines */
43 #include "cm_hash.h" /* common hash list defines */
44 #include "cm_lte.h" /* common LTE defines */
45 #include "kwu.h" /* KWU defines */
48 /* extern (.x) include files */
49 #include "gen.x" /* general */
50 #include "ssi.x" /* system services */
51 //#if defined(PDCP_RLC_DL_RBUF)
54 #include "kwu.h" /* PJU */
59 #include "ss_timer.x" /* System services */
60 #include "ss_msg.h" /* System services */
61 #include "ss_msg.x" /* System services */
62 #include "ss_mem.h" /* System services */
63 #include "ss_mem.x" /* System services */
69 #include "cm5.x" /* common timer library */
70 #include "cm_tkns.x" /* common tokens */
71 #include "cm_mblk.x" /* common memory allocation */
72 #include "cm_llist.x" /* common link list */
73 #include "cm_hash.x" /* common hash list */
74 #include "cm_lte.x" /* common LTE includes */
75 #include "cm_lib.x" /* common memory allocation library */
76 #include "kwu.x" /* KWU */
79 PUBLIC U8 SUpdMbufMemInfo (Pst *pst,Buffer *mBuf);
80 #if defined(PDCP_RLC_DL_RBUF) && !defined(SS_RBUF)
81 PUBLIC S16 pjKwuRbufDatReq(Pst * pst,SpId spId,KwuDatReqInfo* datReq,Buffer * mBuf);
84 EXTERN S16 PtLiKwuBndReq ARGS ((
90 EXTERN S16 PtLiKwuUbndReq ARGS ((
96 EXTERN S16 PtLiKwuDiscSduReq ARGS ((
99 KwuDiscSduInfo *discSdu
102 EXTERN S16 PtLiKwuDatReq ARGS ((
105 KwuDatReqInfo *datReq,
109 /************************************************************************
110 KWU Interface Matrices
111 ************************************************************************/
113 PUBLIC KwuBndReq pjLiKwuBndReqMt [] =
116 cmPkKwuBndReq, /* 0 - loosely coupled */
118 PtLiKwuBndReq, /* 0 - loosely coupled, portable */
121 KwUiKwuBndReq, /* 1 - tightly coupled, stub layer */
123 PtLiKwuBndReq, /* 1 - tightly coupled, portable */
126 cmPkKwuBndReq, /* 3 - light weight loosely coupled */
128 PtLiKwuBndReq, /* 3 - light weight loosely coupled, portable */
132 PUBLIC KwuUbndReq pjLiKwuUbndReqMt [] =
135 cmPkKwuUbndReq, /* 0 - loosely coupled */
137 PtLiKwuUbndReq, /* 0 - loosely coupled, portable */
140 KwUiKwuUbndReq, /* 1 - tightly coupled, stub layer */
142 PtLiKwuUbndReq, /* 1 - tightly coupled, portable */
145 cmPkKwuUbndReq, /* 3 - light weight loosely coupled */
147 PtLiKwuUbndReq, /* 3 - light weight loosely coupled, portable */
151 PUBLIC KwuDatReq pjLiKwuDatReqMt [] =
154 cmPkKwuDatReq, /* 0 - loosely coupled */
156 PtLiKwuDatReq, /* 0 - loosely coupled, portable */
159 KwUiKwuDatReq, /* 1 - tightly coupled, stub layer */
161 PtLiKwuDatReq, /* 1 - tightly coupled, portable */
164 cmPkKwuDatReq, /* 3 - light weight loosely coupled */
166 PtLiKwuDatReq, /* 3 - light weight loosely coupled, portable */
170 PUBLIC KwuDiscSduReq pjLiKwuDiscSduReqMt [] =
173 cmPkKwuDiscSduReq, /* 0 - loosely coupled */
175 PtLiKwuDiscSduReq, /* 0 - loosely coupled, portable */
178 KwUiKwuDiscSduReq, /* 1 - tightly coupled, stub layer */
180 PtLiKwuDiscSduReq, /* 1 - tightly coupled, portable */
183 cmPkKwuDiscSduReq, /* 3 - light weight loosely coupled */
185 PtLiKwuDiscSduReq, /* 3 - light weight loosely coupled, portable */
190 /****************************************************************************
191 * KWU Interface Mt functions
192 ***************************************************************************/
197 * PjLiKwuBndReq - KWU SAP bind Request
199 * @param[in] pst - Post structure
200 * @param[in] suId - Service user SAP ID
201 * @param[in] spId - Service provider ID
207 PUBLIC S16 PjLiKwuBndReq
209 Pst *pst, /* post structure */
210 SuId suId, /* Service User Id */
211 SpId spId /* Service Provider Id */
214 PUBLIC S16 PjLiKwuBndReq(pst, suId, spId)
215 Pst *pst; /* post structure */
216 SuId suId; /* Service User Id */
217 SpId spId; /* Service Provider Id */
222 /* jump to specific primitive depending on configured selector */
223 (*pjLiKwuBndReqMt[pst->selector])(pst, suId, spId);
227 } /* end of PjLiKwuBndReq */
234 * PjLiKwuUbndReq - KWU SAP unbind Request
236 * @param[in] pst - Post structure
237 * @param[in] spId - Service provider SAP ID
238 * @param[in] reason - Reason
244 PUBLIC S16 PjLiKwuUbndReq
251 PUBLIC S16 PjLiKwuUbndReq(pst, spId, reason)
259 /* jump to specific primitive depending on configured selector */
260 (*pjLiKwuUbndReqMt[pst->selector])(pst, spId, reason);
264 } /* end of PjLiKwuUbndReq */
271 * PjLiKwuDatReq - KWU Data Request
273 * @param[in] pst - Post structure
274 * @param[in] spId - Service provider SAP ID
275 * @param[in] datReq - Data Request
281 PUBLIC S16 PjLiKwuDatReq
285 KwuDatReqInfo *datReq,
289 PUBLIC S16 PjLiKwuDatReq(pst, spId, datReq, mBuf)
292 KwuDatReqInfo *datReq;
299 #if defined(PDCP_RLC_DL_RBUF) && !defined(SS_RBUF)
300 if(datReq->lcType == CM_LTE_LCH_DTCH)
302 if((pjKwuRbufDatReq(pst,spId, datReq, mBuf)) != ROK)
304 /* Posting the message as ring buffer write failure */
311 /* jump to specific primitive depending on configured selector */
312 ret = (*pjLiKwuDatReqMt[pst->selector])(pst, spId, datReq, mBuf);
316 } /* end of PjLiKwuDatReq */
323 * PjLiKwuDiscSduReq - KWU Discard SDU Request
325 * @param[in] pst - Post structure
326 * @param[in] spId - Service provider SAP ID
327 * @param[in] datReq - Data Request
333 PUBLIC S16 PjLiKwuDiscSduReq
337 KwuDiscSduInfo *discSdu
340 PUBLIC S16 PjLiKwuDiscSduReq(pst, spId, discSdu)
343 KwuDiscSduInfo *discSdu;
346 TRC3(PjLiKwuDiscSduReq)
348 /* jump to specific primitive depending on configured selector */
349 (*pjLiKwuDiscSduReqMt[pst->selector])(pst, spId, discSdu);
353 } /* end of PjLiKwuDiscSduReq */
355 /****************************************************************************
357 ***************************************************************************/
362 * PtLiKwuBndReq - portable bind request
364 * @param[in] pst - Post structure
365 * @param[in] suId - Service user SAP ID
366 * @param[in] spId - Service provider ID
373 PUBLIC S16 PtLiKwuBndReq
380 PUBLIC S16 PtLiKwuBndReq(post, suId, spId)
387 #if (ERRCLASS & ERRCLS_DEBUG)
389 SLogError(post->srcEnt, post->srcInst, post->srcProcId,
390 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
391 (ErrVal)EPJXXX, (ErrVal)ERRZERO, "Improper selector for NhLiKwuBndReq\n");
393 #endif /* (ERRCLASS & ERRCLS_DEBUG) */
399 } /* end of PtLiKwuBndReq() */
406 * PtLiKwuUbndReq - portable unbind request
408 * @param[in] pst - Post structure
409 * @param[in] suId - Service provider SAP ID
410 * @param[in] reason - Reason
416 PUBLIC S16 PtLiKwuUbndReq
423 PUBLIC S16 PtLiKwuUbndReq(post, spId, reason)
430 #if (ERRCLASS & ERRCLS_DEBUG)
432 SLogError(post->srcEnt, post->srcInst, post->srcProcId,
433 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
434 (ErrVal)EPJXXX, (ErrVal)ERRZERO, "Improper selector for NhLiKwuUbndReq\n");
436 #endif /* (ERRCLASS & ERRCLS_DEBUG) */
442 } /* end of PtLiKwuUbndReq() */
448 * PtLiKwuDiscSduReq - portable discard SDU request
450 * @param[in] pst - Post structure
451 * @param[in] spId - Service provider SAP ID
452 * @param[in] datReq - Data Request
458 PUBLIC S16 PtLiKwuDiscSduReq
462 KwuDiscSduInfo *discSdu
465 PUBLIC S16 PtLiKwuDiscSduReq(post, spId, discSdu)
468 KwuDiscSduInfo *discSdu;
471 TRC3(PtLiKwuDiscSduReq)
472 #if (ERRCLASS & ERRCLS_DEBUG)
474 SLogError(post->srcEnt, post->srcInst, post->srcProcId,
475 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
476 (ErrVal)EKWU010, (ErrVal)ERRZERO, "Improper selector for NhLiKwuDiscSduReq\n");
479 #endif /* (ERRCLASS & ERRCLS_DEBUG) */
485 } /* end of PtLiKwuDiscSduReq() */
491 * PtLiKwuDatReq - portable data request
493 * @param[in] pst - Post structure
494 * @param[in] spId - Service provider SAP ID
495 * @param[in] datReq - Data Request
501 PUBLIC S16 PtLiKwuDatReq
505 KwuDatReqInfo *datReq,
509 PUBLIC S16 PtLiKwuDatReq(pst, spId, datReq, mBuf)
512 KwuDatReqInfo *datReq;
517 #if (ERRCLASS & ERRCLS_DEBUG)
519 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
520 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
521 (ErrVal)EPJXXX, (ErrVal)ERRZERO, "Improper selector for NhLiKwuDatReq\n");
523 #endif /* (ERRCLASS & ERRCLS_DEBUG) */
530 } /* end of PtLiKwuDatReq() */
533 * Fun: SUpdMbufMemInfo
535 * Desc: This function is used to get the mem region info of a task.
538 * RFAILED - failed, general (optional)
544 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
546 PUBLIC U8 SUpdMbufMemInfo
552 PUBLIC U8 SUpdMbufMemInfo(pst,mBuf)
562 minfo = (SsMsgInfo*) mBuf->b_rptr;
564 dstIdx = osCp.tTskIds[pst->dstEnt][pst->dstInst];
565 tTsk = &osCp.tTskTbl[dstIdx];
566 #ifdef SS_MULTICORE_SUPPORT
567 minfo->region = tTsk->sTsk->region;
568 #endif /* SS_MULTICORE_SUPPORT */
573 #if defined(PDCP_RLC_DL_RBUF) && !defined(SS_RBUF)
575 PUBLIC S16 pjKwuRbufDatReq
579 KwuDatReqInfo* datReq,
583 PUBLIC S16 pjKwuRbufDatReq(pst, spId, datReq, mBuf)
586 KwuDatReqInfo* datReq;
593 KwuDatReqDetl *kwuDatReqDetl = NULLP;
595 elem = SRngGetWIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
598 kwuDatReqDetl = (KwuDatReqDetl *) elem;
599 kwuDatReqDetl->spId = spId;
600 kwuDatReqDetl->lcType = datReq->lcType;
601 kwuDatReqDetl->sduId = datReq->sduId;
602 kwuDatReqDetl->rlcId = datReq->rlcId;
603 kwuDatReqDetl->mBuf = mBuf;
604 /* Commenting below function because memory region mapped with threadId*/
605 /* SUpdMbufMemInfo(pst, mBuf);*/
606 SRngIncrWIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
607 SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].pktRate++;
611 #if (ERRCLASS & ERRCLS_DEBUG)
612 SLogError(ENTPJ, 0, SFndProcId(),
613 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
614 (ErrVal)EPJXXX, (ErrVal)ERRZERO, "PDCP-DL RBUF is FULL!!!\n");
615 #endif /* (ERRCLASS & ERRCLS_DEBUG) */
616 SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].pktDrop++;
620 } /* cmPkKwuDatReq */
622 #endif /* PDCP_RLC_DL_RBUF */
625 /********************************************************************30**
627 **********************************************************************/