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
This commit is contained in:
Max 2017-07-07 18:25:41 +02:00
parent 341dccd7e2
commit a10c39866b
5 changed files with 38 additions and 39 deletions

View File

@ -788,40 +788,6 @@ uint8_t BTS::is_single_block(uint16_t ra, enum ph_burst_type burst_type,
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;

View File

@ -373,7 +373,6 @@ public:
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 @@ private:
/* list of downlink TBFs */
LListHead<gprs_rlcmac_tbf> m_dl_tbfs;
private:
/* disable copying to avoid slicing */
BTS(const BTS&);
BTS& operator=(const BTS&);

View File

@ -1011,7 +1011,7 @@ void gprs_rlcmac_tbf::handle_timeout()
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 @@ int gprs_rlcmac_tbf::establish_dl_tbf_on_pacch()
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;
}

View File

@ -424,6 +424,7 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
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();

View File

@ -165,7 +165,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
* 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 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(uint32_t fn, uint8_t ts)
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;