Change in osmo-pcu[master]: llc: Refactor code checking if PDU expired while dequeueing
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31087 ) Change subject: llc: Refactor code checking if PDU expired while dequeueing ...................................................................... llc: Refactor code checking if PDU expired while dequeueing The previous function name was misleading since it was checking already for more stuff than pdu containing user data. Rename the function and move all checks on PDU in there instead of having it half in one place and half in the other. Change-Id: Ia0738caa1ccab5f78c2d49db582bdce96f18600a --- M src/llc.c 1 file changed, 8 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/87/31087/1 diff --git a/src/llc.c b/src/llc.c index c283146..7d39d61 100644 --- a/src/llc.c +++ b/src/llc.c @@ -80,9 +80,12 @@ llc->length += len; } -static bool llc_is_user_data_frame(const uint8_t *data, size_t len) +static bool llc_pdu_can_be_discarded(const uint8_t *data, size_t len) { - if (len < 2) + const unsigned keep_small_thresh = 60; + + /* Is the frame small, perhaps only a TCP ACK? */ + if (len <= keep_small_thresh) return false; if ((data[0] & 0x0f) == 1 /* GPRS_SAPI_GMM */) @@ -271,7 +274,6 @@ struct gprs_rlcmac_bts *bts = q->ms->bts; struct gprs_pcu *pcu = bts->pcu; struct timespec hyst_delta = {0, 0}; - const unsigned keep_small_thresh = 60; enum gprs_llc_queue_prio prio; if (pcu->vty.llc_discard_csec) @@ -306,14 +308,9 @@ /* Hysteresis mode, try to discard LLC messages until * the low water mark has been reached */ - /* Check whether to abort the hysteresis mode */ - - /* Is the frame small, perhaps only a TCP ACK? */ - if (msg->len <= keep_small_thresh) - break; - - /* Is it a GMM message? */ - if (!llc_is_user_data_frame(msg->data, msg->len)) + /* Check whether to abort the hysteresis mode: + * Can the PDU be discarded according to its type? */ + if (!llc_pdu_can_be_discarded(msg->data, msg->len)) break; } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31087 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ia0738caa1ccab5f78c2d49db582bdce96f18600a Gerrit-Change-Number: 31087 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
pespin