SRSUE: silent PUSCH encoding error by dropping invalid grant

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 739c0c5c00
commit 44c2412be2

@ -112,6 +112,13 @@ SRSLTE_API int srslte_pusch_set_rnti(srslte_pusch_t* q, uint16_t rnti);
SRSLTE_API void srslte_pusch_free_rnti(srslte_pusch_t* q, uint16_t rnti);
/**
* Asserts PUSCH grant attributes are in range
* @param grant Pointer to PUSCH grant
* @return it returns SRSLTE_SUCCESS if the grant is correct, otherwise it returns a SRSLTE_ERROR code
*/
SRSLTE_API int srslte_pusch_assert_grant(const srslte_pusch_grant_t* grant);
/* These functions do not modify the state and run in real-time */
SRSLTE_API int srslte_pusch_encode(srslte_pusch_t* q,
srslte_ul_sf_cfg_t* sf,

@ -340,6 +340,23 @@ static srslte_sequence_t* get_user_sequence(srslte_pusch_t* q, uint16_t rnti, ui
}
}
int srslte_pusch_assert_grant(const srslte_pusch_grant_t* grant)
{
if (!srslte_dft_precoding_valid_prb(grant->L_prb)) {
return SRSLTE_ERROR_INVALID_INPUTS;
}
if (grant->tb.rv < 0 || grant->tb.rv > 3) {
return SRSLTE_ERROR_OUT_OF_BOUNDS;
}
if (grant->tb.tbs < 0) {
return SRSLTE_ERROR_OUT_OF_BOUNDS;
}
return SRSLTE_SUCCESS;
}
/** Converts the PUSCH data bits to symbols mapped to the slot ready for transmission
*/
int srslte_pusch_encode(srslte_pusch_t* q,
@ -368,19 +385,9 @@ int srslte_pusch_encode(srslte_pusch_t* q,
return SRSLTE_ERROR_INVALID_INPUTS;
}
if (!srslte_dft_precoding_valid_prb(cfg->grant.L_prb)) {
ERROR("Error encoding PUSCH: invalid L_prb=%d\n", cfg->grant.L_prb);
return -1;
}
if (cfg->grant.tb.rv < 0 || cfg->grant.tb.rv > 3) {
ERROR("Error encoding PUSCH: invalid rv=%d\n", cfg->grant.tb.rv);
return -1;
}
if (cfg->grant.tb.tbs < 0) {
ERROR("Error encoding PUSCH: invalid tbs=%d\n", cfg->grant.tb.tbs);
return -1;
int err = srslte_pusch_assert_grant(&cfg->grant);
if (err != SRSLTE_SUCCESS) {
return err;
}
INFO("Encoding PUSCH SF: %d, Mod %s, RNTI: %d, TBS: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d\n",

@ -212,21 +212,21 @@ int srslte_ue_ul_dci_to_pusch_grant(srslte_ue_ul_t* q,
srslte_dci_ul_t* dci,
srslte_pusch_grant_t* grant)
{
// Convert DCI to Grant
if (srslte_ra_ul_dci_to_grant(&q->cell, sf, &cfg->ul_cfg.hopping, dci, grant)) {
char str[128];
srslte_dci_ul_info(dci, str, sizeof(str));
ERROR("Converting DCI to UL grant from %s\n", str);
return SRSLTE_ERROR;
}
// Update shortened before computing grant
srslte_refsignal_srs_pusch_shortened(&q->signals, sf, &cfg->ul_cfg.srs, &cfg->ul_cfg.pusch);
/* Update RE assuming if shortened is true */
// Update RE assuming if shortened is true
if (sf->shortened) {
srslte_ra_ul_compute_nof_re(grant, q->cell.cp, true);
}
return SRSLTE_SUCCESS;
// Assert Grant is valid
return srslte_pusch_assert_grant(grant);
}
void srslte_ue_ul_pusch_hopping(srslte_ue_ul_t* q,

@ -674,7 +674,11 @@ bool cc_worker::work_ul(srslte_uci_data_t* uci_data)
// Generate PHY grant
if (srslte_ue_ul_dci_to_pusch_grant(&ue_ul, &sf_cfg_ul, &ue_ul_cfg, &dci_ul, &ue_ul_cfg.ul_cfg.pusch.grant)) {
Error("Converting DCI message to UL dci\n");
if (log_h->get_level() >= srslte::LOG_LEVEL_ERROR) {
char str[128];
srslte_dci_ul_info(&dci_ul, str, sizeof(str));
Error("Converting DCI message to UL grant %s\n", str);
}
ul_grant_available = false;
} else if (ue_ul_cfg.ul_cfg.pusch.grant.tb.mod == SRSLTE_MOD_BPSK) {
Error("UL retransmission without valid stored grant.\n");

Loading…
Cancel
Save