Fixed PUSCH retransmission bug, last RI report and RI trace format

master
Xavier Arteaga 7 years ago
parent 9ffdb1e62d
commit 9ca4f4ab9e

@ -87,14 +87,29 @@ public:
bool is_pending[TTIMOD_SZ][SRSLTE_MAX_TB]; bool is_pending[TTIMOD_SZ][SRSLTE_MAX_TB];
uint16_t n_pdcch[TTIMOD_SZ]; uint16_t n_pdcch[TTIMOD_SZ];
} pending_ack_t; } pending_ack_t;
std::map<uint16_t,pending_ack_t> pending_ack;
class common_ue {
public:
pending_ack_t pending_ack;
uint8_t ri;
int last_ul_tbs[2*HARQ_DELAY_MS];
srslte_mod_t last_ul_mod[2*HARQ_DELAY_MS];
};
std::map<uint16_t, common_ue> common_ue_db;
void ack_add_rnti(uint16_t rnti); void ue_db_add_rnti(uint16_t rnti);
void ack_rem_rnti(uint16_t rnti); void ue_db_rem_rnti(uint16_t rnti);
void ack_clear(uint32_t sf_idx); void ue_db_clear(uint32_t sf_idx);
void ack_set_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t n_pdcch); void ue_db_set_ack_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t n_pdcch);
bool ack_is_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t *last_n_pdcch = NULL); bool ue_db_is_ack_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t *last_n_pdcch = NULL);
void ue_db_set_ri(uint16_t rnti, uint8_t ri);
uint8_t ue_db_get_ri(uint16_t rnti);
void ue_db_set_last_ul_mod(uint16_t rnti, uint32_t tti, srslte_mod_t mcs);
srslte_mod_t ue_db_get_last_ul_mod(uint16_t rnti, uint32_t tti);
void ue_db_set_last_ul_tbs(uint16_t rnti, uint32_t tti, int tbs);
int ue_db_get_last_ul_tbs(uint16_t rnti, uint32_t tti);
private: private:
std::vector<pthread_mutex_t> tx_mutex; std::vector<pthread_mutex_t> tx_mutex;
bool is_first_tx; bool is_first_tx;

@ -121,8 +121,6 @@ private:
void metrics_ul(uint32_t mcs, float rssi, float sinr, uint32_t turbo_iters); void metrics_ul(uint32_t mcs, float rssi, float sinr, uint32_t turbo_iters);
int last_dl_tbs[2*HARQ_DELAY_MS][SRSLTE_MAX_CODEWORDS]; int last_dl_tbs[2*HARQ_DELAY_MS][SRSLTE_MAX_CODEWORDS];
int last_ul_tbs[2*HARQ_DELAY_MS];
srslte_mod_t last_ul_mod[2*HARQ_DELAY_MS];
private: private:
phy_metrics_t metrics; phy_metrics_t metrics;

@ -408,7 +408,11 @@ void ue::metrics_phr(float phr) {
} }
void ue::metrics_dl_ri(uint32_t dl_ri) { void ue::metrics_dl_ri(uint32_t dl_ri) {
metrics.dl_ri = SRSLTE_VEC_EMA((float) dl_ri, metrics.dl_ri, 0.5f); if (metrics.dl_ri == 0.0f) {
metrics.dl_ri = (float) dl_ri + 1.0f;
} else {
metrics.dl_ri = SRSLTE_VEC_EMA((float) dl_ri + 1.0f, metrics.dl_ri, 0.5f);
}
dl_ri_counter++; dl_ri_counter++;
} }

