|
|
|
@ -70,6 +70,8 @@ bool mac::init(const mac_args_t& args_,
|
|
|
|
|
args = args_;
|
|
|
|
|
cell = *cell_;
|
|
|
|
|
|
|
|
|
|
stack_task_queue = stack->get_task_queue();
|
|
|
|
|
|
|
|
|
|
scheduler.init(rrc);
|
|
|
|
|
|
|
|
|
|
// Set default scheduler configuration
|
|
|
|
@ -323,7 +325,7 @@ int mac::crc_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t nof_byt
|
|
|
|
|
if (crc) {
|
|
|
|
|
Info("Pushing PDU rnti=%d, tti=%d, nof_bytes=%d\n", rnti, tti, nof_bytes);
|
|
|
|
|
ue_db[rnti]->push_pdu(tti, nof_bytes);
|
|
|
|
|
stack->process_pdus();
|
|
|
|
|
stack_task_queue.push([this]() { process_pdus(); });
|
|
|
|
|
} else {
|
|
|
|
|
ue_db[rnti]->deallocate_pdu(tti);
|
|
|
|
|
}
|
|
|
|
@ -410,7 +412,7 @@ int mac::sr_detected(uint32_t tti, uint16_t rnti)
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx, uint32_t time_adv)
|
|
|
|
|
void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx, uint32_t time_adv)
|
|
|
|
|
{
|
|
|
|
|
log_h->step(tti);
|
|
|
|
|
uint16_t rnti;
|
|
|
|
@ -426,11 +428,18 @@ int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set PCAP if available
|
|
|
|
|
if (pcap) {
|
|
|
|
|
if (pcap != nullptr) {
|
|
|
|
|
ue_db[rnti]->start_pcap(pcap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Increase RNTI counter
|
|
|
|
|
last_rnti++;
|
|
|
|
|
if (last_rnti >= 60000) {
|
|
|
|
|
last_rnti = 70;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stack_task_queue.push([this, rnti, tti, enb_cc_idx, preamble_idx, time_adv]() {
|
|
|
|
|
// Generate RAR data
|
|
|
|
|
sched_interface::dl_sched_rar_info_t rar_info = {};
|
|
|
|
|
rar_info.preamble_idx = preamble_idx;
|
|
|
|
@ -448,15 +457,16 @@ int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx,
|
|
|
|
|
ue_cfg.dl_cfg.tm = SRSLTE_TM1;
|
|
|
|
|
if (scheduler.ue_cfg(rnti, ue_cfg) != SRSLTE_SUCCESS) {
|
|
|
|
|
Error("Registering new user rnti=0x%x to SCHED\n", rnti);
|
|
|
|
|
return -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register new user in RRC
|
|
|
|
|
rrc_h->add_user(rnti, ue_cfg);
|
|
|
|
|
|
|
|
|
|
// Add temporal rnti to the PHY
|
|
|
|
|
if (phy_h->add_rnti(rnti, enb_cc_idx, true)) {
|
|
|
|
|
if (phy_h->add_rnti(rnti, enb_cc_idx, true) != SRSLTE_SUCCESS) {
|
|
|
|
|
Error("Registering temporal-rnti=0x%x to PHY\n", rnti);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Trigger scheduler RACH
|
|
|
|
@ -464,12 +474,7 @@ int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx,
|
|
|
|
|
|
|
|
|
|
log_h->info("RACH: tti=%d, preamble=%d, offset=%d, temp_crnti=0x%x\n", tti, preamble_idx, time_adv, rnti);
|
|
|
|
|
log_h->console("RACH: tti=%d, preamble=%d, offset=%d, temp_crnti=0x%x\n", tti, preamble_idx, time_adv, rnti);
|
|
|
|
|
// Increase RNTI counter
|
|
|
|
|
last_rnti++;
|
|
|
|
|
if (last_rnti >= 60000) {
|
|
|
|
|
last_rnti = 70;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int mac::get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res_list)
|
|
|
|
|