SRSUE: NR handle rar pdu in tb decoded, fixed tti_tx issue, log RA procedure and adjusted testcase

master
David Rupprecht 4 years ago committed by David Rupprecht
parent 760ad3a746
commit f90f10f6a8

@ -83,7 +83,7 @@ void sf_worker::work_imp()
tx_buffer.set(0, prach_ptr);
// Notify MAC about PRACH transmission
phy_state->stack->prach_sent(tti_rx, 7, 1, 0, 0);
phy_state->stack->prach_sent(TTI_TX(tti_rx), 7, 1, 0, 0);
// Transmit NR PRACH
phy->worker_end(this, false, tx_buffer, dummy_ts, true);

@ -182,11 +182,9 @@ void mac_nr::write_pcap(const uint32_t cc_idx, mac_nr_grant_dl_t& grant)
void mac_nr::tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant)
{
write_pcap(cc_idx, grant);
// handle PDU
if (SRSLTE_RNTI_ISRAR(grant.rnti)) { // TODO: replace with proc_ra->get_rar_rnti()
// TODO: pass to RA proc
// handle_rar_pdu(grant);
if (grant.rnti == proc_ra.get_rar_rnti()) {
proc_ra.handle_rar_pdu(grant);
} else {
// Push DL PDUs to queue for back-ground processing
for (uint32_t i = 0; i < SRSLTE_MAX_CODEWORDS; ++i) {

@ -87,7 +87,7 @@ bool proc_ra_nr::is_rar_opportunity(uint32_t tti)
uint16_t proc_ra_nr::get_rar_rnti()
{
if (rar_rnti == SRSLTE_INVALID_RNTI || state != WAITING_FOR_RESPONSE_RECEPTION) {
logger.error("Requested ra rnti is invalid. Anyway we return an invalid ra rnti\n");
logger.error("Requested ra rnti is invalid. Anyway we return an invalid ra rnti");
return SRSLTE_INVALID_RNTI;
}
return rar_rnti;
@ -160,7 +160,7 @@ void proc_ra_nr::ra_response_reception(const mac_interface_phy_nr::mac_nr_grant_
if (grant.tb[i] != nullptr) {
srslte::mac_rar_pdu_nr pdu;
if (!pdu.unpack(grant.tb[i]->msg, grant.tb[i]->N_bytes)) {
logger.warning("Error unpacking RAR PDU");
logger.warning("Error unpacking RAR PDU (%d)", i);
return;
}
logger.info(pdu.to_string());
@ -234,7 +234,7 @@ void proc_ra_nr::ra_completion()
void proc_ra_nr::ra_error()
{
logger.error("NR random access procedure error recovery not implemented yet\n");
logger.error("NR random access procedure error recovery not implemented yet");
}
// Is called by PHY once it has transmitted the prach transmitted, than configure RA-RNTI and wait for RAR reception
@ -265,8 +265,8 @@ void proc_ra_nr::prach_sent(uint32_t tti, uint32_t s_id, uint32_t t_id, uint32_t
rar_rnti,
tti);
uint32_t rar_window_st = TTI_ADD(tti, 3);
// TODO check ra_response window (delayed start)?
rar_timeout_timer.set(rach_cfg.ra_responseWindow + 3, [this](uint32_t tid) { timer_expired(tid); });
// TODO check ra_response window (delayed start)? // last 3 check if needed when we have a delayed start
rar_timeout_timer.set(rach_cfg.ra_responseWindow + 3 + 3, [this](uint32_t tid) { timer_expired(tid); });
rar_timeout_timer.run();
// Wait for RAR reception
ra_window_length = rach_cfg.ra_responseWindow;

@ -755,7 +755,7 @@ void rrc_nr::connection_reconf_no_ho_proc::then(const srslte::proc_state_t& resu
{
if (result.is_success()) {
Info("Finished %s successfully", name());
srslte::console("RRC NR reconfiguration successful.");
srslte::console("RRC NR reconfiguration successful.\n");
return;
}

@ -96,7 +96,7 @@ int main()
TESTASSERT(preamble_received_target_power == -114);
// Simulate PHY and call prach_sent (random values)
uint32_t tti_start = 0;
proc_ra_nr.prach_sent(tti_start, 6, 0, 4, 1);
proc_ra_nr.prach_sent(tti_start, 7, 1, 0, 0);
for (uint32_t i = tti_start; i < rach_cfg.ra_responseWindow; i++) {
// update clock and run internal tasks
@ -107,14 +107,14 @@ int main()
TESTASSERT(rar_opportunity == false);
} else if (3 + tti_start > i && i < 3 + rach_cfg.ra_responseWindow) {
TESTASSERT(rar_opportunity == true);
TESTASSERT(proc_ra_nr.get_rar_rnti() == 0x3487);
TESTASSERT(proc_ra_nr.get_rar_rnti() == 0x16);
}
}
mac_interface_phy_nr::mac_nr_grant_dl_t grant;
grant.rnti = 0x3487;
grant.rnti = 0x16;
grant.tti = rach_cfg.ra_responseWindow + tti_start + 3;
grant.pid = 0x0123;
uint8_t mac_dl_rar_pdu[] = {0x40, 0x05, 0xa0, 0x00, 0x11, 0x46, 0x46, 0x16, 0x00, 0x00, 0x00};
uint8_t mac_dl_rar_pdu[] = {0x40, 0x06, 0x68, 0x03, 0x21, 0x46, 0x46, 0x02, 0x00, 0x00, 0x00};
grant.tb[0] = srslte::make_byte_buffer();
grant.tb[0].get()->append_bytes(mac_dl_rar_pdu, sizeof(mac_dl_rar_pdu));
proc_ra_nr.handle_rar_pdu(grant);

Loading…
Cancel
Save