@ -123,7 +123,7 @@ void metrics_stdout::print_metrics()
cout << std::hex << metrics.mac[i].rnti << " "; cout << std::hex << metrics.mac[i].rnti << " ";
cout << float_to_string(metrics.mac[i].dl_cqi, 2); cout << float_to_string(metrics.mac[i].dl_cqi, 2);
cout << float_to_string(metrics.mac[i].dl_ri + 1, 3); cout << float_to_string(metrics.mac[i].dl_ri, 3);
cout << float_to_string(metrics.phy[i].dl.mcs, 2); cout << float_to_string(metrics.phy[i].dl.mcs, 2);
if (metrics.mac[i].tx_brate > 0 && metrics_report_period) { if (metrics.mac[i].tx_brate > 0 && metrics_report_period) {
cout << float_to_eng_string((float) metrics.mac[i].tx_brate/metrics_report_period, 2); cout << float_to_eng_string((float) metrics.mac[i].tx_brate/metrics_report_period, 2);

@ -93,45 +93,45 @@ void phch_common::worker_end(uint32_t tx_mutex_cnt, cf_t* buffer[SRSLTE_MAX_PORT
mac->tti_clock(); mac->tti_clock();
} }
void phch_common::ack_clear(uint32_t sf_idx) void phch_common::ue_db_clear(uint32_t sf_idx)
{ {
for(std::map<uint16_t,pending_ack_t>::iterator iter=pending_ack.begin(); iter!=pending_ack.end(); ++iter) { for(std::map<uint16_t,common_ue>::iterator iter=common_ue_db.begin(); iter!=common_ue_db.end(); ++iter) {
pending_ack_t *p = (pending_ack_t*) &iter->second; pending_ack_t *p = &((common_ue*)&iter->second)->pending_ack;
for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) { for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) {
p->is_pending[sf_idx][tb_idx] = false; p->is_pending[sf_idx][tb_idx] = false;
} }
} }
} }
void phch_common::ack_add_rnti(uint16_t rnti) void phch_common::ue_db_add_rnti(uint16_t rnti)
{ {
for (int sf_idx=0;sf_idx<TTIMOD_SZ;sf_idx++) { for (int sf_idx=0;sf_idx<TTIMOD_SZ;sf_idx++) {
for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) { for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) {
pending_ack[rnti].is_pending[sf_idx][tb_idx] = false; common_ue_db[rnti].pending_ack.is_pending[sf_idx][tb_idx] = false;
} }
} }
} }
void phch_common::ack_rem_rnti(uint16_t rnti) void phch_common::ue_db_rem_rnti(uint16_t rnti)
{ {
pending_ack.erase(rnti); common_ue_db.erase(rnti);
} }
void phch_common::ack_set_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t last_n_pdcch) void phch_common::ue_db_set_ack_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t last_n_pdcch)
{ {
if (pending_ack.count(rnti)) { if (common_ue_db.count(rnti)) {
pending_ack[rnti].is_pending[sf_idx][tb_idx] = true; common_ue_db[rnti].pending_ack.is_pending[sf_idx][tb_idx] = true;
pending_ack[rnti].n_pdcch[sf_idx] = (uint16_t) last_n_pdcch; common_ue_db[rnti].pending_ack.n_pdcch[sf_idx] = (uint16_t) last_n_pdcch;
} }
} }
bool phch_common::ack_is_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t *last_n_pdcch) { bool phch_common::ue_db_is_ack_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx, uint32_t *last_n_pdcch) {
if (pending_ack.count(rnti)) { if (common_ue_db.count(rnti)) {
bool ret = pending_ack[rnti].is_pending[sf_idx][tb_idx]; bool ret = common_ue_db[rnti].pending_ack.is_pending[sf_idx][tb_idx];
pending_ack[rnti].is_pending[sf_idx][tb_idx] = false; common_ue_db[rnti].pending_ack.is_pending[sf_idx][tb_idx] = false;
if (ret && last_n_pdcch) { if (ret && last_n_pdcch) {
*last_n_pdcch = pending_ack[rnti].n_pdcch[sf_idx]; *last_n_pdcch = common_ue_db[rnti].pending_ack.n_pdcch[sf_idx];
} }
return ret; return ret;
} else { } else {
@ -139,4 +139,41 @@ bool phch_common::ack_is_pending(uint32_t sf_idx, uint16_t rnti, uint32_t tb_idx
} }
} }
void phch_common::ue_db_set_ri(uint16_t rnti, uint8_t ri) {
if (common_ue_db.count(rnti)) {
common_ue_db[rnti].ri = ri;
}
}
uint8_t phch_common::ue_db_get_ri(uint16_t rnti) {
uint8_t ret = 0;
if (common_ue_db.count(rnti)) {
ret = common_ue_db[rnti].ri;
}
return ret;
}
void phch_common::ue_db_set_last_ul_mod(uint16_t rnti, uint32_t tti, srslte_mod_t mcs) {
if (common_ue_db.count(rnti)) {
common_ue_db[rnti].last_ul_mod[TTI_RX(tti)%(2*HARQ_DELAY_MS)] = mcs;
}
}
srslte_mod_t phch_common::ue_db_get_last_ul_mod(uint16_t rnti, uint32_t tti) {
srslte_mod_t ret = SRSLTE_MOD_BPSK;
if (common_ue_db.count(rnti)) {
ret = common_ue_db[rnti].last_ul_mod[TTI_RX(tti)%(2*HARQ_DELAY_MS)];
}
return ret;
}
void phch_common::ue_db_set_last_ul_tbs(uint16_t rnti, uint32_t tti, int tbs) {
if (common_ue_db.count(rnti)) {
common_ue_db[rnti].last_ul_tbs[TTI_RX(tti)%(2*HARQ_DELAY_MS)] = tbs;
}
}
int phch_common::ue_db_get_last_ul_tbs(uint16_t rnti, uint32_t tti) {
int ret = 0;
if (common_ue_db.count(rnti)) {
ret = common_ue_db[rnti].last_ul_tbs[TTI_RX(tti)%(2*HARQ_DELAY_MS)];
}
return ret;
}
} }

