Commit 2ec6ee5f authored by luis_pereira87's avatar luis_pereira87

Fix Msg4 mac pdu with padding

parent 79864d00
......@@ -1782,25 +1782,19 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
mac_subheader_len = 3;
} else {
mac_sdu_len = ((NR_MAC_SUBHEADER_LONG *) pduP)->L1;
mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L;
mac_subheader_len = 2;
}
// Check if it is a valid CCCH message, we get all 00's messages very often
if ( pdu_len != (mac_subheader_len+mac_sdu_len) ) {
LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len);
return;
}
if ( mac_sdu_len > 0 ) {
if ( pdu_len >= mac_sdu_len ) {
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH with payload len %d: bits\n", mac_sdu_len);
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH with payload len %d\n", mac_sdu_len);
LOG_D(NR_MAC,"RRCSetup received at nr_ue_process_mac_pdu with payload len %d: \n bits, rx bytes: \n", mac_sdu_len);
LOG_D(NR_MAC,"RRCSetup received at nr_ue_process_mac_pdu with payload len %d: \n", mac_sdu_len);
for (int i = 0; i < mac_subheader_len; i++) {
LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]);
}
for (int i = 0; i < mac_sdu_len/8; i++) {
for (int i = 0; i < mac_sdu_len; i++) {
LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]);
}
......
......@@ -1377,6 +1377,16 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
pdsch_pdu_rel15->BWPSize,
nr_mac->sched_ctrlCommon->active_bwp->bwp_Id);
// Add padding header and zero rest out if there is space left
if (mac_pdu_length < harq->tb_size) {
NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) &buf[mac_pdu_length];
padding->R = 0;
padding->LCID = DL_SCH_LCID_PADDING;
for(int k = mac_pdu_length+1; k<harq->tb_size; k++) {
buf[k] = 0;
}
}
// DL TX request
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment