osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/35338?usp=email )


Change subject: Revert "Revert "pdch_ul_controller: migrate from fn_cmp() to 
gsm0502_fncmp()""
......................................................................

Revert "Revert "pdch_ul_controller: migrate from fn_cmp() to gsm0502_fncmp()""

Now that 1.4.0 is released, bring back the patch that was temporarily
reverted to avoid the need for a new libosmocore.

This reverts commit 16729ba72761fc981bcec6d3747d6f7dab4413ca.

Change-Id: Idd113e328a693df2e8f2f5d172eaf5bf2bfcf009
---
M TODO-RELEASE
M src/pdch_ul_controller.c
2 files changed, 21 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/38/35338/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index cbfda24..73ad83b 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library        what            description / commit summary line
+libosmocore > 1.9.0            added gsm0502_fncmp()
diff --git a/src/pdch_ul_controller.c b/src/pdch_ul_controller.c
index c0e26de..661957b 100644
--- a/src/pdch_ul_controller.c
+++ b/src/pdch_ul_controller.c
@@ -17,6 +17,8 @@
 #include <unistd.h>
 #include <talloc.h>

+#include <osmocom/gsm/gsm0502.h>
+
 #include "pdch_ul_controller.h"
 #include "bts.h"
 #include "sba.h"
@@ -43,20 +45,6 @@
        { 0, NULL }
 };

-#define GSM_MAX_FN_THRESH (GSM_MAX_FN >> 1)
-/* 0: equal, -1: fn1 BEFORE fn2, 1: fn1 AFTER fn2 */
-static inline int fn_cmp(uint32_t fn1, uint32_t fn2)
-{
-       if (fn1 == fn2)
-               return 0;
-       /* FN1 goes before FN2: */
-       if ((fn1 < fn2 && (fn2 - fn1) < GSM_MAX_FN_THRESH) ||
-           (fn1 > fn2 && (fn1 - fn2) > GSM_MAX_FN_THRESH))
-               return -1;
-       /* FN1 goes after FN2: */
-       return 1;
-}
-
 struct pdch_ulc *pdch_ulc_alloc(struct gprs_rlcmac_pdch *pdch, void *ctx)
 {
        struct pdch_ulc* ulc;
@@ -78,7 +66,7 @@

        while (node) {
                it = rb_entry(node, struct pdch_ulc_node, node);
-               res = fn_cmp(it->fn, fn);
+               res = gsm0502_fncmp(it->fn, fn);
                if (res > 0) /* it->fn AFTER fn */
                        node = node->rb_left;
                else if (res < 0) /* it->fn BEFORE fn */
@@ -167,7 +155,7 @@

        for (node = rb_first(&ulc->tree_root); node; node = rb_next(node)) {
                it = container_of(node, struct pdch_ulc_node, node);
-               res = fn_cmp(it->fn, check_fn);
+               res = gsm0502_fncmp(it->fn, check_fn);
                if (res > 0) { /* it->fn AFTER check_fn */
                        /* Next reserved FN is passed check_fn, hence it means 
check_fn is free */
                        return check_fn;
@@ -203,7 +191,7 @@
                it = container_of(*n, struct pdch_ulc_node, node);

                parent = *n;
-               res = fn_cmp(item->fn, it->fn);
+               res = gsm0502_fncmp(item->fn, it->fn);
                if (res < 0) { /* item->fn "BEFORE" it->fn */
                        n = &((*n)->rb_left);
                } else if (res > 0) { /* item->fn "AFTER" it->fn */
@@ -305,7 +293,7 @@
        struct rb_node *first;
        while ((first = rb_first(&ulc->tree_root))) {
                item = container_of(first, struct pdch_ulc_node, node);
-               res = fn_cmp(item->fn, fn);
+               res = gsm0502_fncmp(item->fn, fn);
                if (res > 0) /* item->fn AFTER fn */
                        break;
                if (res < 0) { /* item->fn BEFORE fn */

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/35338?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Idd113e328a693df2e8f2f5d172eaf5bf2bfcf009
Gerrit-Change-Number: 35338
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to