Revert "fix: handle NULL return of as_dl_tbf() and as_ul_tbf()"
This reverts commit d8e8ea9c8f16e0a1d09c2ea4395e15eac7358ed2.
Change-Id: I8000e78515b25b9be5c28a249bde330dac915dcb
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 88dc024..5ccbb9f 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -357,8 +357,6 @@
struct GprsMs *ms = tbf_->ms();
const gprs_rlcmac_tbf *tbf = tbf_;
gprs_rlcmac_trx *trx = ms_current_trx(ms);
- struct gprs_rlcmac_dl_tbf *dl_tbf;
- struct gprs_rlcmac_ul_tbf *ul_tbf;
LOGPAL(tbf, "A", single, use_trx, LOGL_DEBUG, "Alloc start\n");
@@ -408,15 +406,12 @@
/* The allocation will be successful, so the system state and tbf_/ms_
* may be modified from now on. */
- dl_tbf = as_dl_tbf(tbf_);
- ul_tbf = as_ul_tbf(tbf_);
- /* cannot be both DL and UL */
- OSMO_ASSERT(!(dl_tbf && ul_tbf));
- if (ul_tbf) {
+ if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
+ struct gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf_);
LOGPSL(tbf, LOGL_DEBUG, "Assign uplink TS=%d TFI=%d USF=%d\n", ts, tfi, usf);
assign_uplink_tbf_usf(pdch, ul_tbf, tfi, usf);
- }
- if (dl_tbf) {
+ } else {
+ struct gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf_);
LOGPSL(tbf, LOGL_DEBUG, "Assign downlink TS=%d TFI=%d\n", ts, tfi);
assign_dlink_tbf(pdch, dl_tbf, tfi);
}
@@ -883,8 +878,6 @@
struct GprsMs *ms = tbf_->ms();
const gprs_rlcmac_tbf *tbf = tbf_;
gprs_rlcmac_trx *trx;
- struct gprs_rlcmac_dl_tbf *dl_tbf;
- struct gprs_rlcmac_ul_tbf *ul_tbf;
LOGPAL(tbf, "B", single, use_trx, LOGL_DEBUG, "Alloc start\n");
@@ -967,14 +960,10 @@
tbf_->first_common_ts = first_common_ts;
tbf_->first_ts = first_ts;
- dl_tbf = as_dl_tbf(tbf_);
- ul_tbf = as_ul_tbf(tbf_);
- /* cannot be both DL and UL */
- OSMO_ASSERT(!(dl_tbf && ul_tbf));
- if (dl_tbf)
- assign_dl_tbf_slots(dl_tbf, trx, dl_slots, tfi);
- if (ul_tbf)
- assign_ul_tbf_slots(ul_tbf, trx, ul_slots, tfi, usf);
+ if (tbf->direction == GPRS_RLCMAC_DL_TBF)
+ assign_dl_tbf_slots(as_dl_tbf(tbf_), trx, dl_slots, tfi);
+ else
+ assign_ul_tbf_slots(as_ul_tbf(tbf_), trx, ul_slots, tfi, usf);
bts_do_rate_ctr_inc(bts, CTR_TBF_ALLOC_ALGO_B);