From 14758b087cb18e5283f8c9153128a983746f0a52 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 3 Sep 2021 15:14:29 +0200 Subject: [PATCH] enb,mac_nr: fix Msg3 UL grant packing in RAR --- srsenb/src/stack/mac/nr/mac_nr.cc | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/srsenb/src/stack/mac/nr/mac_nr.cc b/srsenb/src/stack/mac/nr/mac_nr.cc index 081f59569..6110efdf3 100644 --- a/srsenb/src/stack/mac/nr/mac_nr.cc +++ b/srsenb/src/stack/mac/nr/mac_nr.cc @@ -142,9 +142,6 @@ void mac_nr::rach_detected(const rach_info_t& rach_info) rach_tprof_meas.defer_stop(); uint16_t rnti = reserve_rnti(enb_cc_idx); - // TODO: Generate RAR data - // .. - // Log this event. ++detected_rachs[enb_cc_idx]; @@ -373,11 +370,29 @@ srsran::byte_buffer_t* mac_nr::assemble_rar(srsran::const_span str; + srsran_dci_ul_nr_to_str(&dci, &rar_grant.msg3_dci, str.data(), str.size()); + logger.info("Setting RAR Grant %s", str.data()); + } + + // copy only the required bits + std::array packed_ul_grant = {}; + std::copy(std::begin(dci_msg.payload), std::begin(dci_msg.payload)+SRSRAN_RAR_UL_GRANT_NBITS, packed_ul_grant.begin()); + rar_subpdu.set_ul_grant(packed_ul_grant); } if (rar_pdu.pack() != SRSRAN_SUCCESS) {