pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/31575 )


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

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

Change-Id: I740fac72cb418d4b61499990b13208fcd4bb922f
---
M include/osmocom/gprs/rlcmac/llc_queue.h
M src/rlcmac/llc_queue.c
M src/rlcmac/rlcmac_enc.c
3 files changed, 37 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/75/31575/1

diff --git a/include/osmocom/gprs/rlcmac/llc_queue.h 
b/include/osmocom/gprs/rlcmac/llc_queue.h
index a0a91e4..80016e0 100644
--- a/include/osmocom/gprs/rlcmac/llc_queue.h
+++ b/include/osmocom/gprs/rlcmac/llc_queue.h
@@ -29,6 +29,7 @@
 };

 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 @@
 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)
 {
diff --git a/src/rlcmac/llc_queue.c b/src/rlcmac/llc_queue.c
index 2c1aeea..47cb1e9 100644
--- a/src/rlcmac/llc_queue.c
+++ b/src/rlcmac/llc_queue.c
@@ -46,6 +46,7 @@
        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 @@

 #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 @@
        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;
+}
diff --git a/src/rlcmac/rlcmac_enc.c b/src/rlcmac/rlcmac_enc.c
index 4b8c469..6bceb8d 100644
--- a/src/rlcmac/rlcmac_enc.c
+++ b/src/rlcmac/rlcmac_enc.c
@@ -400,7 +400,7 @@
                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 */

--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31575
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I740fac72cb418d4b61499990b13208fcd4bb922f
Gerrit-Change-Number: 31575
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to