aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-04-26 16:48:34 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-04-26 17:19:07 +0200
commit54742f287c9fe3208f867f95a11ef63e5b0ab4e9 (patch)
tree3d0b5e4b92745af009150098b1d55dd6404f8358 /src
parent14339f6faca8a3e7db54c00c3de6ce8eb791f244 (diff)
ul_tbf: Clean up handle_tbf_reject()
Document the function, make it look similar to usual TBF creation path tbf_alloc_ul()->tbf_alloc_ul_tbf->tbf::setup(), which it mimics with some differences. Get rid of unneeded stuff like creating MS and settings its TLLI (that's already done in only caller of the function). There's no need for calling update_ms() either. Change-Id: I61df2e4f0f0df1f8db941741a2d35a2319252c5e
Diffstat (limited to 'src')
-rw-r--r--src/pdch.cpp3
-rw-r--r--src/tbf_ul.cpp33
-rw-r--r--src/tbf_ul.h2
3 files changed, 17 insertions, 21 deletions
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 76ca1d00..5389763b 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -685,8 +685,7 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
ul_tbf = tbf_alloc_ul(bts(), ms, trx_no(), tlli);
if (!ul_tbf) {
- handle_tbf_reject(bts(), ms, tlli,
- trx_no(), ts_no);
+ handle_tbf_reject(bts(), ms, trx_no(), ts_no);
goto return_unref;
}
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 7a4e3a36..c41793df 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -96,6 +96,7 @@ static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf)
return 0;
}
+/* Generic function to alloc a UL TBF, later configured to be assigned either over CCCH or PACCH */
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;
@@ -139,19 +140,16 @@ struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs
return tbf;
}
-
+/* Alloc a UL TBF to be assigned over PACCH */
gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx,
uint32_t tlli)
{
struct gprs_rlcmac_ul_tbf *tbf;
-/* FIXME: Copy and paste with tbf_new_dl_assignment */
- /* create new TBF, use same TRX as DL TBF */
- /* use multislot class of downlink TBF */
tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, false);
if (!tbf) {
LOGPMS(ms, DTBF, LOGL_NOTICE, "No PDCH resource\n");
- /* FIXME: send reject */
+ /* Caller will most probably send a Imm Ass Reject after return */
return NULL;
}
tbf->m_contention_resolution_done = 1;
@@ -162,30 +160,23 @@ gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t
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
+ * from Packet Resource Request we received. See TS 44.060 sec 7.1.3.2.1 */
struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts,
- GprsMs *ms, uint32_t tlli, uint8_t trx_no, uint8_t ts)
+ GprsMs *ms, uint8_t trx_no, uint8_t ts)
{
struct gprs_rlcmac_ul_tbf *ul_tbf = NULL;
struct gprs_rlcmac_trx *trx = &bts->trx[trx_no];
-
- if (!ms)
- ms = bts_alloc_ms(bts, 0, 0);
- ms_set_tlli(ms, tlli);
+ OSMO_ASSERT(ms);
ul_tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
if (!ul_tbf)
return ul_tbf;
-
talloc_set_destructor(ul_tbf, ul_tbf_dtor);
new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
- llist_add(tbf_bts_list((struct gprs_rlcmac_tbf *)ul_tbf), &bts->ul_tbfs);
- bts_do_rate_ctr_inc(ul_tbf->bts, CTR_TBF_UL_ALLOCATED);
- TBF_SET_ASS_ON(ul_tbf, GPRS_RLCMAC_FLAG_PACCH, false);
-
- ms_attach_tbf(ms, ul_tbf);
- ul_tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
- TBF_SET_ASS_STATE_UL(ul_tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ);
ul_tbf->control_ts = ts;
ul_tbf->trx = trx;
ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, &tbf_ctrg_desc, next_tbf_ctr_group_id++);
@@ -201,6 +192,12 @@ struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts,
return NULL;
}
+ ms_attach_tbf(ms, ul_tbf);
+ llist_add(tbf_bts_list((struct gprs_rlcmac_tbf *)ul_tbf), &bts->ul_tbfs);
+ bts_do_rate_ctr_inc(ul_tbf->bts, CTR_TBF_UL_ALLOCATED);
+ TBF_SET_ASS_ON(ul_tbf, GPRS_RLCMAC_FLAG_PACCH, false);
+ TBF_SET_ASS_STATE_UL(ul_tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ);
+
return ul_tbf;
}
diff --git a/src/tbf_ul.h b/src/tbf_ul.h
index a2ad25ea..53c7ad86 100644
--- a/src/tbf_ul.h
+++ b/src/tbf_ul.h
@@ -121,7 +121,7 @@ struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs
struct gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, GprsMs *ms,
int8_t use_trx, uint32_t tlli);
struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts,
- GprsMs *ms, uint32_t tlli, uint8_t trx_no, uint8_t ts_no);
+ GprsMs *ms, uint8_t trx_no, uint8_t ts_no);
#else /* ifdef __cplusplus */
struct gprs_rlcmac_ul_tbf;