Move DL assignment to TBF-DL
This function does not really belongs to BTS and it heavily relies on
direct access to TBF-DL members anyway.
Change-Id: I04584103018675a2f35cfb565473bfd81a208d7c
Closes: OS#1540
diff --git a/src/bts.cpp b/src/bts.cpp
index a89e881..0f67536 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -788,40 +788,6 @@
return sb;
}
-/* depending on the current TBF, we assign on PACCH or AGCH */
-void BTS::trigger_dl_ass(
- struct gprs_rlcmac_dl_tbf *dl_tbf,
- struct gprs_rlcmac_tbf *old_tbf)
-{
- /* stop pending timer */
- dl_tbf->stop_timer();
-
- /* check for downlink tbf: */
- if (old_tbf) {
- LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment on "
- "PACCH, because %s exists\n", tbf_name(old_tbf));
- old_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS;
-
- old_tbf->was_releasing = old_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
-
- /* change state */
- dl_tbf->set_state(GPRS_RLCMAC_ASSIGN);
- if (!(dl_tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
- dl_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
- /* start timer */
- tbf_timer_start(dl_tbf, 0, Tassign_pacch);
- } else {
- LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment for %s on PCH, no TBF exist (IMSI=%s)\n", tbf_name(dl_tbf), dl_tbf->imsi());
- dl_tbf->was_releasing = dl_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
- /* change state */
- dl_tbf->set_state(GPRS_RLCMAC_ASSIGN);
- dl_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
- /* send immediate assignment */
- dl_tbf->bts->snd_dl_ass(dl_tbf, 0, dl_tbf->imsi());
- dl_tbf->m_wait_confirm = 1;
- }
-}
-
void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi)
{
int plen;
diff --git a/src/bts.h b/src/bts.h
index cff0020..1f1dae2 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -373,7 +373,6 @@
int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit,
enum ph_burst_type burst_type);
- void trigger_dl_ass(gprs_rlcmac_dl_tbf *tbf, gprs_rlcmac_tbf *old_tbf);
void snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi);
GprsMsStorage &ms_store();
@@ -501,7 +500,6 @@
/* list of downlink TBFs */
LListHead<gprs_rlcmac_tbf> m_dl_tbfs;
-private:
/* disable copying to avoid slicing */
BTS(const BTS&);
BTS& operator=(const BTS&);
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 1ac33d7..5b28d9b 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1011,7 +1011,7 @@
dl_tbf->update();
- dl_tbf->bts->trigger_dl_ass(dl_tbf, dl_tbf);
+ dl_tbf->trigger_ass(dl_tbf);
} else
LOGP(DRLCMAC, LOGL_NOTICE, "%s Continue flow after "
"IMM.ASS confirm\n", tbf_name(dl_tbf));
@@ -1299,7 +1299,7 @@
LOGP(DRLCMAC, LOGL_DEBUG, "%s Trigger downlink assignment on PACCH\n",
tbf_name(this));
- bts->trigger_dl_ass(new_tbf, this);
+ new_tbf->trigger_ass(this);
return 0;
}
diff --git a/src/tbf.h b/src/tbf.h
index ecdf5f8..9cc70e6 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -424,6 +424,7 @@
int rcvd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb);
int rcvd_dl_ack(uint8_t final_ack, unsigned first_bsn, struct bitvec *rbb);
struct msgb *create_dl_acked_block(uint32_t fn, uint8_t ts);
+ void trigger_ass(struct gprs_rlcmac_tbf *old_tbf);
void clear_poll_timeout_flag();
bool handle_ack_nack();
void request_dl_ack();
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 505d488..8ce13a7 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -165,7 +165,7 @@
* we don't use old_downlink, so the possible uplink is used
* to trigger downlink assignment. if there is no uplink,
* AGCH is used. */
- dl_tbf->bts->trigger_dl_ass(dl_tbf, old_ul_tbf);
+ dl_tbf->trigger_ass(old_ul_tbf);
*tbf = dl_tbf;
return 0;
}
@@ -484,6 +484,40 @@
return create_dl_acked_block(fn, ts, bsn, bsn2);
}
+/* depending on the current TBF, we assign on PACCH or AGCH */
+void gprs_rlcmac_dl_tbf::trigger_ass(struct gprs_rlcmac_tbf *old_tbf)
+{
+ /* stop pending timer */
+ stop_timer();
+
+ /* check for downlink tbf: */
+ if (old_tbf) {
+ LOGP(DRLCMACDL, LOGL_DEBUG, "Send dowlink assignment on PACCH, because %s exists\n", tbf_name(old_tbf));
+ old_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS;
+ old_tbf->was_releasing = old_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
+
+ /* change state */
+ set_state(GPRS_RLCMAC_ASSIGN);
+ if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
+ state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
+
+ /* start timer */
+ tbf_timer_start(this, 0, Tassign_pacch);
+ } else {
+ LOGP(DRLCMACDL, LOGL_DEBUG, "Send dowlink assignment for %s on PCH, no TBF exist (IMSI=%s)\n",
+ tbf_name(this), imsi());
+ was_releasing = state_is(GPRS_RLCMAC_WAIT_RELEASE);
+
+ /* change state */
+ set_state(GPRS_RLCMAC_ASSIGN);
+ state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
+
+ /* send immediate assignment */
+ bts->snd_dl_ass(this, 0, imsi());
+ m_wait_confirm = 1;
+ }
+}
+
void gprs_rlcmac_dl_tbf::schedule_next_frame()
{
struct msgb *msg;