+/*******************************************************************
+ *
+ * @brief
+ * Handler for storing all DL PDU Info into RLC-MAC interface
+ * struct and sending to lower interface
+ *
+ * @details
+ * This function stores DL PDU info for all logical channels
+ * of per UE grant per TTI and sends to MAC
+ *
+ * Function : KwLiRguDDatReq
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+#ifdef ANSI
+PUBLIC S16 KwLiRguDDatReq
+(
+Pst *post,
+SpId spId,
+RguDDatReqInfo *datReqInfo
+)
+#else
+PUBLIC S16 KwLiRguDDatReq(post, spId, datReqInfo)
+Pst *post;
+SpId spId;
+RguDDatReqInfo *datReqInfo;
+#endif
+{
+ U8 ueIdx; /* UE info list iterator */
+ U8 tbIdx; /* TB info list iterator */
+ U8 lchIdx; /* Lch info list iterator */
+ U8 pduIdx; /* RLC PDU list iterator */
+ RguDDatReqPerUe datPerUe; /* DL data info per UE */
+ RguDatReqTb datPerTb; /* DL data info per TB */
+ RguLchDatReq datPerLch; /* DL data info per Lch */
+ RlcMacData *dlData; /* DL data to be sent to MAC */
+
+ TRC3(KwLiRguDDatReq)
+
+ dlData = NULLP;
+ KW_ALLOC_SHRABL_BUF(post->region, post->pool,
+ dlData, sizeof(RlcMacData));
+#if (ERRCLASS & ERRCLS_ADD_RES)
+ if ( datReqInfo == NULLP )
+ {
+ RLOG0(L_FATAL,"Memory allocation failed");
+ RETVALUE(RFAILED);
+ }
+#endif /* ERRCLASS & ERRCLS_ADD_RES */
+
+ for(ueIdx = 0; ueIdx < datReqInfo->nmbOfUeGrantPerTti; ueIdx++)
+ {
+ datPerUe = datReqInfo->datReq[ueIdx];
+
+ cmMemset((U8 *)dlData, 0, sizeof(RlcMacData));
+
+ dlData->cellId = datReqInfo->cellId;
+ dlData->rnti = datPerUe.rnti;
+ //dlData->timeToTx = datPerUe.transId; /* Derive timing info from transId */
+ dlData->nmbPdu = 0;
+
+ for(tbIdx = 0; tbIdx < datPerUe.nmbOfTbs; tbIdx++)
+ {
+ datPerTb = datPerUe.datReqTb[tbIdx];
+ for(lchIdx = 0; lchIdx < datPerTb.nmbLch; lchIdx++)
+ {
+ datPerLch = datPerTb.lchData[lchIdx];
+ for(pduIdx = 0; pduIdx < datPerLch.pdu.numPdu; pduIdx++)
+ {
+ dlData->pduInfo[dlData->nmbPdu].commCh = FALSE;
+ dlData->pduInfo[dlData->nmbPdu].lcId = datPerLch.lcId;
+ dlData->pduInfo[dlData->nmbPdu].pduBuf = datPerLch.pdu.mBuf[pduIdx];
+ dlData->nmbPdu++;
+ }/* For per PDU */
+ }/* For Data per Lch */
+ }/* For Data per Tb */
+ RlcMacSendDlData(post, spId, dlData);
+ } /* For Data per UE */
+
+ /* Check if to be freed here */
+
+ KW_FREE_SHRABL_BUF(post->region,
+ post->pool,
+ datReqInfo, sizeof(RguDDatReqInfo));
+
+ RETVALUE(ROK);
+}/* End of KwLiRguDDatReq */
+