From aa47a524b4b93f86989f8c9c2bd6c13daec7f3b5 Mon Sep 17 00:00:00 2001 From: ismagom Date: Thu, 6 Aug 2015 13:42:08 +0200 Subject: [PATCH] Integration with higher layers failing NAS integration --- .../include/srsapps/common/mac_interface.h | 2 +- srsapps/ue/mac/include/srsapps/ue/mac/demux.h | 10 ++-- srsapps/ue/mac/include/srsapps/ue/mac/pdu.h | 4 +- .../ue/mac/include/srsapps/ue/mac/proc_bsr.h | 2 + .../ue/mac/include/srsapps/ue/mac/proc_ra.h | 1 + srsapps/ue/mac/src/demux.cc | 51 ++++++++++--------- srsapps/ue/mac/src/dl_harq.cc | 20 ++++---- srsapps/ue/mac/src/mux.cc | 38 +++++++------- srsapps/ue/mac/src/pdu.cc | 10 ++-- srsapps/ue/mac/src/proc_bsr.cc | 2 +- srsapps/ue/mac/src/proc_ra.cc | 7 ++- srsapps/ue/mac/src/ul_harq.cc | 1 + srsapps/ue/phy/src/phch_common.cc | 6 ++- srsapps/ue/phy/src/phch_recv.cc | 8 +-- srsapps/ue/phy/src/phch_worker.cc | 9 ++-- srsapps/ue/phy/src/prach.cc | 5 ++ srsapps/ue/phy/test/ue_itf_test_prach.cc | 1 - srslte/lib/ue/src/ue_ul.c | 3 +- 18 files changed, 104 insertions(+), 76 deletions(-) diff --git a/srsapps/common/include/srsapps/common/mac_interface.h b/srsapps/common/include/srsapps/common/mac_interface.h index 2a90b50d1..f3cd367ef 100644 --- a/srsapps/common/include/srsapps/common/mac_interface.h +++ b/srsapps/common/include/srsapps/common/mac_interface.h @@ -139,7 +139,7 @@ public: /* MAC calls RLC to get RLC segment of nof_bytes length. Segmentation happens in this function. RLC PDU is stored in * payload. */ - virtual uint32_t read_pdu(uint32_t lcid, uint8_t *payload, uint32_t segment_idx) = 0; + virtual uint32_t read_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0; /* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread. PDU gets placed into the * PDCP buffer and higher layer thread gets notified diff --git a/srsapps/ue/mac/include/srsapps/ue/mac/demux.h b/srsapps/ue/mac/include/srsapps/ue/mac/demux.h index 33ebd99c4..bdd573399 100644 --- a/srsapps/ue/mac/include/srsapps/ue/mac/demux.h +++ b/srsapps/ue/mac/include/srsapps/ue/mac/demux.h @@ -52,10 +52,12 @@ public: void process_pdus(); uint8_t* request_buffer(uint32_t len); - void release_pdu(uint8_t *buff, uint32_t nof_bytes); - void release_pdu_bcch(uint8_t *buff, uint32_t nof_bytes); - void release_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes); + void push_pdu(uint8_t *buff, uint32_t nof_bytes); + void push_pdu_bcch(uint8_t *buff, uint32_t nof_bytes); + void push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes); + void release_buffer(uint8_t *ptr); + void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg); bool get_uecrid_successful(); @@ -84,8 +86,6 @@ private: } buff_header_t; // Mutex for exclusive access - pthread_mutex_t mutex; - pthread_cond_t cvar; qbuff pdu_q[NOF_PDU_Q]; bool used_q[NOF_PDU_Q]; diff --git a/srsapps/ue/mac/include/srsapps/ue/mac/pdu.h b/srsapps/ue/mac/include/srsapps/ue/mac/pdu.h index 8e6801708..0fc629a3a 100644 --- a/srsapps/ue/mac/include/srsapps/ue/mac/pdu.h +++ b/srsapps/ue/mac/include/srsapps/ue/mac/pdu.h @@ -230,8 +230,8 @@ public: // Writing functions void write_subheader(uint8_t** ptr, bool is_last); void write_payload(uint8_t **ptr); - bool set_sdu(uint32_t lcid, uint32_t requested_bytes, rlc_interface_mac *rlc); - bool set_sdu(uint32_t lcid, uint32_t requested_bytes, rlc_interface_mac *rlc, bool is_first); + int set_sdu(uint32_t lcid, uint32_t requested_bytes, rlc_interface_mac *rlc); + int set_sdu(uint32_t lcid, uint32_t requested_bytes, rlc_interface_mac *rlc, bool is_first); bool set_c_rnti(uint16_t crnti); bool set_bsr(uint32_t buff_size[4], sch_subh::cetype format, bool update_size); bool set_con_res_id(uint64_t con_res_id); diff --git a/srsapps/ue/mac/include/srsapps/ue/mac/proc_bsr.h b/srsapps/ue/mac/include/srsapps/ue/mac/proc_bsr.h index 103e630d0..1ff546f35 100644 --- a/srsapps/ue/mac/include/srsapps/ue/mac/proc_bsr.h +++ b/srsapps/ue/mac/include/srsapps/ue/mac/proc_bsr.h @@ -72,6 +72,8 @@ public: private: + const static int QUEUE_STATUS_PERIOD_MS = 500; + bool reset_sr; mac_params *params_db; timers *timers_db; diff --git a/srsapps/ue/mac/include/srsapps/ue/mac/proc_ra.h b/srsapps/ue/mac/include/srsapps/ue/mac/proc_ra.h index a8b091e90..54c51ae26 100644 --- a/srsapps/ue/mac/include/srsapps/ue/mac/proc_ra.h +++ b/srsapps/ue/mac/include/srsapps/ue/mac/proc_ra.h @@ -166,6 +166,7 @@ private: } start_mode; uint32_t rar_grant_nbytes; uint32_t rar_grant_tti; + bool msg3_flushed; }; } } diff --git a/srsapps/ue/mac/src/demux.cc b/srsapps/ue/mac/src/demux.cc index 24142a8bd..073fd61c3 100644 --- a/srsapps/ue/mac/src/demux.cc +++ b/srsapps/ue/mac/src/demux.cc @@ -38,9 +38,6 @@ demux::demux() : mac_msg(20), pending_mac_msg(20) pdu_q[i].init(8, MAX_PDU_LEN); used_q[i] = false; } - pthread_mutex_init(&mutex, NULL); - pthread_cond_init(&cvar, NULL); - } void demux::init(phy_interface* phy_h_, rlc_interface_mac *rlc_, log* log_h_, timers* timers_db_) @@ -94,36 +91,32 @@ uint8_t* demux::request_buffer(uint32_t len) if (len >= MAX_PDU_LEN - sizeof(buff_header_t)) { return NULL; } - pthread_mutex_lock(&mutex); + uint8_t idx=0; - while(!find_unused_queue(&idx)) { - pthread_cond_wait(&cvar, &mutex); - } - if (idx > 0) { - printf("Using queue %d for MAC PDU\n", idx); + if(find_unused_queue(&idx)) { + if (idx > 0) { + printf("Using queue %d for MAC PDU\n", idx); + } + used_q[idx] = true; + uint8_t *buff = (uint8_t*) pdu_q[idx].request(); + buff_header_t *head = (buff_header_t*) buff; + head->idx = idx; + return &buff[sizeof(buff_header_t)]; + } else { + Error("All DL buffers are full. Packet will be lost\n"); + return NULL; } - used_q[idx] = true; - uint8_t *buff = (uint8_t*) pdu_q[idx].request(); - buff_header_t *head = (buff_header_t*) buff; - head->idx = idx; - - pthread_mutex_unlock(&mutex); - - return &buff[sizeof(buff_header_t)]; } void demux::push_buffer(uint8_t *buff, uint32_t nof_bytes) { buff_header_t *head = (buff_header_t*) (buff-sizeof(buff_header_t)); if (head->idx < NOF_PDU_Q) { - pthread_mutex_lock(&mutex); if (nof_bytes > 0) { if (!pdu_q[head->idx].push(nof_bytes)) { Warning("Full queue %d when pushing MAC PDU %d bytes\n", head->idx, nof_bytes); } } used_q[head->idx] = false; - pthread_cond_signal(&cvar); - pthread_mutex_unlock(&mutex); } } @@ -132,7 +125,7 @@ void demux::push_buffer(uint8_t *buff, uint32_t nof_bytes) { * Warning: this function sends the message to RLC now, since SI blocks do not * require ACK feedback to be transmitted quickly. */ -void demux::release_pdu_bcch(uint8_t *buff, uint32_t nof_bytes) +void demux::push_pdu_bcch(uint8_t *buff, uint32_t nof_bytes) { Debug("Pushed BCCH MAC PDU in transparent mode\n"); rlc->write_pdu_bcch_dlsch(buff, nof_bytes); @@ -148,7 +141,7 @@ void demux::release_pdu_bcch(uint8_t *buff, uint32_t nof_bytes) * Warning: this function does some processing here assuming ACK deadline is not an * issue here because Temp C-RNTI messages have small payloads */ -void demux::release_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes) +void demux::push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes) { // Unpack DLSCH MAC PDU pending_mac_msg.init_rx(buff, nof_bytes); @@ -171,11 +164,22 @@ void demux::release_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes) * This function enqueues the packet and returns quicly because ACK * deadline is important here. */ -void demux::release_pdu(uint8_t *buff, uint32_t nof_bytes) +void demux::push_pdu(uint8_t *buff, uint32_t nof_bytes) { push_buffer(buff, nof_bytes); } +void demux::release_buffer(uint8_t* ptr) +{ + uint8_t *addr = ptr - sizeof(buff_header_t); + for (int i=0;inext()) { if (pdu_msg->get()->is_sdu()) { // Route logical channel + Info("Delivering PDU for lcid=%d, %d bytes\n", pdu_msg->get()->get_sdu_lcid(), pdu_msg->get()->get_sdu_nbytes()); rlc->write_pdu(pdu_msg->get()->get_sdu_lcid(), pdu_msg->get()->get_sdu_ptr(), pdu_msg->get()->get_sdu_nbytes()); } else { // Process MAC Control Element diff --git a/srsapps/ue/mac/src/dl_harq.cc b/srsapps/ue/mac/src/dl_harq.cc index 23bf59a6e..1a24b5f9a 100644 --- a/srsapps/ue/mac/src/dl_harq.cc +++ b/srsapps/ue/mac/src/dl_harq.cc @@ -230,15 +230,12 @@ void dl_harq_entity::dl_harq_process::new_grant_dl(mac_interface_phy::mac_grant_ bzero(action, sizeof(mac_interface_phy::tb_action_dl_t)); action->default_ack = ack; action->generate_ack = true; - + action->decode_enabled = false; + // If data has not yet been successfully decoded if (ack == false) { // Instruct the PHY To combine the received data and attempt to decode it - action->decode_enabled = true; - action->rv = cur_grant.rv; - action->rnti = cur_grant.rnti; - action->softbuffer = &softbuffer; payload_buffer_ptr = harq_entity->demux_unit->request_buffer(cur_grant.n_bytes); action->payload_ptr = payload_buffer_ptr; if (!action->payload_ptr) { @@ -246,10 +243,13 @@ void dl_harq_entity::dl_harq_process::new_grant_dl(mac_interface_phy::mac_grant_ Error("Can't get a buffer for TBS=%d\n", cur_grant.n_bytes); return; } + action->decode_enabled = true; + action->rv = cur_grant.rv; + action->rnti = cur_grant.rnti; + action->softbuffer = &softbuffer; memcpy(&action->phy_grant, &cur_grant.phy_grant, sizeof(srslte_phy_grant_t)); } else { - action->decode_enabled = false; Warning("DL PID %d: Received duplicate TB. Discarting and retransmitting ACK\n", pid); } @@ -279,7 +279,7 @@ void dl_harq_entity::dl_harq_process::tb_decoded(bool ack_) } if (ack) { Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.n_bytes); - harq_entity->demux_unit->release_pdu_bcch(payload_buffer_ptr, cur_grant.n_bytes); + harq_entity->demux_unit->push_pdu_bcch(payload_buffer_ptr, cur_grant.n_bytes); } } else { @@ -289,13 +289,15 @@ void dl_harq_entity::dl_harq_process::tb_decoded(bool ack_) if (ack) { if (cur_grant.rnti_type == SRSLTE_RNTI_TEMP) { Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (Temporal C-RNTI)\n", cur_grant.n_bytes); - harq_entity->demux_unit->release_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes); + harq_entity->demux_unit->push_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes); } else { Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.n_bytes); - harq_entity->demux_unit->release_pdu(payload_buffer_ptr, cur_grant.n_bytes); + harq_entity->demux_unit->push_pdu(payload_buffer_ptr, cur_grant.n_bytes); } } } + } else { + harq_entity->demux_unit->release_buffer(payload_buffer_ptr); } Info("DL PID %d: TBS=%d, RV=%d, ACK=%s\n", pid, cur_grant.n_bytes, cur_grant.rv, ack?"OK":"KO"); } diff --git a/srsapps/ue/mac/src/mux.cc b/srsapps/ue/mac/src/mux.cc index a36d94c27..457d255ca 100644 --- a/srsapps/ue/mac/src/mux.cc +++ b/srsapps/ue/mac/src/mux.cc @@ -248,11 +248,9 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, int max_sdu_sz, uint32_t // Get n-th pending SDU pointer and length int sdu_len = rlc->get_buffer_state(lcid); - + if (sdu_len > 0) { // there is pending SDU to allocate - Info("%d bytes pending on RLC buffer. Maximum rate=%d, available space=%d\n", - sdu_len, max_sdu_sz, pdu_msg->rem_size() - 2); - + int buffer_state = sdu_len; if (sdu_len > max_sdu_sz && max_sdu_sz >= 0) { sdu_len = max_sdu_sz; } @@ -262,7 +260,8 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, int max_sdu_sz, uint32_t if (sdu_len > MIN_RLC_SDU_LEN) { if (pdu_msg->new_subh()) { // there is space for a new subheader pdu_msg->next(); - if (pdu_msg->get()->set_sdu(lcid, sdu_len, rlc, is_first?*is_first:false)) { // new SDU could be added + sdu_len = pdu_msg->get()->set_sdu(lcid, sdu_len, rlc, is_first?*is_first:false); + if (sdu_len >= 0) { // new SDU could be added if (is_first) { *is_first = false; } @@ -270,10 +269,10 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, int max_sdu_sz, uint32_t *sdu_sz = sdu_len; } - Info("Allocated SDU lcid=%d nbytes=%d\n", lcid, sdu_len); + Info("Allocated SDU lcid=%d nbytes=%d, buffer_state=%d\n", lcid, sdu_len, buffer_state); return true; } else { - Info("Could not add SDU rem_size=%d, sdu_len=%d\n", pdu_msg->rem_size(), sdu_len); + Info("Could not add SDU rem_size=%d, sdu_len=%d\n", pdu_msg->rem_size(), buffer_state); pdu_msg->del_subh(); } } @@ -284,6 +283,7 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, int max_sdu_sz, uint32_t void mux::msg3_flush() { + Info("Msg3 buffer flushed\n"); msg3_buff.flush(); msg3_has_been_transmitted = false; } @@ -315,16 +315,20 @@ bool mux::pdu_move_to_msg3(uint32_t pdu_sz) /* Returns a pointer to the Msg3 buffer */ uint8_t* mux::msg3_get(uint8_t *payload, uint32_t pdu_sz) { - if (pdu_move_to_msg3(pdu_sz)) { - uint8_t *msg3 = (uint8_t*) msg3_buff.pop(); - if (msg3) { - memcpy(payload, msg3, sizeof(uint8_t)*pdu_sz); - msg3_buff.release(); - msg3_has_been_transmitted = true; - return payload; - } else { - Error("Generating Msg3\n"); - } + if (msg3_buff.isempty()) { + Info("Moving PDU from Mux unit to Msg3 buffer\n"); + if (!pdu_move_to_msg3(pdu_sz)) { + Error("Moving PDU from Mux unit to Msg3 buffer\n"); + return NULL; + } + } + uint8_t *msg3 = (uint8_t*) msg3_buff.pop(); + if (msg3) { + memcpy(payload, msg3, sizeof(uint8_t)*pdu_sz); + msg3_has_been_transmitted = true; + return payload; + } else { + Error("Generating Msg3\n"); } return NULL; } diff --git a/srsapps/ue/mac/src/pdu.cc b/srsapps/ue/mac/src/pdu.cc index 38cee55a7..ec1fbc0bc 100644 --- a/srsapps/ue/mac/src/pdu.cc +++ b/srsapps/ue/mac/src/pdu.cc @@ -452,12 +452,12 @@ bool sch_subh::set_ta_cmd(uint8_t ta_cmd) } } -bool sch_subh::set_sdu(uint32_t lcid_, uint32_t nof_bytes_, rlc_interface_mac *rlc) +int sch_subh::set_sdu(uint32_t lcid_, uint32_t nof_bytes_, rlc_interface_mac *rlc) { return set_sdu(lcid_, nof_bytes_, rlc, false); } -bool sch_subh::set_sdu(uint32_t lcid_, uint32_t requested_bytes, rlc_interface_mac *rlc, bool is_first) +int sch_subh::set_sdu(uint32_t lcid_, uint32_t requested_bytes, rlc_interface_mac *rlc, bool is_first) { if (((sch_pdu*)parent)->has_space_sdu(requested_bytes, is_first)) { lcid = lcid_; @@ -469,12 +469,12 @@ bool sch_subh::set_sdu(uint32_t lcid_, uint32_t requested_bytes, rlc_interface_m // Save final number of written bytes nof_bytes = sdu_sz; - + ((sch_pdu*)parent)->add_sdu(nof_bytes); ((sch_pdu*)parent)->update_space_sdu(sdu_sz, is_first); - return true; + return (int) nof_bytes; } else { - return false; + return -1; } } // Section 6.2.1 diff --git a/srsapps/ue/mac/src/proc_bsr.cc b/srsapps/ue/mac/src/proc_bsr.cc index 2dfbd21ed..a98302bb9 100644 --- a/srsapps/ue/mac/src/proc_bsr.cc +++ b/srsapps/ue/mac/src/proc_bsr.cc @@ -218,7 +218,7 @@ void bsr_proc::step(uint32_t tti) update_pending_data(); - if ((tti - last_print)%10240 > 40) { + if ((tti - last_print)%10240 > QUEUE_STATUS_PERIOD_MS) { char str[128]; bzero(str, 128); for (int i=0;imsg3_flush(); + msg3_flushed = false; backoff_param_ms = 0; // Instruct phy to configure PRACH @@ -343,7 +344,6 @@ void ra_proc::step_response_error() { } else { rInfo("Transmitting inmediatly (%d/%d)\n", preambleTransmissionCounter, preambleTransMax); state = RESOURCE_SELECTION; - exit(-1); } } } @@ -424,7 +424,10 @@ void ra_proc::step_contention_resolution() { void ra_proc::step_completition() { params_db->set_param(mac_interface_params::RA_PREAMBLEINDEX, 0); params_db->set_param(mac_interface_params::RA_MASKINDEX, 0); - mux_unit->msg3_flush(); + if (!msg3_flushed) { + mux_unit->msg3_flush(); + msg3_flushed = true; + } msg3_transmitted = false; } diff --git a/srsapps/ue/mac/src/ul_harq.cc b/srsapps/ue/mac/src/ul_harq.cc index df43dfa5d..32e7c0fc0 100644 --- a/srsapps/ue/mac/src/ul_harq.cc +++ b/srsapps/ue/mac/src/ul_harq.cc @@ -215,6 +215,7 @@ void ul_harq_entity::ul_harq_process::run_tti(uint32_t tti_tx, mac_interface_phy // Uplink grant in a RAR if (grant->is_from_rar) { + Info("Getting Msg3 buffer payload, grant size=%d bytes\n", grant->n_bytes); pdu_ptr = harq_entity->mux_unit->msg3_get(payload_buffer, grant->n_bytes); if (pdu_ptr) { generate_new_tx(tti_tx, true, grant, action); diff --git a/srsapps/ue/phy/src/phch_common.cc b/srsapps/ue/phy/src/phch_common.cc index 515410caf..8f8cf7be4 100644 --- a/srsapps/ue/phy/src/phch_common.cc +++ b/srsapps/ue/phy/src/phch_common.cc @@ -55,6 +55,9 @@ void phch_common::init(phy_params *_params, log *_log, radio *_radio, mac_interf mac = _mac; is_first_tx = true; sr_last_tx_tti = -1; + + pthread_mutex_init(&tx_mutex, NULL); + pthread_cond_init(&tx_cvar, NULL); } bool phch_common::ul_rnti_active(uint32_t tti) { @@ -172,6 +175,7 @@ void phch_common::worker_end(uint32_t tti, bool tx_enable, cf_t *buffer, uint32_t nof_samples, srslte_timestamp_t tx_time) { + pthread_mutex_lock(&tx_mutex); // Wait previous TTIs to be transmitted @@ -192,7 +196,7 @@ void phch_common::worker_end(uint32_t tti, bool tx_enable, } /* else do nothing, just update tti counter */ tx_tti_cnt = (tx_tti_cnt + 1) % 10240; - + pthread_cond_signal(&tx_cvar); pthread_mutex_unlock(&tx_mutex); } diff --git a/srsapps/ue/phy/src/phch_recv.cc b/srsapps/ue/phy/src/phch_recv.cc index b6bd579b8..2cc11bcb6 100644 --- a/srsapps/ue/phy/src/phch_recv.cc +++ b/srsapps/ue/phy/src/phch_recv.cc @@ -287,7 +287,7 @@ void phch_recv::run_thread() break; case SYNC_DONE: worker = (phch_worker*) workers_pool->wait_worker(); - if (worker) { + if (worker) { buffer = worker->get_buffer(); if (srslte_ue_sync_zerocopy(&ue_sync, buffer) == 1) { tti = (tti + 1) % 10240; @@ -297,10 +297,12 @@ void phch_recv::run_thread() worker->set_cfo(cfo); /* Compute TX time: Any transmission happens in TTI+4 thus advance 4 ms the reception time */ - srslte_timestamp_t rx_time, tx_time; + srslte_timestamp_t rx_time, tx_time, tx_time_prach; srslte_ue_sync_get_last_timestamp(&ue_sync, &rx_time); srslte_timestamp_copy(&tx_time, &rx_time); + srslte_timestamp_copy(&tx_time_prach, &rx_time); srslte_timestamp_add(&tx_time, 0, 4e-3 - time_adv_sec); + srslte_timestamp_add(&tx_time_prach, 0, 4e-3); worker->set_tx_time(tx_time); worker->set_tti(tti); @@ -311,7 +313,7 @@ void phch_recv::run_thread() Info("TX PRACH now. RX time: %d:%f, Now: %d:%f\n", rx_time.full_secs, rx_time.frac_secs, cur_time.full_secs, cur_time.frac_secs); // send prach if we have to - prach_buffer->send(radio_h, cfo, tx_time); + prach_buffer->send(radio_h, cfo, tx_time_prach); radio_h->tx_end(); } workers_pool->start_worker(worker); diff --git a/srsapps/ue/phy/src/phch_worker.cc b/srsapps/ue/phy/src/phch_worker.cc index af934fe60..0036a4aef 100644 --- a/srsapps/ue/phy/src/phch_worker.cc +++ b/srsapps/ue/phy/src/phch_worker.cc @@ -134,7 +134,6 @@ void phch_worker::work_imp() mac_interface_phy::tb_action_ul_t ul_action; bzero(&ul_action, sizeof(mac_interface_phy::tb_action_ul_t)); - /* Do FFT and extract PDCCH LLR, or quit if no actions are required in this subframe */ if (extract_fft_and_pdcch_llr()) { @@ -153,8 +152,8 @@ void phch_worker::work_imp() } if (dl_action.generate_ack_callback && dl_action.decode_enabled) { phy->mac->tb_decoded(dl_ack, dl_mac_grant.rnti_type, dl_mac_grant.pid); - dl_action.generate_ack = dl_action.generate_ack_callback(dl_action.generate_ack_callback_arg); - Info("Calling generate ACK callback returned=%d\n", dl_action.generate_ack); + dl_ack = dl_action.generate_ack_callback(dl_action.generate_ack_callback_arg); + Info("Calling generate ACK callback returned=%d\n", dl_ack); } if (dl_action.generate_ack) { set_uci_ack(dl_ack); @@ -170,7 +169,7 @@ void phch_worker::work_imp() /***** Uplink Processing + Transmission *******/ /* Generate UCI */ - set_uci_sr(); + set_uci_sr(); set_uci_cqi(); @@ -482,7 +481,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui void phch_worker::encode_pucch() { - if (uci_data.scheduling_request || uci_data.uci_cqi_len > 0 || uci_data.uci_ack_len > 0) + if (uci_data.scheduling_request || uci_data.uci_ack_len > 0) { if (srslte_ue_ul_pucch_encode(&ue_ul, uci_data, last_dl_pdcch_ncce, tti+4, signal_buffer)) { Error("Encoding PUCCH\n"); diff --git a/srsapps/ue/phy/src/prach.cc b/srsapps/ue/phy/src/prach.cc index 8ceafb903..3f357e221 100644 --- a/srsapps/ue/phy/src/prach.cc +++ b/srsapps/ue/phy/src/prach.cc @@ -66,6 +66,11 @@ bool prach::init_cell(srslte_cell_t cell_) cell = cell_; preamble_idx = -1; + Info("ConfigIdx=%d, RootSeq=%d, ZC=%d\n", + params_db->get_param(phy_interface_params::PRACH_CONFIG_INDEX), + params_db->get_param(phy_interface_params::PRACH_ROOT_SEQ_IDX), + params_db->get_param(phy_interface_params::PRACH_ZC_CONFIG)); + if (srslte_prach_init(&prach_obj, srslte_symbol_sz(cell.nof_prb), srslte_prach_get_preamble_format(params_db->get_param(phy_interface_params::PRACH_CONFIG_INDEX)), params_db->get_param(phy_interface_params::PRACH_ROOT_SEQ_IDX), diff --git a/srsapps/ue/phy/test/ue_itf_test_prach.cc b/srsapps/ue/phy/test/ue_itf_test_prach.cc index 1e658c1fa..0295eda3a 100644 --- a/srsapps/ue/phy/test/ue_itf_test_prach.cc +++ b/srsapps/ue/phy/test/ue_itf_test_prach.cc @@ -189,7 +189,6 @@ void config_phy() { my_phy.set_param(srslte::ue::phy_interface_params::PUCCH_N_PUCCH_1, 1); my_phy.set_param(srslte::ue::phy_interface_params::PUCCH_N_RB_2, 2); - my_phy.configure_prach_params(); my_phy.configure_ul_params(); } diff --git a/srslte/lib/ue/src/ue_ul.c b/srslte/lib/ue/src/ue_ul.c index d1b2523bd..d40b5d90f 100644 --- a/srslte/lib/ue/src/ue_ul.c +++ b/srslte/lib/ue/src/ue_ul.c @@ -278,7 +278,8 @@ int srslte_ue_ul_pucch_encode(srslte_ue_ul_t *q, srslte_uci_data_t uci_data, pucch2_bits[0] = uci_data.uci_ack; pucch2_bits[1] = uci_data.uci_ack_2; } else { - fprintf(stderr, "Unsupported combination of UCI parameters\n"); + fprintf(stderr, "Unsupported combination of UCI parameters: ack_len=%d, cqi_len=%d\n", + uci_data.uci_ack, uci_data.uci_cqi_len); return SRSLTE_ERROR; }