X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fphy_stub%2Fphy_stub_msg_hdl.c;h=98fa2a65281e666e358fa883e09d2a836a9705e2;hb=3330932565e15a749fd5dd5039cdea2862ca51cc;hp=b5fb1ac5a8b4fdee5e4be7044c342cfb8d926d73;hpb=864388c152b7ec5be79af26c224e8135d899dff5;p=o-du%2Fl2.git diff --git a/src/phy_stub/phy_stub_msg_hdl.c b/src/phy_stub/phy_stub_msg_hdl.c index b5fb1ac5a..98fa2a652 100644 --- a/src/phy_stub/phy_stub_msg_hdl.c +++ b/src/phy_stub/phy_stub_msg_hdl.c @@ -1023,7 +1023,7 @@ S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg) numPdus--; } - if(rachIndSent == false && ulTtiReq->sfn == 2 && ulTtiReq->slot == 6) + if(rachIndSent == false && ulTtiReq->sfn == 16 && ulTtiReq->slot == 6) { rachIndSent = true; l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn); @@ -1317,20 +1317,23 @@ uint8_t l1SendUlUserData() /* Filling PDU */ pdu = (uint8_t *)pduInfo->pduData; - msgLen = 51; + msgLen = 52; /* For UL User data MAC subheader format is R/F/LCId/L (2/3 bytes) LCId is 4 for DRB1 L is length of PDU i.e 50 bytes From 38.321 section 6.1.1 + From 38.322 section 6.2.2.4, 6.2.2.3 for AM, UM Header */ - uint8_t ulMsg[] = {4, msgLen, 0, 69, 0, 0, 50, 0, 0, 0, 0, 0, 1, 0, 0, 192, 168, 130, 81, 192, 168, 130, 82, 84, 104, - 105, 115, 32, 105, 115, 32, 69, 71, 84, 80, 32, 100, 97, 116, 97, 32, 102, 114, 111, 109, 32, 68, 85, 0, 0, 0, 0, 0}; - msgLen += 2; /* 2bytes of header */ - memcpy(pdu, &ulMsg, msgLen); - byteIdx += msgLen; /* 2 bytes of header */ + /* Below ulMsg supports 12bit SN for UM mode */ + /* SI SN */ + uint8_t ulMsg[] = {4, msgLen, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 1, 0, 0, 192, 168, 130, 81, 192, 168, 130, 82, 84, 104, + 105, 115, 32, 105, 115, 32, 69, 71, 84, 80, 32, 100, 97, 116, 97, 32, 102, 114, 111, 109, 32, 68, 85, 0, 0, 0, 0, 0}; + msgLen += 2; /* 2bytes of header */ + memcpy(pdu, &ulMsg, msgLen); + byteIdx += msgLen; /* 2 bytes of header */ /* Filling MAC SDU for Padding bytes*/ if(byteIdx < pduInfo->pdu_length) @@ -1350,7 +1353,7 @@ uint8_t l1SendUlUserData() fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen); /* Send Message to peer */ - while(cnt < 200) + while(cnt < 2) { DU_LOG("\nDEBUG --> PHY STUB : Sending UL User Data[%d] at sfn %d slot %d", cnt+1, sfnValue, slotValue); /* Sending Rx data indication to MAC */ @@ -1366,6 +1369,110 @@ uint8_t l1SendUlUserData() return ROK; } +/******************************************************************* + * + * @brief Sends RLC Status PDU to DU + * + * @details + * + * Function : l1SendStatusPdu + * + * Functionality: Send RLC Status PDU to DU + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t l1SendStatusPdu() +{ + fapi_rx_data_indication_t *rxDataInd; + fapi_pdu_ind_info_t *pduInfo; + uint8_t *pdu = NULLP; + uint16_t byteIdx = 0; + uint32_t msgLen = 0; + uint8_t idx = 0; + + MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t)); + if(!rxDataInd) + { + printf("\nERROR --> PHY_STUB: Memory allocation failed for Rx Data Indication"); + return RFAILED; + } + memset(rxDataInd, 0, sizeof(fapi_rx_data_indication_t)); + + msgLen = sizeof(fapi_rx_data_indication_t) - sizeof(fapi_msg_t); + rxDataInd->sfn = 0; + rxDataInd->slot = 0; + rxDataInd->numPdus = 1; + + /* TODO : Fill pduInfo using PUSCH PDU. Currently hardcoding */ + pduInfo = &rxDataInd->pdus[idx]; + pduInfo->handle = 100; + pduInfo->rnti = 100; + pduInfo->harqId = 1; + /* Since status pdu size = 3bytes and 2 bytes of MAC header, + * setting tbsize = 24 from Table 5.1.3.2-1 spec 38.214 */ + pduInfo->pdu_length = 24; + pduInfo->ul_cqi = 0; + pduInfo->timingAdvance = 0; + pduInfo->rssi = 0; + + /* Filling pdu with random values for testing */ + pduInfo->pduData = NULL; + MAC_ALLOC(pduInfo->pduData, pduInfo->pdu_length); + if(!pduInfo->pduData) + { + printf("\nERROR --> PHY_STUB: Memory allocation failed for Rx Data Pdu"); + return RFAILED; + } + + /* Filling PDU */ + pdu = (uint8_t *)pduInfo->pduData; + msgLen = 3; + + /* For RLC Status PDU + MAC subheader format is R/F/LCId/L (2/3 bytes) + LCId is 4 for DRB1 + L is length of Status PDU i.e 3 bytes + From 38.321 section 6.1.1 + */ + uint8_t statusPdu[] = {4, msgLen, 0, 0, 0}; + msgLen += 2; /* 2bytes of header */ + memcpy(pdu, &statusPdu, msgLen); + byteIdx += msgLen; /* 2 bytes of header */ + + + /* Filling MAC SDU for Padding bytes*/ + if(byteIdx < pduInfo->pdu_length) + { + /* For Padding + MAC subheader format is R/R/LCId (1byte) + LCId is 63 for padding + From 38.321 section 6.1.1 + */ + pdu[byteIdx++] = 63; + + for(; byteIdx < pduInfo->pdu_length; byteIdx++) + pdu[byteIdx] = 0; + } + msgLen += pduInfo->pdu_length; + + fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen); + + /* Send Message to peer */ + DU_LOG("\nDEBUG --> PHY STUB : Sending RLC status pdu at sfn %d slot %d", sfnValue, slotValue); + /* Sending Rx data indication to MAC */ + rxDataInd->sfn = sfnValue; + rxDataInd->slot = slotValue; + procPhyMessages(rxDataInd->header.msg_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd); + + if(pduInfo->pdu_length) + MAC_FREE(pduInfo->pduData, pduInfo->pdu_length); + MAC_FREE(rxDataInd, sizeof(fapi_rx_data_indication_t)); + return ROK; +} + /******************************************************************* * * @brief Receives message from MAC