diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-01-21 20:42:40 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-02-08 00:45:37 +0100 |
commit | f04a5b33ecf01a9bdbd7e971cddb0a87608d04a6 (patch) | |
tree | ec61a3b19d6123e7211a1ca8ab636d936d4d1aab /src | |
parent | 0316dc6e4808d0413a4edf3738edea44193228e4 (diff) |
tbf: Add abort method for downlink TBF
Currently the is a release() function which takes care of
statistics and shutdown of properly finished TBFs, but which
cannot be used for aborted TBFs.
This commit add an abort() method which handles unacked RLC blocks
as lost and doesn't start a release timer. This method will be
invoked by tbf_free() for downlink TBF.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r-- | src/tbf.cpp | 3 | ||||
-rw-r--r-- | src/tbf.h | 1 | ||||
-rw-r--r-- | src/tbf_dl.cpp | 27 |
3 files changed, 30 insertions, 1 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp index e8a9e3e9..93c932b5 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -325,7 +325,8 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf) gprs_rlcmac_rssi_rep(tbf); if (tbf->direction == GPRS_RLCMAC_DL_TBF) { gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); - gprs_rlcmac_lost_rep(dl_tbf); + + dl_tbf->abort(); dl_tbf->cleanup(); } @@ -355,6 +355,7 @@ 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(); bool is_control_ts(uint8_t ts) const { return ts == control_ts; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index a55f179e..64ebea4f 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -894,6 +894,33 @@ int gprs_rlcmac_dl_tbf::release() return 0; } +int gprs_rlcmac_dl_tbf::abort() +{ + uint16_t lost; + + if (state_is(GPRS_RLCMAC_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); + gprs_rlcmac_lost_rep(this); + + /* TODO: Reschedule all LLC frames starting with the one that is + * (partly) encoded in chunk 1 of block V(A). (optional) */ + } + + set_state(GPRS_RLCMAC_RELEASING); + + /* reset rlc states */ + m_window.reset(); + + /* keep to flags */ + state_flags &= GPRS_RLCMAC_FLAG_TO_MASK; + state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH); + + return 0; +} int gprs_rlcmac_dl_tbf::rcvd_dl_ack(uint8_t final_ack, unsigned first_bsn, struct bitvec *rbb) |