@ -398,7 +398,7 @@ void phch_worker::work_imp()
encode_phich(ul_grants[t_tx_ul].phich, ul_grants[t_tx_ul].nof_phich); encode_phich(ul_grants[t_tx_ul].phich, ul_grants[t_tx_ul].nof_phich);
// Prepare for receive ACK for DL grants in t_tx_dl+4 // Prepare for receive ACK for DL grants in t_tx_dl+4
phy->ack_clear(TTIMOD(TTI_TX(t_tx_dl))); phy->ue_db_clear(TTIMOD(TTI_TX(t_tx_dl)));
for (uint32_t i=0;i<dl_grants[t_tx_dl].nof_grants;i++) { for (uint32_t i=0;i<dl_grants[t_tx_dl].nof_grants;i++) {
// SI-RNTI and RAR-RNTI do not have ACK // SI-RNTI and RAR-RNTI do not have ACK
uint16_t rnti = dl_grants[t_tx_dl].sched_grants[i].rnti; uint16_t rnti = dl_grants[t_tx_dl].sched_grants[i].rnti;
@ -407,7 +407,10 @@ void phch_worker::work_imp()
for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) { for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) {
/* If TB enabled, set pending ACK */ /* If TB enabled, set pending ACK */
if (dl_grants[t_tx_dl].sched_grants[i].grant.tb_en[tb_idx]) { if (dl_grants[t_tx_dl].sched_grants[i].grant.tb_en[tb_idx]) {
phy->ack_set_pending(TTIMOD(TTI_TX(t_tx_dl)), rnti, tb_idx, dl_grants[t_tx_dl].sched_grants[i].location.ncce); phy->ue_db_set_ack_pending(TTIMOD(TTI_TX(t_tx_dl)),
rnti,
tb_idx,
dl_grants[t_tx_dl].sched_grants[i].location.ncce);
} }
} }
} }
@ -463,7 +466,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
// Get pending ACKs with an associated PUSCH transmission // Get pending ACKs with an associated PUSCH transmission
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) { for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {
acks_pending[tb] = phy->ack_is_pending(t_rx, rnti, tb); acks_pending[tb] = phy->ue_db_is_ack_pending(t_rx, rnti, tb);
if (acks_pending[tb]) { if (acks_pending[tb]) {
uci_data.uci_ack_len++; uci_data.uci_ack_len++;
} }
@ -481,6 +484,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
cqi_enabled = true; cqi_enabled = true;
if (ue_db[rnti].dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) { if (ue_db[rnti].dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) {
cqi_value.wideband.pmi_present = true; cqi_value.wideband.pmi_present = true;
cqi_value.wideband.rank_is_not_one = phy->ue_db_get_ri(rnti) > 0;
} }
} else if (grants[i].grant.cqi_request) { } else if (grants[i].grant.cqi_request) {
cqi_value.type = SRSLTE_CQI_TYPE_SUBBAND_HL; cqi_value.type = SRSLTE_CQI_TYPE_SUBBAND_HL;
@ -493,6 +497,7 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
cqi_value.subband_hl.N = (phy->cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(phy->cell.nof_prb) : 0; cqi_value.subband_hl.N = (phy->cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(phy->cell.nof_prb) : 0;
cqi_value.subband_hl.four_antenna_ports = (phy->cell.nof_ports == 4); cqi_value.subband_hl.four_antenna_ports = (phy->cell.nof_ports == 4);
cqi_value.subband_hl.pmi_present = (ue_db[rnti].dedicated.cqi_report_cnfg.report_mode_aperiodic == LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31); cqi_value.subband_hl.pmi_present = (ue_db[rnti].dedicated.cqi_report_cnfg.report_mode_aperiodic == LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31);
cqi_value.subband_hl.rank_is_not_one = phy->ue_db_get_ri(rnti) > 0;
cqi_enabled = true; cqi_enabled = true;
} }
@ -506,16 +511,16 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
// Handle Format0 adaptive retx // Handle Format0 adaptive retx
// Use last TBS for this TB in case of mcs>28 // Use last TBS for this TB in case of mcs>28
if (phy_grant.mcs.idx > 28) { if (phy_grant.mcs.idx > 28) {
phy_grant.mcs.tbs = ue_db[rnti].last_ul_tbs[TTI_RX(tti_rx)%(2*HARQ_DELAY_MS)]; phy_grant.mcs.tbs = phy->ue_db_get_last_ul_tbs(rnti, tti_rx);
Info("RETX: mcs=%d, old_tbs=%d pid=%d\n", phy_grant.mcs.idx, phy_grant.mcs.tbs, TTI_TX(tti_rx)%(2*HARQ_DELAY_MS)); Info("RETX: mcs=%d, old_tbs=%d pid=%d\n", phy_grant.mcs.idx, phy_grant.mcs.tbs, TTI_TX(tti_rx)%(2*HARQ_DELAY_MS));
} }
ue_db[rnti].last_ul_tbs[TTI_RX(tti_rx)%(2*HARQ_DELAY_MS)] = phy_grant.mcs.tbs; phy->ue_db_set_last_ul_tbs(rnti, tti_rx, phy_grant.mcs.tbs);
if (phy_grant.mcs.mod == SRSLTE_MOD_LAST) { if (phy_grant.mcs.mod == SRSLTE_MOD_LAST) {
phy_grant.mcs.mod = ue_db[rnti].last_ul_mod[TTI_RX(tti_rx)%(2*HARQ_DELAY_MS)]; phy_grant.mcs.mod = phy->ue_db_get_last_ul_mod(rnti, tti_rx);
phy_grant.Qm = srslte_mod_bits_x_symbol(phy_grant.mcs.mod); phy_grant.Qm = srslte_mod_bits_x_symbol(phy_grant.mcs.mod);
} }
ue_db[rnti].last_ul_mod[TTI_RX(tti_rx)%(2*HARQ_DELAY_MS)] = phy_grant.mcs.mod; phy->ue_db_set_last_ul_mod(rnti, tti_rx, phy_grant.mcs.mod);
if (phy_grant.mcs.mod == SRSLTE_MOD_64QAM) { if (phy_grant.mcs.mod == SRSLTE_MOD_64QAM) {
@ -636,11 +641,12 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
} }
if (uci_data.uci_ri_len > 0 && crc_res) { if (uci_data.uci_ri_len > 0 && crc_res) {
phy->mac->ri_info(tti_rx, rnti, uci_data.uci_ri); phy->mac->ri_info(tti_rx, rnti, uci_data.uci_ri);
phy->ue_db_set_ri(rnti, uci_data.uci_ri);
} }
if (wideband_pmi_present && crc_res) { if (wideband_pmi_present && crc_res) {
phy->mac->pmi_info(tti_rx, rnti, wideband_pmi); phy->mac->pmi_info(tti_rx, rnti, wideband_pmi);
} }
ue_db[rnti].
// Save metrics stats // Save metrics stats
ue_db[rnti].metrics_ul(phy_grant.mcs.idx, 0, snr_db, srslte_pusch_last_noi(&enb_ul.pusch)); ue_db[rnti].metrics_ul(phy_grant.mcs.idx, 0, snr_db, srslte_pusch_last_noi(&enb_ul.pusch));
} }
@ -671,7 +677,7 @@ int phch_worker::decode_pucch()
} }
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) { for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {
needs_ack[tb] = phy->ack_is_pending(t_rx, rnti, tb, &last_n_pdcch); needs_ack[tb] = phy->ue_db_is_ack_pending(t_rx, rnti, tb, &last_n_pdcch);
if (needs_ack[tb]) { if (needs_ack[tb]) {
needs_pucch = true; needs_pucch = true;
uci_data.uci_ack_len++; uci_data.uci_ack_len++;
@ -692,6 +698,7 @@ int phch_worker::decode_pucch()
cqi_value.type = SRSLTE_CQI_TYPE_WIDEBAND; cqi_value.type = SRSLTE_CQI_TYPE_WIDEBAND;
if (tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) { if (tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) {
cqi_value.wideband.pmi_present = true; cqi_value.wideband.pmi_present = true;
cqi_value.wideband.rank_is_not_one = phy->ue_db_get_ri(rnti) > 0;
} }
uci_data.uci_cqi_len = (uint32_t) srslte_cqi_size(&cqi_value); uci_data.uci_cqi_len = (uint32_t) srslte_cqi_size(&cqi_value);
} }
@ -719,6 +726,7 @@ int phch_worker::decode_pucch()
if (srslte_pucch_get_last_corr(&enb_ul.pucch) > PUCCH_RL_CORR_TH) { if (srslte_pucch_get_last_corr(&enb_ul.pucch) > PUCCH_RL_CORR_TH) {
if (uci_data.ri_periodic_report) { if (uci_data.ri_periodic_report) {
phy->mac->ri_info(tti_rx, rnti, uci_data.uci_ri); phy->mac->ri_info(tti_rx, rnti, uci_data.uci_ri);
phy->ue_db_set_ri(rnti, uci_data.uci_ri);
sprintf(cqi_ri_str, ", ri=%d", uci_data.uci_ri); sprintf(cqi_ri_str, ", ri=%d", uci_data.uci_ri);
} else if (uci_data.uci_cqi_len && needs_cqi) { } else if (uci_data.uci_cqi_len && needs_cqi) {
srslte_cqi_value_unpack(uci_data.uci_cqi, &cqi_value); srslte_cqi_value_unpack(uci_data.uci_cqi, &cqi_value);

@ -156,7 +156,7 @@ uint32_t phy::tti_to_subf(uint32_t tti) {
int phy::add_rnti(uint16_t rnti) int phy::add_rnti(uint16_t rnti)
{ {
if (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END) { if (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END) {
workers_common.ack_add_rnti(rnti); workers_common.ue_db_add_rnti(rnti);
} }
for (uint32_t i=0;i<nof_workers;i++) { for (uint32_t i=0;i<nof_workers;i++) {
if (workers[i].add_rnti(rnti)) { if (workers[i].add_rnti(rnti)) {
@ -169,7 +169,7 @@ int phy::add_rnti(uint16_t rnti)
void phy::rem_rnti(uint16_t rnti) void phy::rem_rnti(uint16_t rnti)
{ {
if (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END) { if (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END) {
workers_common.ack_rem_rnti(rnti); workers_common.ue_db_rem_rnti(rnti);
} }
for (uint32_t i=0;i<nof_workers;i++) { for (uint32_t i=0;i<nof_workers;i++) {
workers[i].rem_rnti(rnti); workers[i].rem_rnti(rnti);

Loading…
Cancel
Save