Get rid of tbf_dl:abort()

Having that code in a separate function is confusing and adds code
complexity since it looks like an entry point to start feeing a TBF, but
it simply some (not yet really useful) set of instructions to be called
one 1 code path in tbf_free.
Let's move it there, this way it becomes clear tbf_free() is THE place
to be (if you want to get rid of a TBF).

Change-Id: I30febf4d21a0bfab37524c07598bbb0dd32f7f65
This commit is contained in:
Pau Espin 2021-07-26 18:32:36 +02:00
parent 131deb059f
commit 284711d627
3 changed files with 15 additions and 29 deletions

View File

@ -275,10 +275,23 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_ABORTED);
} else {
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
gprs_rlc_dl_window *win = static_cast<gprs_rlc_dl_window *>(dl_tbf->window());
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_FREED);
if (tbf->state_is(TBF_ST_FLOW))
if (tbf->state_is(TBF_ST_FLOW)) {
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_ABORTED);
dl_tbf->abort();
/* range V(A)..V(S)-1 */
uint16_t lost = win->count_unacked();
/* report all outstanding packets as lost */
gprs_rlcmac_received_lost(dl_tbf, 0, lost);
/* TODO: Reschedule all LLC frames starting with the one that is
* (partly) encoded in chunk 1 of block V(A). (optional) */
}
/* This state change looks unneeded and can probably be dropped at some point: */
tbf_fsm_state_chg(dl_tbf->state_fsm.fi, TBF_ST_RELEASING);
/* reset rlc states */
win->reset();
osmo_fsm_inst_dispatch(dl_tbf->state_fsm.fi, TBF_EV_ASSIGN_DEL_CCCH, NULL);
}
LOGPTBF(tbf, LOGL_INFO, "free\n");

View File

@ -1261,32 +1261,6 @@ int gprs_rlcmac_dl_tbf::release()
return 0;
}
int gprs_rlcmac_dl_tbf::abort()
{
uint16_t lost;
if (state_is(TBF_ST_FLOW)) {
/* range V(A)..V(S)-1 */
lost = m_window.count_unacked();
/* report all outstanding packets as lost */
gprs_rlcmac_received_lost(this, 0, lost);
/* TODO: Reschedule all LLC frames starting with the one that is
* (partly) encoded in chunk 1 of block V(A). (optional) */
}
/* This state change looks unneeded and can probably be dropped at some point: */
tbf_fsm_state_chg(this->state_fsm.fi, TBF_ST_RELEASING);
/* reset rlc states */
m_window.reset();
osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_ASSIGN_DEL_CCCH, NULL);
return 0;
}
int gprs_rlcmac_dl_tbf::rcvd_dl_ack(bool final_ack, unsigned first_bsn,
struct bitvec *rbb)
{

View File

@ -61,7 +61,6 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
int frames_since_last_drain(unsigned fn) const;
bool keep_open(unsigned fn) const;
int release();
int abort();
uint16_t window_size() const;
void set_window_size();
void update_coding_scheme_counter_dl(enum CodingScheme cs);