aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-08-24 20:46:18 +0200
committerIvan Kluchnikov <kluchnikovi@gmail.com>2013-10-18 15:16:27 +0400
commitd1d114f5b73d310df26c9e39e0173f8c28368516 (patch)
tree4a76435e26c233de046dd7eef4d66808ca2539f9 /src
parent31d0df92ac70753c8e34910faab0807eac4fa34c (diff)
tbf: Move code that sets the tbf's ms_class to a central place
Diffstat (limited to 'src')
-rw-r--r--src/tbf.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index d242b528..5161e928 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -29,6 +29,13 @@ extern "C" {
#include <errno.h>
#include <string.h>
+static inline void tbf_update_ms_class(struct gprs_rlcmac_tbf *tbf,
+ const uint8_t ms_class)
+{
+ if (!tbf->ms_class && ms_class)
+ tbf->ms_class = ms_class;
+}
+
static struct gprs_rlcmac_tbf *tbf_lookup_dl(const uint32_t tlli, const char *imsi)
{
/* TODO: look up by IMSI first, then tlli, then old_tlli */
@@ -52,8 +59,7 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
/* keep to flags */
tbf->state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
tbf->state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
- if (!tbf->ms_class && ms_class)
- tbf->ms_class = ms_class;
+ tbf_update_ms_class(tbf, ms_class);
tbf_update(tbf);
gprs_rlcmac_trigger_downlink_assignment(tbf, tbf, NULL);
} else {
@@ -84,9 +90,7 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
}
memcpy(msgb_put(llc_msg, len), data, len);
msgb_enqueue(&tbf->llc_queue, llc_msg);
- /* set ms class for updating TBF */
- if (!tbf->ms_class && ms_class)
- tbf->ms_class = ms_class;
+ tbf_update_ms_class(tbf, ms_class);
}
return 0;