aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-07-21 18:58:17 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-07-24 13:46:50 +0200
commit3ae18f65a80bd4e1238538386399e47a2da0d5d3 (patch)
tree552fee8efb14a90b2034503f607e9063f7cab437
parent8c935ca0a76da92a7b2eb60112d0c6bef94200c6 (diff)
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
-rw-r--r--include/osmocom/gprs/rlcmac/llc_queue.h2
-rw-r--r--src/rlcmac/llc_queue.c4
-rw-r--r--src/rlcmac/tbf_ul.c6
3 files changed, 8 insertions, 4 deletions
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 @@ void gprs_rlcmac_llc_queue_set_codel_params(struct gprs_rlcmac_llc_queue *q, boo
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 @@ static struct msgb *gprs_rlcmac_llc_queue_pick_msg(struct gprs_rlcmac_llc_queue
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 @@ struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q)
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 @@ void gprs_rlcmac_ul_tbf_schedule_next_llc_frame(struct gprs_rlcmac_ul_tbf *ul_tb
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;