rlcmac: Fill radio_priority in Dl Ack/Nack Channel Request Description

Change-Id: I740fac72cb418d4b61499990b13208fcd4bb922f
This commit is contained in:
Pau Espin 2023-02-27 17:10:23 +01:00
parent 9a44df6084
commit aef4114abb
3 changed files with 28 additions and 12 deletions

View File

@ -29,6 +29,7 @@ enum gprs_rlcmac_llc_queue_sapi_prio { /* lowest value has highest prio */
};
struct gprs_llc_prio_queue {
uint8_t radio_prio; /* Radio prio of this queue, range (1..4) */
struct gprs_codel codel_state;
struct llist_head queue; /* queued LLC DL data. See enum gprs_rlcmac_llc_queue_prio. */
};
@ -51,6 +52,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);
uint8_t gprs_rlcmac_llc_queue_highest_radio_prio_pending(struct gprs_rlcmac_llc_queue *q);
static inline size_t gprs_rlcmac_llc_queue_size(const struct gprs_rlcmac_llc_queue *q)
{

View File

@ -46,6 +46,7 @@ struct gprs_rlcmac_llc_queue *gprs_rlcmac_llc_queue_alloc(struct gprs_rlcmac_ent
q->avg_queue_delay = 0;
for (i = 0; i < ARRAY_SIZE(q->pq); i++) {
for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) {
q->pq[i][j].radio_prio = i + 1; /* range (1..4) */
INIT_LLIST_HEAD(&q->pq[i][j].queue);
gprs_codel_init(&q->pq[i][j].codel_state);
}
@ -141,25 +142,31 @@ void gprs_rlcmac_llc_queue_clear(struct gprs_rlcmac_llc_queue *q)
#define ALPHA 0.5f
static struct gprs_llc_prio_queue *gprs_rlcmac_llc_queue_find_msg(struct gprs_rlcmac_llc_queue *q)
{
unsigned int i, j;
for (i = 0; i < ARRAY_SIZE(q->pq); i++) {
for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) {
if (!llist_empty(&q->pq[i][j].queue))
return &q->pq[i][j];
}
}
return NULL;
}
static struct msgb *gprs_rlcmac_llc_queue_pick_msg(struct gprs_rlcmac_llc_queue *q, struct gprs_llc_prio_queue **prioq)
{
struct msgb *msg;
struct timespec tv_now, tv_result;
uint32_t lifetime;
unsigned int i, j;
const struct llc_queue_entry_hdr *ehdr;
for (i = 0; i < ARRAY_SIZE(q->pq); i++) {
for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) {
if ((msg = msgb_dequeue(&q->pq[i][j].queue))) {
*prioq = &q->pq[i][j];
goto found;
}
}
}
return NULL;
*prioq = gprs_rlcmac_llc_queue_find_msg(q);
if (!(*prioq))
return NULL;
found:
msg = msgb_dequeue(&(*prioq)->queue);
ehdr = msgb_l1(msg);
q->queue_size -= 1;
@ -213,3 +220,10 @@ struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q)
msgb_pull_to_l2(msg);
return msg;
}
uint8_t gprs_rlcmac_llc_queue_highest_radio_prio_pending(struct gprs_rlcmac_llc_queue *q)
{
struct gprs_llc_prio_queue *prioq = gprs_rlcmac_llc_queue_find_msg(q);
OSMO_ASSERT(prioq);
return prioq->radio_prio;
}

View File

@ -400,7 +400,7 @@ void gprs_rlcmac_enc_prepare_pkt_downlink_ack_nack(RlcMacUplink_t *block, const
Channel_Request_Description_t *chan_req = &ack->Channel_Request_Description;
ack->Exist_Channel_Request_Description = 1;
chan_req->PEAK_THROUGHPUT_CLASS = 0; /* TODO */
chan_req->RADIO_PRIORITY = 0; /* TODO */
chan_req->RADIO_PRIORITY = gprs_rlcmac_llc_queue_highest_radio_prio_pending(dl_tbf->tbf.gre->llc_queue);
chan_req->RLC_MODE = GPRS_RLCMAC_RLC_MODE_ACKNOWLEDGED;
chan_req->LLC_PDU_TYPE = GPRS_RLCMAC_LLC_PDU_TYPE_ACKNOWLEDGED;
chan_req->RLC_OCTET_COUNT = 0; /* TODO */