path: root/src/tbf.h
diff options
authorMax <msuraev@sysmocom.de>2018-01-12 15:48:12 +0100
committerMax <msuraev@sysmocom.de>2018-01-17 15:47:32 +0000
commit2399b1dbfc33b15f64781e611923bc0866f7ccd1 (patch)
treeec32f9a955ab6d1c45b205bd8d2b6a6ab270df1a /src/tbf.h
parent186206cff295de9afb0d1beda72a4304ebaa1e17 (diff)
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#1759
Diffstat (limited to 'src/tbf.h')
1 files changed, 9 insertions, 6 deletions
diff --git a/src/tbf.h b/src/tbf.h
index 6c9946e..bf6ce4c 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -180,6 +180,9 @@ enum tbf_timers {
#define T_START(tbf, t, sec, usec, r, f) tbf->t_start(t, sec, usec, r, f, __FILE__, __LINE__)
+#define TBF_SET_STATE(t, st) do { t->set_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 {
gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir);
@@ -188,9 +191,9 @@ struct gprs_rlcmac_tbf {
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);
bool check_n_clear(uint8_t state_flag);
- void set_assigned_on(uint8_t state_flag, bool check_ccch);
+ void set_assigned_on(uint8_t state_flag, bool check_ccch, const char *file, int line);
const char *state_name() const;
const char *name() const;
@@ -378,9 +381,9 @@ inline const char *gprs_rlcmac_tbf::state_name() const
/* Set assignment state and corrsponding flags */
-inline void gprs_rlcmac_tbf::set_assigned_on(uint8_t state_flag, bool check_ccch)
+inline void gprs_rlcmac_tbf::set_assigned_on(uint8_t state_flag, bool check_ccch, const char *file, int line)
- set_state(GPRS_RLCMAC_ASSIGN);
+ set_state(GPRS_RLCMAC_ASSIGN, file, line);
if (check_ccch) {
if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
state_flags |= (1 << state_flag);
@@ -388,9 +391,9 @@ inline void gprs_rlcmac_tbf::set_assigned_on(uint8_t state_flag, bool check_ccch
state_flags |= (1 << state_flag);
-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_state_name[state], tbf_state_name[new_state]);
state = new_state;