pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/18857 )

Change subject: scheduler: Early return in _sched_dequeue_prim() and clarify FN 
cases
......................................................................

scheduler: Early return in _sched_dequeue_prim() and clarify FN cases

We should always expect the msgb queue to be ordered by FN, so there's
no use in continue traversing the queue after we found a later primitive
than the one at current time, since next onews will be even more in the
future.

Change-Id: If57fc3d89a74e6cbc79fce80dae7bf4f77e9364d
---
M src/common/scheduler.c
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e1e7c95..86978eb 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -666,7 +666,7 @@
                        goto wrong_type;
                }
                prim_fn = ((l1sap_fn + GSM_HYPERFRAME - fn) % GSM_HYPERFRAME);
-               if (prim_fn > 100) {
+               if (prim_fn > 100) { /* l1sap_fn < fn */
                        LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
                             "Prim %u is out of range (%u vs exp %u), or 
channel %s with "
                             "type %s is already disabled. If this happens in "
@@ -679,9 +679,10 @@
                        msgb_free(msg);
                        continue;
                }
-               if (prim_fn > 0)
-                       continue;
+               if (prim_fn > 0) /* l1sap_fn > fn */
+                       return NULL;

+               /* l1sap_fn == fn */
                goto found_msg;
        }


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/18857
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: If57fc3d89a74e6cbc79fce80dae7bf4f77e9364d
Gerrit-Change-Number: 18857
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to