mac_sch_pdu_nr,bsr: fix length check for BSR

fix nasty bug where the length calucation for the LCID
was taking the bsr_format_nr_t that was having the same name.
master
Andre Puschmann 3 years ago
parent 1bffebe0bf
commit 7cbd3d50b7

@ -254,12 +254,14 @@ uint32_t mac_sch_subpdu_nr::sizeof_ce(uint32_t lcid, bool is_ul)
return 8;
case CRNTI:
return 2;
case SHORT_TRUNC_BSR:
return 1;
case SHORT_BSR:
case SHORT_TRUNC_BSR:
return 1;
case SE_PHR:
return 2;
case LONG_BSR:
case LONG_TRUNC_BSR:
return 1; // minimum size, could be more than that
case PADDING:
return 0;
}

@ -219,11 +219,14 @@ void proc_bsr_nr::set_padding_bytes(uint32_t nof_bytes)
const uint32_t LBSR_CE_SUBHEADER_LEN = 1;
// if the number of padding bits is equal to or larger than the size of the Short BSR plus its subheader but smaller
// than the size of the Long BSR plus its subheader
if (nof_bytes >= SBSR_CE_SUBHEADER_LEN + srsran::mac_sch_subpdu_nr::sizeof_ce(SHORT_BSR, true) &&
nof_bytes < LBSR_CE_SUBHEADER_LEN + srsran::mac_sch_subpdu_nr::sizeof_ce(LONG_BSR, true)) {
if (nof_bytes >= (SBSR_CE_SUBHEADER_LEN +
srsran::mac_sch_subpdu_nr::sizeof_ce(srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::SHORT_BSR, true)) &&
nof_bytes < (LBSR_CE_SUBHEADER_LEN +
srsran::mac_sch_subpdu_nr::sizeof_ce(srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::LONG_BSR, true))) {
// generate short padding BSR
mux->generate_bsr_mac_ce(SHORT_BSR);
} else if (nof_bytes >= LBSR_CE_SUBHEADER_LEN + srsran::mac_sch_subpdu_nr::sizeof_ce(LONG_BSR, true)) {
} else if (nof_bytes >= (LBSR_CE_SUBHEADER_LEN + srsran::mac_sch_subpdu_nr::sizeof_ce(
srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::LONG_BSR, true))) {
// report Long BSR if more than one LCG has data to send
mux->generate_bsr_mac_ce(LONG_BSR);
}

Loading…
Cancel
Save