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 Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/5209 to look at the new patch set (#2). TBF: log source of state transitions We use the same approach for osmo_fsm: when state transition happens, it's not very useful to always log the transition function itself, it's much more useful to see where the actual transition comes from. Change-Id: I348ba89bdda2b44c7019e9c893c764ee08c80bec Related: OS#2407 --- M src/bts.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp M src/tbf_ul.cpp M tests/tbf/TbfTest.cpp 6 files changed, 24 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/09/5209/2 diff --git a/src/bts.cpp b/src/bts.cpp index 3655567..4e16f04 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -685,7 +685,7 @@ failure = true; } else { tbf->set_ta(ta); - tbf->set_state(GPRS_RLCMAC_FLOW); + TBF_SET_STATE(tbf, GPRS_RLCMAC_FLOW); tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH); tbf->t_start(T3169, m_bts.t3169, 0, "RACH (new UL-TBF)", true); LOGPTBF(tbf, LOGL_DEBUG, "[UPLINK] START\n"); @@ -1039,7 +1039,7 @@ new_tbf->state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH); new_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH); } - new_tbf->set_state(GPRS_RLCMAC_FLOW); + TBF_SET_STATE(new_tbf, GPRS_RLCMAC_FLOW); /* stop pending assignment timer */ new_tbf->stop_timer("control acked (DL-TBF)"); if ((new_tbf->state_flags & @@ -1067,7 +1067,7 @@ tbf->direction == new_tbf->direction) tbf_free(tbf); - new_tbf->set_state(GPRS_RLCMAC_FLOW); + TBF_SET_STATE(new_tbf, GPRS_RLCMAC_FLOW); if ((new_tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_TO_UL_ASS))) { new_tbf->state_flags &= diff --git a/src/tbf.cpp b/src/tbf.cpp index dc0777f..7fe8071 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -402,7 +402,7 @@ return NULL; } tbf->m_contention_resolution_done = 1; - tbf->set_state(GPRS_RLCMAC_ASSIGN); + TBF_SET_STATE(tbf, GPRS_RLCMAC_ASSIGN); tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH); tbf->t_start(T3169, bts->t3169, 0, "allocation (UL-TBF)", true); tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF); @@ -744,7 +744,7 @@ m_n3101++; if (m_n3101 == bts->bts_data()->n3101) { LOGP(DRLCMAC, LOGL_NOTICE, " N3101 exceeded MAX (%u)\n", bts->bts_data()->n3101); - set_state(GPRS_RLCMAC_RELEASING); + TBF_SET_STATE(this, GPRS_RLCMAC_RELEASING); t_start(T3169, bts->bts_data()->t3169, 0, "MAX N3101 reached", false); return; } @@ -762,7 +762,7 @@ LOGP(DRLCMAC, LOGL_NOTICE, "- N3103 exceeded\n"); bts->pkt_ul_ack_nack_poll_failed(); - ul_tbf->set_state(GPRS_RLCMAC_RELEASING); + TBF_SET_STATE(ul_tbf, GPRS_RLCMAC_RELEASING); ul_tbf->t_start(T3169, ul_tbf->bts->bts_data()->t3169, 0, "MAX N3103 reached", false); return; } @@ -784,7 +784,7 @@ bts->pua_poll_timedout(); if (n3105 == bts_data()->n3105) { LOGP(DRLCMAC, LOGL_NOTICE, "- N3105 exceeded\n"); - set_state(GPRS_RLCMAC_RELEASING); + TBF_SET_STATE(this, GPRS_RLCMAC_RELEASING); t_start(T3195, bts_data()->t3195, 0, "MAX N3105 reached", true); bts->rlc_ass_failed(); bts->pua_poll_failed(); @@ -806,7 +806,7 @@ bts->pda_poll_timedout(); if (n3105 == bts->bts_data()->n3105) { LOGP(DRLCMAC, LOGL_NOTICE, "- N3105 exceeded\n"); - set_state(GPRS_RLCMAC_RELEASING); + TBF_SET_STATE(this, GPRS_RLCMAC_RELEASING); t_start(T3195, bts_data()->t3195, 0, "MAX N3105 reached", true); bts->rlc_ass_failed(); bts->pda_poll_failed(); @@ -832,7 +832,7 @@ } if (dl_tbf->n3105 == dl_tbf->bts->bts_data()->n3105) { LOGP(DRLCMAC, LOGL_NOTICE, "- N3105 exceeded\n"); - dl_tbf->set_state(GPRS_RLCMAC_RELEASING); + TBF_SET_STATE(dl_tbf, GPRS_RLCMAC_RELEASING); dl_tbf->t_start(T3195, dl_tbf->bts_data()->t3195, 0, "MAX N3105 reached", true); bts->pkt_dl_ack_nack_poll_failed(); bts->rlc_ack_failed(); @@ -1128,7 +1128,7 @@ if (!dl_tbf->upgrade_to_multislot) { /* change state to FLOW, so scheduler * will start transmission */ - dl_tbf->set_state(GPRS_RLCMAC_FLOW); + TBF_SET_STATE(dl_tbf, GPRS_RLCMAC_FLOW); return; } @@ -1264,7 +1264,7 @@ set_polling(new_poll_fn, ts, GPRS_RLCMAC_POLL_DL_ASS); } else { dl_ass_state = GPRS_RLCMAC_DL_ASS_NONE; - new_dl_tbf->set_state(GPRS_RLCMAC_FLOW); + TBF_SET_STATE(new_dl_tbf, GPRS_RLCMAC_FLOW); tbf_assign_control_ts(new_dl_tbf); /* stop pending assignment timer */ new_dl_tbf->stop_timer("assignment (DL-TBF)"); @@ -1537,7 +1537,7 @@ llist_add(&ul_tbf->list(), &bts->bts->ul_tbfs()); ul_tbf->bts->tbf_ul_created(); - ul_tbf->set_state(GPRS_RLCMAC_ASSIGN); + TBF_SET_STATE(ul_tbf, GPRS_RLCMAC_ASSIGN); ul_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH); ul_tbf->set_ms(ms); diff --git a/src/tbf.h b/src/tbf.h index 4489695..3b5f250 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -166,6 +166,8 @@ #define GPRS_RLCMAC_FLAG_TO_DL_ASS 7 #define GPRS_RLCMAC_FLAG_TO_MASK 0xf0 /* timeout bits */ +#define TBF_SET_STATE(t, st) do { t->set_state(st, __FILE__, __LINE__); } while(0) + struct gprs_rlcmac_tbf { gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir); @@ -174,7 +176,7 @@ bool state_is(enum gprs_rlcmac_tbf_state rhs) const; bool state_is_not(enum gprs_rlcmac_tbf_state rhs) const; - void set_state(enum gprs_rlcmac_tbf_state new_state); + void set_state(enum gprs_rlcmac_tbf_state new_state, const char *file, int line); const char *state_name() const; const char *name() const; @@ -372,9 +374,9 @@ return tbf_state_name[state]; } -inline void gprs_rlcmac_tbf::set_state(enum gprs_rlcmac_tbf_state new_state) +inline void gprs_rlcmac_tbf::set_state(enum gprs_rlcmac_tbf_state new_state, const char *file, int line) { - LOGP(DRLCMAC, LOGL_DEBUG, "%s changes state from %s to %s\n", + LOGPSRC(DRLCMAC, LOGL_DEBUG, file, line, "%s changes state from %s to %s\n", tbf_name(this), tbf_state_name[state], tbf_state_name[new_state]); state = new_state; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index b043989..f7bb624 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -494,7 +494,7 @@ old_tbf->was_releasing = old_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE); /* change state */ - set_state(GPRS_RLCMAC_ASSIGN); + TBF_SET_STATE(this, GPRS_RLCMAC_ASSIGN); if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))) state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH); @@ -506,7 +506,7 @@ was_releasing = state_is(GPRS_RLCMAC_WAIT_RELEASE); /* change state */ - set_state(GPRS_RLCMAC_ASSIGN); + TBF_SET_STATE(this, GPRS_RLCMAC_ASSIGN); state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH); /* send immediate assignment */ @@ -618,7 +618,7 @@ if (is_final) { request_dl_ack(); - set_state(GPRS_RLCMAC_FINISHED); + TBF_SET_STATE(this, GPRS_RLCMAC_FINISHED); } /* dequeue next LLC frame, if any */ @@ -1114,7 +1114,7 @@ /* report all outstanding packets as received */ gprs_rlcmac_received_lost(this, received, 0); - set_state(GPRS_RLCMAC_WAIT_RELEASE); + TBF_SET_STATE(this, GPRS_RLCMAC_WAIT_RELEASE); /* start T3193 */ t_start(T3193, bts_data()->t3193_msec / 1000, (bts_data()->t3193_msec % 1000) * 1000, @@ -1148,7 +1148,7 @@ * (partly) encoded in chunk 1 of block V(A). (optional) */ } - set_state(GPRS_RLCMAC_RELEASING); + TBF_SET_STATE(this, GPRS_RLCMAC_RELEASING); /* reset rlc states */ m_window.reset(); diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 8e4e57e..668fd45 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -332,7 +332,7 @@ if (rdbi->cv == 0) { LOGP(DRLCMACUL, LOGL_DEBUG, "- Finished with UL " "TBF\n"); - set_state(GPRS_RLCMAC_FINISHED); + TBF_SET_STATE(this, GPRS_RLCMAC_FINISHED); /* Reset N3103 counter. */ this->m_n3103 = 0; } diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 18bbc76..94986f5 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -176,7 +176,7 @@ /* "Establish" the DL TBF */ dl_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS; - dl_tbf->set_state(GPRS_RLCMAC_FLOW); + TBF_SET_STATE(dl_tbf, GPRS_RLCMAC_FLOW); dl_tbf->m_wait_confirm = 0; check_tbf(dl_tbf); -- To view, visit https://gerrit.osmocom.org/5209 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I348ba89bdda2b44c7019e9c893c764ee08c80bec Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>