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.org
Review at https://gerrit.osmocom.org/5209
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, 23 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/09/5209/1
diff --git a/src/bts.cpp b/src/bts.cpp
index 341c9d4..3fcac76 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -679,7 +679,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_timer_start(tbf, 3169, m_bts.t3169, 0, "RACH (new UL-TBF)");
LOGP(DRLCMAC, LOGL_DEBUG, "%s [UPLINK] START\n",
@@ -1034,7 +1034,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 &
@@ -1063,7 +1063,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 549dfd5..fcac803 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -392,7 +392,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_timer_start(tbf, 3169, bts->t3169, 0, "allocation (UL-TBF)");
tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
@@ -662,7 +662,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);
tbf_timer_start(ul_tbf, 3169, ul_tbf->bts->bts_data()->t3169, 0, "MAX N3103 reached");
return;
}
@@ -684,7 +684,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);
tbf_timer_start(this, 3195, bts_data()->t3195, 0, "MAX N3105 reached");
bts->rlc_ass_failed();
bts->pua_poll_failed();
@@ -706,7 +706,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);
tbf_timer_start(this, 3195, bts_data()->t3195, 0, "MAX N3105 reached");
bts->rlc_ass_failed();
bts->pda_poll_failed();
@@ -732,7 +732,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);
tbf_timer_start(dl_tbf, 3195, dl_tbf->bts_data()->t3195, 0, "MAX N3105 reached");
bts->pkt_dl_ack_nack_poll_failed();
bts->rlc_ack_failed();
@@ -1032,7 +1032,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);
break;
}
@@ -1190,7 +1190,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)");
@@ -1470,7 +1470,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 a4b613a..23d598e 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -146,6 +146,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);
@@ -154,7 +156,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;
@@ -346,9 +348,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 73708f5..6ee4f66 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -497,7 +497,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);
@@ -509,7 +509,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 */
@@ -624,7 +624,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 */
@@ -1121,7 +1121,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 */
tbf_timer_start(this, 3193,
@@ -1156,7 +1156,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 0bbb817..74ff4ff 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -334,7 +334,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 d4b51fe..46a9c2a 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: newchange
Gerrit-Change-Id: I348ba89bdda2b44c7019e9c893c764ee08c80bec
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>