aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-05-10 17:21:03 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-05-11 11:32:44 +0200
commit20271c421ca774e5e9dbafe366e7cdfd5cee8ad3 (patch)
tree6434667d8d44aab29d829f9759bf003efd678003 /src
parentc6571b55814cf08f5df6ba5dc3423598845b0cb3 (diff)
Split ul_tbf alloc on CCCH into new function
This allows more easily finding when this specific scenario happens, and can easily be compared against the PACCH one. Change-Id: I609792a40fda2a798ca71a0e9f5639d0a0f011d7
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp7
-rw-r--r--src/tbf_ul.cpp18
-rw-r--r--src/tbf_ul.h1
3 files changed, 20 insertions, 6 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 4fe529ec..261da19b 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -867,18 +867,13 @@ int bts_rcv_rach(struct gprs_rlcmac_bts *bts, const struct rach_ind_params *rip)
"SBFn=%u TRX=%u TS=%u\n", sb_fn, trx_no, ts_no);
} else {
GprsMs *ms = bts_alloc_ms(bts, 0, chan_req.egprs_mslot_class);
- tbf = tbf_alloc_ul_tbf(bts, ms, -1, true);
+ tbf = tbf_alloc_ul_ccch(bts, ms);
if (!tbf) {
- LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource for Uplink TBF\n");
/* Send RR Immediate Assignment Reject */
rc = -EBUSY;
goto send_imm_ass_rej;
}
-
- /* FIXME: Copy and paste with other routines.. */
tbf->set_ta(ta);
- TBF_SET_STATE(tbf, GPRS_RLCMAC_FLOW);
- TBF_ASS_TYPE_SET(tbf, GPRS_RLCMAC_FLAG_CCCH);
trx_no = tbf->trx->trx_no;
ts_no = tbf->first_ts;
usf = tbf->m_usf[ts_no];
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index cf8c75c5..686eea5e 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -160,6 +160,24 @@ gprs_rlcmac_ul_tbf *tbf_alloc_ul_pacch(struct gprs_rlcmac_bts *bts, GprsMs *ms,
return tbf;
}
+/* Alloc a UL TBF to be assigned over CCCH */
+struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_ccch(struct gprs_rlcmac_bts *bts, struct GprsMs *ms)
+{
+ struct gprs_rlcmac_ul_tbf *tbf;
+
+ tbf = tbf_alloc_ul_tbf(bts, ms, -1, true);
+ if (!tbf) {
+ LOGP(DTBF, LOGL_NOTICE, "No PDCH resource for Uplink TBF\n");
+ /* Caller will most probably send a Imm Ass Reject after return */
+ return NULL;
+ }
+ TBF_SET_STATE(tbf, GPRS_RLCMAC_FLOW);
+ TBF_ASS_TYPE_SET(tbf, GPRS_RLCMAC_FLAG_CCCH);
+ OSMO_ASSERT(tbf->ms());
+
+ return tbf;
+}
+
/* Create a temporary dummy TBF to Tx a ImmAssReject if allocating a new one during
* packet resource Request failed. This is similar as tbf_alloc_ul() but without
* calling tbf->setup() (in charge of TFI/USF allocation), and reusing resources
diff --git a/src/tbf_ul.h b/src/tbf_ul.h
index 4207deb7..0b9be28f 100644
--- a/src/tbf_ul.h
+++ b/src/tbf_ul.h
@@ -120,6 +120,7 @@ inline uint16_t gprs_rlcmac_ul_tbf::window_size() const
struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot);
struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_pacch(struct gprs_rlcmac_bts *bts, GprsMs *ms,
int8_t use_trx, uint32_t tlli);
+struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_ccch(struct gprs_rlcmac_bts *bts, struct GprsMs *ms);
struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts,
GprsMs *ms, uint8_t trx_no, uint8_t ts_no);