diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 9a4ab6e06..57c3e3d24 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -338,6 +338,7 @@ public: uint32_t pid; uint16_t rnti; bool is_sps_release; + uint32_t tti; } mac_grant_dl_t; typedef struct { @@ -346,6 +347,7 @@ public: uint16_t rnti; bool phich_available; bool hi_value; + uint32_t tti_tx; } mac_grant_ul_t; typedef struct { diff --git a/srsue/hdr/stack/mac/proc_ra.h b/srsue/hdr/stack/mac/proc_ra.h index 955634714..b4ca0af2b 100644 --- a/srsue/hdr/stack/mac/proc_ra.h +++ b/srsue/hdr/stack/mac/proc_ra.h @@ -93,7 +93,7 @@ public: void pdcch_to_crnti(bool is_new_uplink_transmission); void timer_expired(uint32_t timer_id); void new_grant_dl(mac_interface_phy_lte::mac_grant_dl_t grant, mac_interface_phy_lte::tb_action_dl_t* action); - void tb_decoded_ok(); + void tb_decoded_ok(const uint32_t tti); void start_noncont(uint32_t preamble_index, uint32_t prach_mask); bool contention_resolution_id_received(uint64_t uecri); diff --git a/srsue/src/phy/cc_worker.cc b/srsue/src/phy/cc_worker.cc index 6df4b19c9..2c8da3889 100644 --- a/srsue/src/phy/cc_worker.cc +++ b/srsue/src/phy/cc_worker.cc @@ -342,6 +342,7 @@ void cc_worker::dl_phy_to_mac_grant(srslte_pdsch_grant_t* /* Fill MAC dci structure */ mac_grant->pid = dl_dci->pid; mac_grant->rnti = dl_dci->rnti; + mac_grant->tti = CURRENT_TTI; for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { mac_grant->tb[i].ndi = dl_dci->tb[i].ndi; @@ -711,6 +712,7 @@ void cc_worker::ul_phy_to_mac_grant(srslte_pusch_grant_t* mac_grant->tb.tbs = phy_grant->tb.tbs / (uint32_t)8; mac_grant->tb.rv = phy_grant->tb.rv; mac_grant->pid = pid; + mac_grant->tti_tx = CURRENT_TTI_TX; } int cc_worker::decode_pdcch_ul() diff --git a/srsue/src/stack/mac/dl_harq.cc b/srsue/src/stack/mac/dl_harq.cc index c60196f61..26d0698d0 100644 --- a/srsue/src/stack/mac/dl_harq.cc +++ b/srsue/src/stack/mac/dl_harq.cc @@ -345,13 +345,14 @@ void dl_harq_entity::dl_harq_process::dl_tb_process::tb_decoded(mac_interface_ph if (ack) { if (is_bcch) { if (harq_entity->pcap) { - harq_entity->pcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.tb[tid].tbs, ack, 0); + harq_entity->pcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.tb[tid].tbs, ack, cur_grant.tti); } Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.tb[tid].tbs); harq_entity->demux_unit->push_pdu_bcch(payload_buffer_ptr, cur_grant.tb[tid].tbs); } else { if (harq_entity->pcap) { - harq_entity->pcap->write_dl_crnti(payload_buffer_ptr, cur_grant.tb[tid].tbs, cur_grant.rnti, ack, 0); + harq_entity->pcap->write_dl_crnti( + payload_buffer_ptr, cur_grant.tb[tid].tbs, cur_grant.rnti, ack, cur_grant.tti); } if (cur_grant.rnti == harq_entity->rntis->temp_rnti) { Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (Temporal C-RNTI)\n", cur_grant.tb[tid].tbs); diff --git a/srsue/src/stack/mac/mac.cc b/srsue/src/stack/mac/mac.cc index 455746fe8..8b6b7fb0d 100644 --- a/srsue/src/stack/mac/mac.cc +++ b/srsue/src/stack/mac/mac.cc @@ -407,14 +407,14 @@ void mac::tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSLTE_MAX_ { if (SRSLTE_RNTI_ISRAR(grant.rnti)) { if (ack[0]) { - ra_procedure.tb_decoded_ok(); + ra_procedure.tb_decoded_ok(grant.tti); } } else if (grant.rnti == SRSLTE_PRNTI) { // Send PCH payload to RLC rlc_h->write_pdu_pcch(pch_payload_buffer, grant.tb[0].tbs); if (pcap) { - pcap->write_dl_pch(pch_payload_buffer, grant.tb[0].tbs, true, phy_h->get_current_tti()); + pcap->write_dl_pch(pch_payload_buffer, grant.tb[0].tbs, true, grant.tti); } } else { diff --git a/srsue/src/stack/mac/proc_ra.cc b/srsue/src/stack/mac/proc_ra.cc index 3b97ff0e7..acadef930 100644 --- a/srsue/src/stack/mac/proc_ra.cc +++ b/srsue/src/stack/mac/proc_ra.cc @@ -164,7 +164,6 @@ void ra_proc::step(uint32_t tti_) */ void ra_proc::state_pdcch_setup() { - phy_interface_mac_lte::prach_info_t info = phy_h->prach_get_info(); if (info.is_transmitted) { ra_tti = info.tti_ra; @@ -393,9 +392,10 @@ void ra_proc::new_grant_dl(mac_interface_phy_lte::mac_grant_dl_t grant, mac_inte /* Called upon the successful decoding of a TB addressed to RA-RNTI. * Processes the reception of a RAR as defined in 5.1.4 */ -void ra_proc::tb_decoded_ok() { +void ra_proc::tb_decoded_ok(const uint32_t tti) +{ if (pcap) { - pcap->write_dl_ranti(rar_pdu_buffer, rar_grant_nbytes, ra_rnti, true, 0); + pcap->write_dl_ranti(rar_pdu_buffer, rar_grant_nbytes, ra_rnti, true, tti); } rDebug("RAR decoded successfully TBS=%d\n", rar_grant_nbytes); diff --git a/srsue/src/stack/mac/ul_harq.cc b/srsue/src/stack/mac/ul_harq.cc index 5ef991afc..5202dcf03 100644 --- a/srsue/src/stack/mac/ul_harq.cc +++ b/srsue/src/stack/mac/ul_harq.cc @@ -286,7 +286,7 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr } else { rnti = harq_entity->rntis->crnti; } - harq_entity->pcap->write_ul_crnti(pdu_ptr, grant.tb.tbs, rnti, get_nof_retx(), 0); + harq_entity->pcap->write_ul_crnti(pdu_ptr, grant.tb.tbs, rnti, get_nof_retx(), grant.tti_tx); } } else if (has_grant()) { // Non-Adaptive Re-Tx