This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/5863 to look at the new patch set (#3). TBF: make UL ack state internal * add functions/macros for setting TBF's UL ack state * add functions for checking TBF's UL ack state N. B: this should not be confused with TBF-UL state. Change-Id: I144483447d4b0b93e775da0e926ee45eb8ab39f3 Related: OS#1539 --- M src/gprs_rlcmac_sched.cpp M src/tbf.cpp M src/tbf.h M src/tbf_ul.cpp M tests/tbf/TbfTest.cpp 5 files changed, 38 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/63/5863/3 diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index a87217f..3f9fcb1 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -52,7 +52,7 @@ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED && ul_tbf->poll_fn == poll_fn) *poll_tbf = ul_tbf; - if (ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_SEND_ACK) + if (ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_SEND_ACK)) *ul_ack_tbf = ul_tbf; if (ul_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS)) *dl_ass_tbf = ul_tbf; diff --git a/src/tbf.cpp b/src/tbf.cpp index 0cb54bc..b99c521 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -60,6 +60,13 @@ { 0, NULL } }; +const struct value_string gprs_rlcmac_tbf_ul_ack_state_names[] = { + OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ACK_NONE), + OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ACK_SEND_ACK), /* send acknowledge on next RTS */ + OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ACK_WAIT_ACK), /* wait for PACKET CONTROL ACK */ + { 0, NULL } +}; + static const struct value_string tbf_timers_names[] = { OSMO_VALUE_STRING(T0), OSMO_VALUE_STRING(T3169), @@ -165,7 +172,6 @@ first_ts(0), first_common_ts(0), control_ts(0xff), - ul_ack_state(GPRS_RLCMAC_UL_ACK_NONE), poll_state(GPRS_RLCMAC_POLL_NONE), poll_fn(0), poll_ts(0), @@ -185,6 +191,7 @@ state(GPRS_RLCMAC_NULL), dl_ass_state(GPRS_RLCMAC_DL_ASS_NONE), ul_ass_state(GPRS_RLCMAC_UL_ASS_NONE), + ul_ack_state(GPRS_RLCMAC_UL_ACK_NONE), m_list(this), m_ms_list(this), m_egprs_enabled(false) diff --git a/src/tbf.h b/src/tbf.h index 2d51945..2828772 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -87,6 +87,8 @@ GPRS_RLCMAC_UL_ACK_WAIT_ACK, /* wait for PACKET CONTROL ACK */ }; +extern const struct value_string gprs_rlcmac_tbf_ul_ack_state_names[]; + enum gprs_rlcmac_tbf_direction { GPRS_RLCMAC_DL_TBF, GPRS_RLCMAC_UL_TBF @@ -183,6 +185,7 @@ #define TBF_SET_STATE(t, st) do { t->set_state(st, __FILE__, __LINE__); } while(0) #define TBF_SET_ASS_STATE_DL(t, st) do { t->set_ass_state_dl(st, __FILE__, __LINE__); } while(0) #define TBF_SET_ASS_STATE_UL(t, st) do { t->set_ass_state_ul(st, __FILE__, __LINE__); } while(0) +#define TBF_SET_ACK_STATE(t, st) do { t->set_ack_state(st, __FILE__, __LINE__); } while(0) #define TBF_SET_ASS_ON(t, fl, chk) do { t->set_assigned_on(fl, chk, __FILE__, __LINE__); } while(0) struct gprs_rlcmac_tbf { @@ -195,9 +198,11 @@ bool state_is_not(enum gprs_rlcmac_tbf_state rhs) const; bool dl_ass_state_is(enum gprs_rlcmac_tbf_dl_ass_state rhs) const; bool ul_ass_state_is(enum gprs_rlcmac_tbf_ul_ass_state rhs) const; + bool ul_ack_state_is(enum gprs_rlcmac_tbf_ul_ack_state rhs) const; void set_state(enum gprs_rlcmac_tbf_state new_state, const char *file, int line); void set_ass_state_dl(enum gprs_rlcmac_tbf_dl_ass_state new_state, const char *file, int line); void set_ass_state_ul(enum gprs_rlcmac_tbf_ul_ass_state new_state, const char *file, int line); + void set_ack_state(enum gprs_rlcmac_tbf_ul_ack_state new_state, const char *file, int line); void check_pending_ass(); bool check_n_clear(uint8_t state_flag); void set_assigned_on(uint8_t state_flag, bool check_ccch, const char *file, int line); @@ -279,8 +284,6 @@ gprs_llc m_llc; - enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state; - enum gprs_rlcmac_tbf_poll_state poll_state; uint32_t poll_fn; /* frame number to poll */ uint8_t poll_ts; /* TS to poll */ @@ -343,6 +346,7 @@ enum gprs_rlcmac_tbf_state state; enum gprs_rlcmac_tbf_dl_ass_state dl_ass_state; enum gprs_rlcmac_tbf_ul_ass_state ul_ass_state; + enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state; LListHead<gprs_rlcmac_tbf> m_list; LListHead<gprs_rlcmac_tbf> m_ms_list; bool m_egprs_enabled; @@ -383,6 +387,11 @@ inline bool gprs_rlcmac_tbf::ul_ass_state_is(enum gprs_rlcmac_tbf_ul_ass_state rhs) const { return ul_ass_state == rhs; +} + +inline bool gprs_rlcmac_tbf::ul_ack_state_is(enum gprs_rlcmac_tbf_ul_ack_state rhs) const +{ + return ul_ack_state == rhs; } inline bool gprs_rlcmac_tbf::state_is_not(enum gprs_rlcmac_tbf_state rhs) const @@ -434,6 +443,15 @@ ul_ass_state = new_state; } +inline void gprs_rlcmac_tbf::set_ack_state(enum gprs_rlcmac_tbf_ul_ack_state new_state, const char *file, int line) +{ + LOGPSRC(DTBF, LOGL_DEBUG, file, line, "%s changes UL ACK state from %s to %s\n", + tbf_name(this), + get_value_string(gprs_rlcmac_tbf_ul_ack_state_names, ul_ack_state), + get_value_string(gprs_rlcmac_tbf_ul_ack_state_names, new_state)); + ul_ack_state = new_state; +} + inline void gprs_rlcmac_tbf::check_pending_ass() { if (ul_ass_state != GPRS_RLCMAC_UL_ASS_NONE) diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index ba048e5..c1a3388 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -106,8 +106,8 @@ bool gprs_rlcmac_ul_tbf::handle_ctrl_ack() { /* check if this control ack belongs to packet uplink ack */ - if (ul_ack_state == GPRS_RLCMAC_UL_ACK_WAIT_ACK) { - ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE; + if (ul_ack_state_is(GPRS_RLCMAC_UL_ACK_WAIT_ACK)) { + TBF_SET_ACK_STATE(this, GPRS_RLCMAC_UL_ACK_NONE); return true; } @@ -124,7 +124,7 @@ if (final) { if (poll_state == GPRS_RLCMAC_POLL_SCHED && - ul_ack_state == GPRS_RLCMAC_UL_ACK_WAIT_ACK) { + ul_ack_state_is(GPRS_RLCMAC_UL_ACK_WAIT_ACK)) { LOGPTBFUL(this, LOGL_DEBUG, "Polling is already scheduled, so we must wait for the final uplink ack...\n"); return NULL; @@ -158,7 +158,7 @@ /* waiting for final acknowledge */ m_final_ack_sent = 1; } else - ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE; + TBF_SET_ACK_STATE(this, GPRS_RLCMAC_UL_ACK_NONE); return msg; } @@ -362,9 +362,9 @@ "Scheduling Ack/Nack, because %d frames received.\n", SEND_ACK_AFTER_FRAMES); } - if (ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE) { + if (ul_ack_state_is(GPRS_RLCMAC_UL_ACK_NONE)) { /* trigger sending at next RTS */ - ul_ack_state = GPRS_RLCMAC_UL_ACK_SEND_ACK; + TBF_SET_ACK_STATE(this, GPRS_RLCMAC_UL_ACK_SEND_ACK); } else { /* already triggered */ LOGPTBFUL(this, LOGL_DEBUG, diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 968f9eb..0ac519c 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -1350,7 +1350,7 @@ request_dl_rlc_block(ul_tbf, fn); check_tbf(ul_tbf); - OSMO_ASSERT(ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE); + OSMO_ASSERT(ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_NONE)); ms = the_bts->ms_by_tlli(tlli); OSMO_ASSERT(ms != NULL); @@ -1434,7 +1434,7 @@ request_dl_rlc_block(ul_tbf, fn); check_tbf(ul_tbf); - OSMO_ASSERT(ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE); + OSMO_ASSERT(ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_NONE)); ms = the_bts->ms_by_tlli(tlli); OSMO_ASSERT(ms != NULL); @@ -1522,7 +1522,7 @@ request_dl_rlc_block(ul_tbf, fn); check_tbf(ul_tbf); - OSMO_ASSERT(ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE); + OSMO_ASSERT(ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_NONE)); ms = the_bts->ms_by_tlli(tlli); OSMO_ASSERT(ms != NULL); -- To view, visit https://gerrit.osmocom.org/5863 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I144483447d4b0b93e775da0e926ee45eb8ab39f3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Jenkins Builder