diff --git a/lib/include/srsran/interfaces/ue_mac_interfaces.h b/lib/include/srsran/interfaces/ue_mac_interfaces.h index d34a2fd8f..972e31eaa 100644 --- a/lib/include/srsran/interfaces/ue_mac_interfaces.h +++ b/lib/include/srsran/interfaces/ue_mac_interfaces.h @@ -36,6 +36,9 @@ public: uint32_t pid; uint16_t rnti; bool is_sps_release; + bool is_pdcch_order; + uint32_t preamble_idx; + uint32_t prach_mask_idx; uint32_t tti; } mac_grant_dl_t; diff --git a/srsue/src/phy/lte/cc_worker.cc b/srsue/src/phy/lte/cc_worker.cc index bc788d8c7..e06bbde39 100644 --- a/srsue/src/phy/lte/cc_worker.cc +++ b/srsue/src/phy/lte/cc_worker.cc @@ -249,24 +249,26 @@ bool cc_worker::work_dl_regular() // If found a dci for this carrier, generate a grant, pass it to MAC and decode the associated PDSCH if (has_dl_grant) { - // Read last TB from last retx for this pid - for (uint32_t i = 0; i < SRSRAN_MAX_CODEWORDS; i++) { - ue_dl_cfg.cfg.pdsch.grant.last_tbs[i] = phy->last_dl_tbs[dci_dl.pid][cc_idx][i]; - } - // Generate PHY grant - if (srsran_ue_dl_dci_to_pdsch_grant(&ue_dl, &sf_cfg_dl, &ue_dl_cfg, &dci_dl, &ue_dl_cfg.cfg.pdsch.grant)) { - Info("Converting DCI message to DL dci"); - return false; - } - - // Save TB for next retx - for (uint32_t i = 0; i < SRSRAN_MAX_CODEWORDS; i++) { - phy->last_dl_tbs[dci_dl.pid][cc_idx][i] = ue_dl_cfg.cfg.pdsch.grant.last_tbs[i]; - } + // PDCCH order has no associated PDSCH to decode + if (not dci_dl.is_pdcch_order) { + // Read last TB from last retx for this pid + for (uint32_t i = 0; i < SRSRAN_MAX_CODEWORDS; i++) { + ue_dl_cfg.cfg.pdsch.grant.last_tbs[i] = phy->last_dl_tbs[dci_dl.pid][cc_idx][i]; + } + // Generate PHY grant + if (srsran_ue_dl_dci_to_pdsch_grant(&ue_dl, &sf_cfg_dl, &ue_dl_cfg, &dci_dl, &ue_dl_cfg.cfg.pdsch.grant)) { + Info("Converting DCI message to DL dci"); + return false; + } - // Set RNTI - ue_dl_cfg.cfg.pdsch.rnti = dci_dl.rnti; + // Save TB for next retx + for (uint32_t i = 0; i < SRSRAN_MAX_CODEWORDS; i++) { + phy->last_dl_tbs[dci_dl.pid][cc_idx][i] = ue_dl_cfg.cfg.pdsch.grant.last_tbs[i]; + } + // Set RNTI + ue_dl_cfg.cfg.pdsch.rnti = dci_dl.rnti; + } // Generate MAC grant mac_interface_phy_lte::mac_grant_dl_t mac_grant = {}; dl_phy_to_mac_grant(&ue_dl_cfg.cfg.pdsch.grant, &dci_dl, &mac_grant); @@ -354,9 +356,14 @@ void cc_worker::dl_phy_to_mac_grant(srsran_pdsch_grant_t* srsue::mac_interface_phy_lte::mac_grant_dl_t* mac_grant) { /* Fill MAC dci structure */ - mac_grant->pid = dl_dci->pid; - mac_grant->rnti = dl_dci->rnti; - mac_grant->tti = CURRENT_TTI; + mac_grant->pid = dl_dci->pid; + mac_grant->rnti = dl_dci->rnti; + mac_grant->tti = CURRENT_TTI; + mac_grant->is_pdcch_order = dl_dci->is_pdcch_order; + if (dl_dci->is_pdcch_order) { + mac_grant->preamble_idx = dl_dci->preamble_idx; + mac_grant->prach_mask_idx = dl_dci->prach_mask_idx; + } for (int i = 0; i < SRSRAN_MAX_CODEWORDS; i++) { mac_grant->tb[i].ndi = dl_dci->tb[i].ndi; diff --git a/srsue/src/stack/mac/mac.cc b/srsue/src/stack/mac/mac.cc index e15d3d116..82b4119f5 100644 --- a/srsue/src/stack/mac/mac.cc +++ b/srsue/src/stack/mac/mac.cc @@ -362,7 +362,10 @@ void mac::mch_decoded(uint32_t len, bool crc) void mac::tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSRAN_MAX_CODEWORDS]) { - if (SRSRAN_RNTI_ISRAR(grant.rnti)) { + if (grant.is_pdcch_order) { + ra_procedure.set_config_ded(grant.preamble_idx, grant.prach_mask_idx); + ra_procedure.start_pdcch_order(); + } else if (SRSRAN_RNTI_ISRAR(grant.rnti)) { if (ack[0]) { ra_procedure.tb_decoded_ok(cc_idx, grant.tti); } diff --git a/srsue/src/stack/mac/proc_ra.cc b/srsue/src/stack/mac/proc_ra.cc index d58f1ef7a..4b00557fd 100644 --- a/srsue/src/stack/mac/proc_ra.cc +++ b/srsue/src/stack/mac/proc_ra.cc @@ -150,8 +150,11 @@ void ra_proc::state_pdcch_setup() ra_tti = info.tti_ra; ra_rnti = 1 + (ra_tti % 10) + (10 * info.f_id); rInfo("seq=%d, ra-rnti=0x%x, ra-tti=%d, f_id=%d", sel_preamble.load(), ra_rnti, info.tti_ra, info.f_id); - srsran::console( - "Random Access Transmission: seq=%d, tti=%d, ra-rnti=0x%x\n", sel_preamble.load(), info.tti_ra, ra_rnti); + srsran::console("Random Access Transmission%s: seq=%d, tti=%d, ra-rnti=0x%x\n", + (started_by_pdcch) ? " (PDCCH order)" : "", + sel_preamble.load(), + info.tti_ra, + ra_rnti); rar_window_st = ra_tti + 3; rntis->set_rar_rnti(ra_rnti); state = RESPONSE_RECEPTION; @@ -516,7 +519,7 @@ void ra_proc::start_pdcch_order() rInfo("Starting PRACH by PDCCH order"); initialization(); } else { - logger.warning("Trying to start PRACH by MAC order in invalid state (%s)", state_str[state]); + logger.warning("Trying to start PRACH by PDCCH order in invalid state (%s)", state_str[state]); } }