diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-11-24 17:20:35 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-11-26 20:57:24 +0100 |
commit | bc155706516dd63d1fbe3d87601df2f7606a1162 (patch) | |
tree | e0e8ebca0dbaad5fbc3f91e691c3a44f01664f60 /src | |
parent | e358ff8fa4865be81cd0fbf46ddd6baee3856e9b (diff) |
tbf/rlc: Change the code and generate the entire state in the V_B
Diffstat (limited to 'src')
-rw-r--r-- | src/rlc.cpp | 15 | ||||
-rw-r--r-- | src/rlc.h | 9 | ||||
-rw-r--r-- | src/tbf.cpp | 12 |
3 files changed, 21 insertions, 15 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp index 24ffc176..a76703d5 100644 --- a/src/rlc.cpp +++ b/src/rlc.cpp @@ -116,3 +116,18 @@ int gprs_rlc_v_b::move_window(const uint16_t v_a, const uint16_t v_s, return moved; } + +void gprs_rlc_v_b::state(char *show_v_b, const uint16_t v_a, const uint16_t v_s, + const uint16_t mod_sns, const uint16_t mod_sns_half) +{ + int i; + uint16_t bsn; + + for (i = 0, bsn = v_a; bsn != v_s; i++, bsn = (bsn + 1) & mod_sns) { + uint16_t index = (bsn & mod_sns_half); + show_v_b[i] = m_v_b[index]; + if (show_v_b[i] == 0) + show_v_b[i] = ' '; + } + show_v_b[i] = '\0'; +} @@ -58,6 +58,8 @@ struct gprs_rlc_v_b { uint16_t *lost, uint16_t *received); int move_window(const uint16_t v_a, const uint16_t v_s, 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, + const uint16_t mod_sns, const uint16_t mod_sns_half); /* Check for an individual frame */ bool is_unacked(int index) const; @@ -66,8 +68,6 @@ struct gprs_rlc_v_b { bool is_resend(int index) const; bool is_invalid(int index) const; - char state(int index) const; - /* Mark a RLC frame for something */ void mark_unacked(int index); void mark_nacked(int index); @@ -129,11 +129,6 @@ inline void gprs_rlc_v_b::mark(int index, const char type) m_v_b[index] = type; } -inline char gprs_rlc_v_b::state(int index) const -{ - return m_v_b[index]; -} - inline bool gprs_rlc_v_b::is_nacked(int index) const { return is_state(index, 'N'); diff --git a/src/tbf.cpp b/src/tbf.cpp index 0d6d19b1..bb13de78 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1363,7 +1363,6 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ack(uint32_t fn) int gprs_rlcmac_tbf::snd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb) { - char show_v_b[RLC_MAX_SNS + 1]; uint16_t mod_sns = m_sns - 1; uint16_t mod_sns_half = (m_sns >> 1) - 1; int i; /* must be signed */ @@ -1376,6 +1375,8 @@ int gprs_rlcmac_tbf::snd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb) if (!final) { char show_rbb[65]; + char show_v_b[RLC_MAX_SNS + 1]; + Decoding::extract_rbb(rbb, show_rbb); /* show received array in debug (bit 64..1) */ LOGP(DRLCMACDL, LOGL_DEBUG, "- ack: (BSN=%d)\"%s\"" @@ -1409,13 +1410,8 @@ int gprs_rlcmac_tbf::snd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb) mod_sns, mod_sns_half) & mod_sns; /* show receive state array in debug (V(A)..V(S)-1) */ - for (i = 0, bsn = dir.dl.v_a; bsn != dir.dl.v_s; - i++, bsn = (bsn + 1) & mod_sns) { - show_v_b[i] = dir.dl.v_b.state(bsn & mod_sns_half); - if (show_v_b[i] == 0) - show_v_b[i] = ' '; - } - show_v_b[i] = '\0'; + dir.dl.v_b.state(show_v_b, dir.dl.v_a, dir.dl.v_s, + mod_sns, mod_sns_half); LOGP(DRLCMACDL, LOGL_DEBUG, "- V(B): (V(A)=%d)\"%s\"" "(V(S)-1=%d) A=Acked N=Nacked U=Unacked " "X=Resend-Unacked\n", dir.dl.v_a, show_v_b, |