From c386bee3994ed1b6980c0a051ca6a44c4514624c Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 30 Jan 2018 12:52:31 +0100 Subject: [PATCH] Fixed PUSCH aperiodic report bug. --- lib/src/phy/phch/test/pusch_test.c | 2 +- lib/src/phy/ue/ue_ul.c | 1 - srsue/hdr/mac/ul_harq.h | 8 +++++++- srsue/src/phy/phch_worker.cc | 20 ++++++++++++++++---- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/lib/src/phy/phch/test/pusch_test.c b/lib/src/phy/phch/test/pusch_test.c index 651803617..a7a3c49bf 100644 --- a/lib/src/phy/phch/test/pusch_test.c +++ b/lib/src/phy/phch/test/pusch_test.c @@ -193,7 +193,7 @@ int main(int argc, char **argv) { uci_data_tx.uci_ack_len = 1; memcpy(&uci_data_rx, &uci_data_tx, sizeof(srslte_uci_data_t)); - for (uint32_t i=0;i<20;i++) { + for (uint32_t i=0;irnti_type == SRSLTE_RNTI_TEMP) && grant->ndi[0] != get_ndi() && harq_feedback) || + if (grant->has_cqi_request && grant->phy_grant.ul.mcs.tbs == 0) { + /* Only CQI reporting (without SCH) */ + memcpy(&action->phy_grant.ul, &grant->phy_grant.ul, sizeof(srslte_ra_ul_grant_t)); + memcpy(&cur_grant, grant, sizeof(Tgrant)); + action->tx_enabled = true; + action->rnti = grant->rnti; + } else if ((!(grant->rnti_type == SRSLTE_RNTI_TEMP) && grant->ndi[0] != get_ndi() && harq_feedback) || (grant->rnti_type == SRSLTE_RNTI_USER && !has_grant()) || grant->is_from_rar) { diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index 2910f07ff..0c05c5efa 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -771,7 +771,7 @@ bool phch_worker::decode_pdcch_ul(mac_interface_phy::mac_grant_t* grant) // Handle Format0 adaptive retx if (ret) { // Use last TBS for this TB in case of mcs>28 - if (grant->phy_grant.ul.mcs.idx > 28) { + if (grant->phy_grant.ul.mcs.idx > 28 && grant->phy_grant.ul.mcs.mod == SRSLTE_MOD_LAST) { // Make sure we received a grant in the previous TTI for this PID grant->phy_grant.ul.mcs.tbs = phy->last_ul_tbs[UL_PIDOF(TTI_TX(tti))]; grant->phy_grant.ul.mcs.mod = phy->last_ul_mod[UL_PIDOF(TTI_TX(tti))]; @@ -924,8 +924,16 @@ void phch_worker::set_uci_aperiodic_cqi() cqi_report.subband_hl.subband_diff_cqi_cw0 = 0; // Always report zero offset on all subbands cqi_report.subband_hl.N = (cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0; - Info("PUSCH: Aperiodic CQI=%d, SNR=%.1f dB, for %d subbands\n", cqi_report.wideband.wideband_cqi, phy->avg_snr_db, cqi_report.subband_hl.N); uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi); + + char cqi_str[64] = {0}; + srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64); + + Info("PUSCH: Aperiodic CQI=%s, SNR=%.1f dB, for %d subbands\n", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N); + + /* Fake RI = 1 */ + uci_data.uci_ri = 0; + uci_data.uci_ri_len = 0; } break; case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31: @@ -966,6 +974,11 @@ void phch_worker::set_uci_aperiodic_cqi() // TODO: implement subband CQI properly cqi_report.subband_hl.N = (uint32_t) ((cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0); + uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi); + + char cqi_str[64] = {0}; + srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64); + if (cqi_report.subband_hl.rank_is_not_one) { Info("PUSCH: Aperiodic ri~1, CQI=%02d/%02d, SINR=%2.1f/%2.1fdB, pmi=%d for %d subbands\n", cqi_report.subband_hl.wideband_cqi_cw0, cqi_report.subband_hl.wideband_cqi_cw1, @@ -975,7 +988,6 @@ void phch_worker::set_uci_aperiodic_cqi() cqi_report.subband_hl.wideband_cqi_cw0, sinr_db, pmi, cqi_report.subband_hl.N); } - uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi); } break; default: @@ -1048,7 +1060,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui (tti + HARQ_DELAY_MS) % 10240, grant->n_prb[0], grant->n_prb[0] + grant->L_prb, grant->mcs.tbs / 8, grant->mcs.idx, rv, - uci_data.uci_ack_len > 0 ? (uci_data.uci_ack ? ", ack=1" : "0") : "", + uci_data.uci_ack_len > 0 ? (uci_data.uci_ack ? ", ack=1" : ", ack=0") : "", uci_data.uci_ack_len > 1 ? (uci_data.uci_ack_2 ? "1" : "0") : "", uci_data.uci_ri_len > 0 ? (uci_data.uci_ri ? ", ri=1" : ", ri=0") : "", cfo * 15, timestr,