X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_mux.c;h=05ae55caa6d044b952e3623edc9a0b505271880f;hb=bb267bb17ec2897af706e7307790d3b1e5b3ea8d;hp=affdac2e7fac27bfa949c357e1250bb36c647ecd;hpb=79661a503b0e6bcbe20fe0e19eb920110ab35242;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_mux.c b/src/5gnrmac/mac_mux.c index affdac2e7..05ae55caa 100644 --- a/src/5gnrmac/mac_mux.c +++ b/src/5gnrmac/mac_mux.c @@ -208,45 +208,6 @@ void fillRarPdu(RarInfo *rarInfo) } -/******************************************************************* - * - * @brief Database required to form MAC PDU - * - * @details - * - * Function : createMacRaCb - * - * Functionality: - * stores the required params for muxing - * - * @params[in] Pointer to cellId, - * crnti - * @return void - * - * ****************************************************************/ -void createMacRaCb(RachIndInfo *rachIndInfo) -{ - uint8_t ueIdx = 0; - uint16_t crnti = 0; - uint16_t cellIdx = 0; - - GET_CELL_IDX(rachIndInfo->cellId, cellIdx); - - crnti = getNewCrnti(&macCb.macCell[cellIdx]->crntiMap); - if(crnti == -1) - return; - - GET_UE_IDX(crnti, ueIdx); - ueIdx = ueIdx -1; - - /* store in rach ind structure */ - rachIndInfo->crnti = crnti; - - /* store in raCb */ - macCb.macCell[cellIdx]->macRaCb[ueIdx].cellId = rachIndInfo->cellId; - macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti = crnti; -} - /************************************************* * @brief fill RLC DL Data * @@ -311,7 +272,7 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t { uint16_t bytePos = 0; uint8_t bitPos = 7; - uint8_t idx = 0; + uint8_t pduIdx = 0; uint8_t macPdu[tbSize]; memset(macPdu, 0, (tbSize * sizeof(uint8_t))); @@ -330,62 +291,62 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t /* PACK ALL MAC CE */ if(macCeData != NULLP) { - for(idx = 0; idx < macCeData->numCes; idx++) + for(pduIdx = 0; pduIdx < macCeData->numCes; pduIdx++) { - lcid = macCeData->macCe[idx].macCeLcid; - switch(lcid) - { - case MAC_LCID_CRI: - { - /* Packing fields into MAC PDU R/R/LCID */ - packBytes(macPdu, &bytePos, &bitPos, RBit, (RBitSize * 2)); - packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize); - memcpy(&macPdu[bytePos], macCeData->macCe[idx].macCeValue,\ - MAX_CRI_SIZE); - bytePos += MAX_CRI_SIZE; - break; - } - default: - DU_LOG("\nERROR --> MAC: Invalid LCID %d in mac pdu",lcid); - break; - } + lcid = macCeData->macCe[pduIdx].macCeLcid; + switch(lcid) + { + case MAC_LCID_CRI: + { + /* Packing fields into MAC PDU R/R/LCID */ + packBytes(macPdu, &bytePos, &bitPos, RBit, (RBitSize * 2)); + packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize); + memcpy(&macPdu[bytePos], macCeData->macCe[pduIdx].macCeValue,\ + MAX_CRI_SIZE); + bytePos += MAX_CRI_SIZE; + break; + } + default: + DU_LOG("\nERROR --> MAC: Invalid LCID %d in mac pdu",lcid); + break; + } } } /* PACK ALL MAC SDUs */ - for(idx = 0; idx < dlData->numPdu; idx++) + for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++) { - lcid = dlData->pduInfo[idx].lcId; + lcid = dlData->pduInfo[pduIdx].lcId; switch(lcid) { - case MAC_LCID_CCCH: - case MAC_LCID_MIN ... MAC_LCID_MAX : - { - lenField = dlData->pduInfo[idx].pduLen; - if(dlData->pduInfo[idx].pduLen > 255) - { - FBit = 1; - lenFieldSize = 16; - - } - else - { - FBit = 0; - lenFieldSize = 8; - } - /* Packing fields into MAC PDU R/F/LCID/L */ - packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize); - packBytes(macPdu, &bytePos, &bitPos, FBit, FBitSize); - packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize); - packBytes(macPdu, &bytePos, &bitPos, lenField, lenFieldSize); - memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField); - bytePos += lenField; - break; - } - - default: - DU_LOG("\nERROR --> MAC: Invalid LCID %d in mac pdu",lcid); - break; + case MAC_LCID_CCCH: + case MAC_LCID_MIN ... MAC_LCID_MAX : + { + lenField = dlData->pduInfo[pduIdx].pduLen; + if(dlData->pduInfo[pduIdx].pduLen > 255) + { + FBit = 1; + lenFieldSize = 16; + + } + else + { + FBit = 0; + lenFieldSize = 8; + } + /* Packing fields into MAC PDU R/F/LCID/L */ + packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize); + packBytes(macPdu, &bytePos, &bitPos, FBit, FBitSize); + packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize); + packBytes(macPdu, &bytePos, &bitPos, lenField, lenFieldSize); + memcpy(&macPdu[bytePos], dlData->pduInfo[pduIdx].dlPdu, lenField); + bytePos += lenField; + break; + } + + default: + DU_LOG("\nERROR --> MAC: Invalid LCID %d in mac pdu",lcid); + break; } } if(bytePos < tbSize && (tbSize-bytePos >= 1))