* ****************************************************************/
uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
{
- uint8_t pduIdx =0;
+ uint8_t pduIdx = 0;
uint8_t lcIdx = 0;
- uint8_t *txPdu =NULLP;
- uint16_t tbSize =0,cellIdx=0;
+ uint8_t *txPdu = NULLP;
+ uint16_t cellIdx = 0, txPduLen = 0;
MacDlData macDlData;
MacDlSlot *currDlSlot = NULLP;
DlRlcBoInfo dlBoInfo;
currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlData->slotInfo.slot];
if(currDlSlot->dlInfo.dlMsgAlloc)
{
- tbSize = currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg.codeword[0].tbSize;
- MAC_ALLOC(txPdu, tbSize);
+ txPduLen = currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg.codeword[0].tbSize - TX_PAYLOAD_HDR_LEN;
+ MAC_ALLOC(txPdu, txPduLen);
if(!txPdu)
{
DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcRlcDlData");
return RFAILED;
}
- macMuxPdu(&macDlData, NULLP, txPdu, tbSize);
+ macMuxPdu(&macDlData, NULLP, txPdu, txPduLen);
- currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen = tbSize;
+ currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen = txPduLen;
currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu = txPdu;
}
if(dlCcchIndInfo->msgType == RRC_SETUP)
{
dlBoInfo.lcId = SRB0_LCID; // SRB ID 0 for msg4
- /* (MSG4 pdu + 3 bytes sub-header) + (Contention resolution id MAC CE + 1b byte sub-header) */
+ /* (MSG4 pdu + 3 bytes sub-header) + (Contention resolution id MAC CE + 1 byte sub-header) */
dlBoInfo.dataVolume = (dlCcchIndInfo->dlCcchMsgLen + 3) + (MAX_CRI_SIZE + 1);
/* storing Msg4 Pdu in raCb */
void fillRarPdu(RarInfo *rarInfo)
{
uint8_t *rarPdu = rarInfo->rarPdu;
- uint16_t totalBits = 0;
- uint8_t numBytes = 0;
uint16_t bytePos= 0;
uint8_t bitPos = 0;
timeAdv = rarInfo->ta;
ulGrant = 0; /* this will be done when implementing msg3 */
tmpCrnti = rarInfo->tcrnti;
-
- /* Calulating total number of bytes in buffer */
- totalBits = EBitSize + TBitSize + rapidSize + RBitSize + timeAdvSize \
- + ulGrantSize + tmpCrntiSize;
-
- /* add padding size */
- totalBits += RBitSize*2 + paddingLcidSize + paddingSize;
-
- /* Calulating total number of bytes in buffer */
- numBytes = totalBits/8;
- if(totalBits % 8)
- numBytes += 1;
-
- rarInfo->rarPduLen = numBytes;
+ rarInfo->rarPduLen = RAR_PAYLOAD_SIZE;
/* Initialize buffer */
- for(bytePos = 0; bytePos < numBytes; bytePos++)
+ for(bytePos = 0; bytePos < rarInfo->rarPduLen; bytePos++)
rarPdu[bytePos] = 0;
bytePos = 0;
{
uint8_t ueIdx;
uint16_t cellIdx;
+ uint16_t msg4TxPduLen;
MacDlData msg4DlData;
MacCeInfo macCeData;
GET_UE_IDX(msg4Alloc->dlMsgInfo.crnti, ueIdx);
ueIdx = ueIdx -1;
+
+ if(macCb.macCell[cellIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC: Cell Id[%d] not found", cellId);
+ return;
+ }
+
if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu != NULLP)
{
- MAC_ALLOC(msg4DlData.pduInfo[ueIdx].dlPdu, \
- macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
+ MAC_ALLOC(msg4DlData.pduInfo[ueIdx].dlPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
if(msg4DlData.pduInfo[ueIdx].dlPdu != NULLP)
{
- fillMsg4DlData(&msg4DlData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen,\
+ msg4TxPduLen = macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize - TX_PAYLOAD_HDR_LEN;
+
+ fillMsg4DlData(&msg4DlData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen, \
macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu);
- fillMacCe(&macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg3Pdu);
- /* Forming Mux Pdu */
- macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu = NULLP;
- MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, \
- macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize);
- if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu != NULLP)
- {
- memset(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, 0, \
- macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize);
- macMuxPdu(&msg4DlData, &macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu,\
- macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize);
-
- }
- else
- {
- DU_LOG("\nERROR --> MAC: Failed allocating memory for msg4TxPdu");
- }
- /* Free memory allocated */
- MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
+ fillMacCe(&macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg3Pdu);
+ /* Forming Mux Pdu */
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu = NULLP;
+ MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, msg4TxPduLen);
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu != NULLP)
+ {
+ memset(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, 0, msg4TxPduLen);
+ macMuxPdu(&msg4DlData, &macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, msg4TxPduLen);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Failed allocating memory for msg4TxPdu");
+ }
+ /* Free memory allocated */
+ MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
}
}
/* storing msg4 Pdu in macDlSlot */
if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu)
{
- msg4Alloc->dlMsgInfo.dlMsgPduLen = macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize;
+ msg4Alloc->dlMsgInfo.dlMsgPduLen = msg4TxPduLen;
MAC_ALLOC(msg4Alloc->dlMsgInfo.dlMsgPdu, msg4Alloc->dlMsgInfo.dlMsgPduLen);
if(msg4Alloc->dlMsgInfo.dlMsgPdu != NULLP)
{
- memcpy(msg4Alloc->dlMsgInfo.dlMsgPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, \
- msg4Alloc->dlMsgInfo.dlMsgPduLen);
+ memcpy(msg4Alloc->dlMsgInfo.dlMsgPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, \
+ msg4Alloc->dlMsgInfo.dlMsgPduLen);
}
}
else
#define DMRS_ADDITIONAL_POS 0
#define SCH_DEFAULT_K1 1
#define SCH_TQ_SIZE 10
-#define SCH_RAR_PAYLOAD_SIZE 10 /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */
#define CRC_FAILED 0
#define CRC_PASSED 1
pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
pdsch->codeword[cwCount].rvIndex = 0;
/* RAR PDU length and FAPI payload header length */
- tbSize = schCalcTbSize(SCH_RAR_PAYLOAD_SIZE + TX_PAYLOAD_HDR_LEN);
+ tbSize = schCalcTbSize(RAR_PAYLOAD_SIZE + TX_PAYLOAD_HDR_LEN);
pdsch->codeword[cwCount].tbSize = tbSize;
}
pdsch->dataScramblingId = pci;
#define MAX_NUM_DL_DATA_TO_UL_ACK 15
#define SD_SIZE 3
+#define RAR_PAYLOAD_SIZE 10 /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */
#define TX_PAYLOAD_HDR_LEN 32 /* Intel L1 requires adding a 32 byte header to transmitted payload */
+
#define ADD_DELTA_TO_TIME(crntTime, toFill, incr) \
{ \
if ((crntTime.slot + incr) > (MAX_SLOTS - 1)) \
uint16_t ta;
FreqDomainAlloc msg3FreqAlloc;
uint16_t tcrnti;
- uint8_t rarPdu[8];
+ uint8_t rarPdu[RAR_PAYLOAD_SIZE];
uint8_t rarPduLen;
}RarInfo;