Commit 5855f766 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Bugfix in ue pusch mac pdu creation

When more than one sdu with equal priority is present, there could be
buffer left after serving the lcids and also not enough for equaly
serving all lcids. This commit checks for this condition. Before this
fix the ue would send malformed mac pdus when serving multiple lcids.
parent 65d8d410
...@@ -3608,7 +3608,11 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac, ...@@ -3608,7 +3608,11 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
buflen_remain); buflen_remain);
if (num_lcids_same_priority == count_same_priority_lcids) { if (num_lcids_same_priority == count_same_priority_lcids) {
buflen_ep = (buflen_remain - (count_same_priority_lcids * sh_size)) / count_same_priority_lcids; const int32_t buflen_ep_tmp = (buflen_remain - (count_same_priority_lcids * sh_size)) / count_same_priority_lcids;
/* after serving equal priority LCIDs in the first round, buflen_remain could be > 0 and < (count_same_priority_lcids * sh_size)
if above division yeilds a remainder. hence the following sets buflen_ep to 0 if there is not enough buffer left for subsequent rounds
*/
buflen_ep = buflen_ep_tmp < 0 ? 0 : buflen_ep_tmp;
} }
while (buflen_remain > 0) { while (buflen_remain > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment