tbf/rlc: Move the counting of unacked frames into the RLC V_B class
Whenwe receive a final ack we assume that all the unacked frames have been acked now. Move the counting to V_B and now the caller can remove the BSN and the "lost" variable which has always been zero.
This commit is contained in:
parent
86dc355a33
commit
9c5539d46d
15
src/rlc.cpp
15
src/rlc.cpp
|
@ -71,6 +71,21 @@ int gprs_rlc_v_b::mark_for_resend(const uint16_t v_a, const uint16_t v_s,
|
||||||
return resend;
|
return resend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gprs_rlc_v_b::count_unacked(const uint16_t v_a, const uint16_t v_s,
|
||||||
|
const uint16_t mod_sns, const uint16_t mod_sns_half)
|
||||||
|
{
|
||||||
|
uint16_t unacked = 0;
|
||||||
|
uint16_t bsn;
|
||||||
|
|
||||||
|
for (bsn = v_a; bsn != v_s; bsn = (bsn + 1) & mod_sns) {
|
||||||
|
uint16_t index = bsn & mod_sns_half;
|
||||||
|
if (!is_acked(index))
|
||||||
|
unacked += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return unacked;
|
||||||
|
}
|
||||||
|
|
||||||
void gprs_rlc_v_b::update(BTS *bts, char *show_rbb, uint8_t ssn,
|
void gprs_rlc_v_b::update(BTS *bts, char *show_rbb, uint8_t ssn,
|
||||||
const uint16_t v_a,
|
const uint16_t v_a,
|
||||||
const uint16_t mod_sns, const uint16_t mod_sns_half,
|
const uint16_t mod_sns, const uint16_t mod_sns_half,
|
||||||
|
|
|
@ -60,6 +60,8 @@ struct gprs_rlc_v_b {
|
||||||
const uint16_t mod_sns, const uint16_t mod_sns_half);
|
const uint16_t mod_sns, const uint16_t mod_sns_half);
|
||||||
void state(char *show_rbb, const uint16_t v_a, const uint16_t v_s,
|
void state(char *show_rbb, const uint16_t v_a, const uint16_t v_s,
|
||||||
const uint16_t mod_sns, const uint16_t mod_sns_half);
|
const uint16_t mod_sns, const uint16_t mod_sns_half);
|
||||||
|
int count_unacked(const uint16_t v_a, const uint16_t v_s,
|
||||||
|
const uint16_t mod_sns, const uint16_t mod_sns_half);
|
||||||
|
|
||||||
/* Check for an individual frame */
|
/* Check for an individual frame */
|
||||||
bool is_unacked(int index) const;
|
bool is_unacked(int index) const;
|
||||||
|
|
12
src/tbf.cpp
12
src/tbf.cpp
|
@ -1422,20 +1422,16 @@ int gprs_rlcmac_tbf::maybe_start_new_window()
|
||||||
{
|
{
|
||||||
const uint16_t mod_sns = m_sns - 1;
|
const uint16_t mod_sns = m_sns - 1;
|
||||||
const uint16_t mod_sns_half = (m_sns >> 1) - 1;
|
const uint16_t mod_sns_half = (m_sns >> 1) - 1;
|
||||||
uint16_t bsn;
|
|
||||||
struct msgb *msg;
|
struct msgb *msg;
|
||||||
uint16_t lost = 0, received = 0;
|
uint16_t received;
|
||||||
|
|
||||||
LOGP(DRLCMACDL, LOGL_DEBUG, "- Final ACK received.\n");
|
LOGP(DRLCMACDL, LOGL_DEBUG, "- Final ACK received.\n");
|
||||||
/* range V(A)..V(S)-1 */
|
/* range V(A)..V(S)-1 */
|
||||||
for (bsn = dir.dl.v_a; bsn != dir.dl.v_s;
|
received = dir.dl.v_b.count_unacked(dir.dl.v_a, dir.dl.v_s,
|
||||||
bsn = (bsn + 1) & mod_sns) {
|
mod_sns, mod_sns_half);
|
||||||
if (!dir.dl.v_b.is_acked(bsn & mod_sns_half))
|
|
||||||
received++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* report all outstanding packets as received */
|
/* report all outstanding packets as received */
|
||||||
gprs_rlcmac_received_lost(this, received, lost);
|
gprs_rlcmac_received_lost(this, received, 0);
|
||||||
|
|
||||||
/* check for LLC PDU in the LLC Queue */
|
/* check for LLC PDU in the LLC Queue */
|
||||||
msg = llc_dequeue(gprs_bssgp_pcu_current_bctx());
|
msg = llc_dequeue(gprs_bssgp_pcu_current_bctx());
|
||||||
|
|
Loading…
Reference in New Issue