Fixed bug in dl_harq incorrectly identifying duplicate packets

This commit is contained in:
ismagom 2015-06-19 00:23:32 +02:00
parent 3039de17f9
commit e693e454d2
7 changed files with 43 additions and 17 deletions

View File

@ -174,7 +174,7 @@ void dl_harq_entity::dl_harq_process::receive_data(uint32_t tti, srslte::ue::dl_
}
}
} else {
Warning("DL PID %d: Received duplicate TB. Discarting and retransmitting ACK\n");
Warning("DL PID %d: Received duplicate TB. Discarting and retransmitting ACK\n", pid);
}
if (pid == HARQ_BCCH_PID || harq_entity->timers_db->get(mac::TIME_ALIGNMENT)->is_expired()) {
// Do not generate ACK
@ -203,13 +203,24 @@ void dl_harq_entity::dl_harq_process::receive_data(uint32_t tti, srslte::ue::dl_
void dl_harq_entity::dl_harq_process::set_harq_info(srslte::ue::dl_sched_grant* new_grant) {
bool is_new_transmission = false;
if ((new_grant->get_ndi() != cur_grant.get_ndi() && new_grant->get_tbs() == cur_grant.get_tbs()) || // NDI toggled for same TB (assume TB is identified by TBS)
(pid == HARQ_BCCH_PID && new_grant->get_rv() == 0) || // Broadcast PID and 1st TX (RV=0)
(new_grant->get_tbs() != cur_grant.get_tbs())) // First transmission for this TB
bool is_new_tb = true;
if (srslte_tti_interval(new_grant->get_tti(), cur_grant.get_tti()) <= 8 &&
new_grant->get_tbs() == cur_grant.get_tbs())
{
is_new_tb = false;
}
if ((new_grant->get_ndi() != cur_grant.get_ndi() && !is_new_tb) || // NDI toggled for same TB
is_new_tb || // is new TB
(pid == HARQ_BCCH_PID && new_grant->get_rv() == 0)) // Broadcast PID and 1st TX (RV=0)
{
is_new_transmission = true;
Debug("Set HARQ Info for new transmission\n");
} else {
if (!is_new_tb) {
Info("old_tbs=%d, new_tbs=%d, old_tti=%d new_tti=%d\n", cur_grant.get_tbs(), new_grant->get_tbs(),
cur_grant.get_tti(), new_grant->get_tti());
}
is_new_transmission = false;
Debug("Set HARQ Info for retransmission\n");
}

View File

@ -152,14 +152,6 @@ bool ra_proc::is_error() {
return state == RA_PROBLEM;
}
uint32_t interval(uint32_t x1, uint32_t x2) {
if (x1 > x2) {
return x1-x2;
} else {
return 10240-x2+x1;
}
}
const char* state_str[11] = {"Idle",
"RA Initializat.: ",
"RA Initial.Wait: ",
@ -277,7 +269,7 @@ void ra_proc::step_response_reception() {
ra_rnti = 1+ra_tti%10; // f_id=0 for FDD
dl_sched_grant rar_grant(ra_rnti);
uint32_t interval_ra = interval(tti, ra_tti);
uint32_t interval_ra = srslte_tti_interval(tti, ra_tti);
// Try to decode RAR only within the RA response window
if (interval_ra >= 3 && interval_ra <= 3+responseWindowSize) {
@ -402,7 +394,7 @@ void ra_proc::step_response_error() {
}
void ra_proc::step_backoff_wait() {
if (interval(tti, backoff_interval_start) >= backoff_inteval) {
if (srslte_tti_interval(tti, backoff_interval_start) >= backoff_inteval) {
state = RESOURCE_SELECTION;
}
}

View File

@ -80,6 +80,12 @@ namespace ue {
bool is_tpc_rnti() {
return (rnti_type == RNTI_TYPE_TPC_PUSCH || rnti_type == RNTI_TYPE_TPC_PUCCH);
}
uint32_t get_tti() {
return tti;
}
void set_tti(uint32_t tti_) {
tti = tti_;
}
virtual uint32_t get_rv() = 0;
virtual void set_rv(uint32_t rv) = 0;
virtual bool get_ndi() = 0;
@ -89,6 +95,7 @@ namespace ue {
protected:
uint16_t rnti;
rnti_type_t rnti_type;
uint32_t tti;
};
}

View File

@ -117,6 +117,8 @@ bool dl_buffer::get_ul_grant(ul_sched_grant *grant)
return false;
}
grant->set_tti(tti);
Info("PDCCH: UL DCI Format0 cce_index=%d, n_data_bits=%d\n", ue_dl.last_n_cce, dci_msg.nof_bits);
return grant->create_from_dci(&dci_msg, cell, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
@ -167,7 +169,9 @@ bool dl_buffer::get_dl_grant(dl_sched_grant *grant)
if (srslte_ue_dl_find_dl_dci(&ue_dl, &dci_msg, cfi, tti%10, grant->get_rnti()) != 1) {
return false;
}
grant->set_tti(tti);
Info("PDCCH: DL DCI %s cce_index=%d, n_data_bits=%d\n", grant->get_dciformat_string(), ue_dl.last_n_cce, dci_msg.nof_bits);
return grant->create_from_dci(&dci_msg, cell.nof_prb, srslte_ue_dl_get_ncce(&ue_dl));

View File

@ -299,7 +299,7 @@ void ul_buffer::set_tx_params(float cfo_, float time_adv_sec, srslte_timestamp_t
void ul_buffer::set_end_of_burst()
{
Info("Is end of burst\n");
Info("TTI %d Is end of burst\n", tti);
tti_is_end_of_burst = true;
}

View File

@ -244,6 +244,7 @@ SRSLTE_API int srslte_band_get_fd_region(enum band_geographical_area region,
SRSLTE_API int srslte_str2mimotype(char *mimo_type_str,
srslte_mimo_type_t *type);
SRSLTE_API uint32_t srslte_tti_interval(uint32_t tti1,
uint32_t tti2);
#endif

View File

@ -422,3 +422,14 @@ int srslte_band_get_fd_region(enum band_geographical_area region, srslte_earfcn_
return nof_fd;
}
/* Returns the interval tti1-tti2 mod 10240 */
uint32_t srslte_tti_interval(uint32_t tti1, uint32_t tti2) {
if (tti1 > tti2) {
return tti1-tti2;
} else {
return 10240-tti2+tti1;
}
}