pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33889 )
Change subject: rlcmac: Avoid discard packets when in Countdown procedure ......................................................................
rlcmac: Avoid discard packets when in Countdown procedure
Discarding a packet through CoDel during Countdown procedure may end up in the transmitted CV=14..0 being incorrect, since we are not really yet recalculating them once we enter Countdown procedure. Hence, to make it simpler for now, avoid dropping packets when in Countdown procedure to avoid having to recalculate them.
Change-Id: I311302b5282767dc806b1dfe053994f175390b69 --- M include/osmocom/gprs/rlcmac/llc_queue.h M src/rlcmac/llc_queue.c M src/rlcmac/tbf_ul.c 3 files changed, 23 insertions(+), 4 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/include/osmocom/gprs/rlcmac/llc_queue.h b/include/osmocom/gprs/rlcmac/llc_queue.h index 842969e..331f33b 100644 --- a/include/osmocom/gprs/rlcmac/llc_queue.h +++ b/include/osmocom/gprs/rlcmac/llc_queue.h @@ -51,7 +51,7 @@
int gprs_rlcmac_llc_queue_enqueue(struct gprs_rlcmac_llc_queue *q, uint8_t *ll_pdu, unsigned int ll_pdu_len, enum osmo_gprs_rlcmac_llc_sapi sapi, uint8_t radio_prio); -struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q); +struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q, bool can_discard); uint8_t gprs_rlcmac_llc_queue_highest_radio_prio_pending(struct gprs_rlcmac_llc_queue *q);
void gprs_rlcmac_llc_queue_merge_prepend(struct gprs_rlcmac_llc_queue *q, struct gprs_rlcmac_llc_queue *old_q); diff --git a/src/rlcmac/llc_queue.c b/src/rlcmac/llc_queue.c index 3ff80d9..066df47 100644 --- a/src/rlcmac/llc_queue.c +++ b/src/rlcmac/llc_queue.c @@ -182,7 +182,7 @@ return msg; }
-struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q) +struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q, bool can_discard) { struct msgb *msg; struct timespec tv_now; @@ -194,7 +194,7 @@
while ((msg = gprs_rlcmac_llc_queue_pick_msg(q, &prioq))) { ehdr = msgb_l1(msg); - if (q->use_codel) { + if (can_discard && q->use_codel) { int bytes = gprs_rlcmac_llc_queue_octets(q); if (gprs_codel_control(&prioq->codel_state, &ehdr->recv_time, &tv_now, bytes)) { /* Drop frame: */ diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c index baa5ec0..6957658 100644 --- a/src/rlcmac/tbf_ul.c +++ b/src/rlcmac/tbf_ul.c @@ -375,7 +375,11 @@ llc_queue = gprs_rlcmac_ul_tbf_llc_queue(ul_tbf);
/* dequeue next LLC frame, if any */ - ul_tbf->llc_tx_msg = gprs_rlcmac_llc_queue_dequeue(llc_queue); + /* Improve: Ideally we could be able to discard as long as current CV !=0 + * (because we must tell PCU that we are done), and if a frame is discarded probably do: + * ul_tbf->countdown_proc.cv = gprs_rlcmac_ul_tbf_calculate_cv(ul_tbf); + */ + ul_tbf->llc_tx_msg = gprs_rlcmac_llc_queue_dequeue(llc_queue, !ul_tbf->countdown_proc.active); if (!ul_tbf->llc_tx_msg) return;