diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index a2f75f59e8..fcbe873ad2 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -2448,6 +2448,7 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, handle_reconfiguration_with_sync(mac, cc_idP, spCellConfig->reconfigurationWithSync); } if (scd) { + mac->tag_Id = scd->tag_Id; configure_servingcell_info(mac, scd); configure_BWPs(mac, scd); } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 5777f1e437..1079e24b05 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -424,10 +424,9 @@ typedef enum ta_type { } ta_type_t; typedef struct NR_UL_TIME_ALIGNMENT { - /// TA command and TAGID received from the gNB + /// TA command received from the gNB ta_type_t ta_apply; int ta_command; - uint32_t tag_id; int frame; int slot; } NR_UL_TIME_ALIGNMENT_t; @@ -595,6 +594,8 @@ typedef struct NR_UE_MAC_INST_s { NR_UE_HARQ_STATUS_t dl_harq_info[NR_MAX_HARQ_PROCESSES]; NR_UL_HARQ_INFO_t ul_harq_info[NR_MAX_HARQ_PROCESSES]; + NR_TAG_Id_t tag_Id; + nr_emulated_l1_t nr_ue_emul_l1; pthread_mutex_t mutex_dl_info; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index ccfa861587..d007878203 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3563,14 +3563,16 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i // 38.321 Ch6.1.3.4 mac_len = 1; - /*uint8_t ta_command = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; - uint8_t tag_id = ((NR_MAC_CE_TA *)pduP)[1].TAGID;*/ - const int ta = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; const int tag = ((NR_MAC_CE_TA *)pduP)[1].TAGID; + if (tag != mac->tag_Id) { + LOG_E(NR_MAC, "MAC CE TAG %d does not correspond to the one configured at MAC %ld\n", tag, mac->tag_Id); + done = 1; + break; + } + NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment; - ul_time_alignment->tag_id = tag; ul_time_alignment->ta_command = ta; ul_time_alignment->ta_apply = adjustment_ta; @@ -3589,7 +3591,6 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i LOG_D(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d \n", frameP, slot, ta, tag, CC_id); else LOG_I(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d \n", frameP, slot, ta, tag, CC_id); - break; case DL_SCH_LCID_CON_RES_ID: // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16