From 2399b1dbfc33b15f64781e611923bc0866f7ccd1 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 12 Jan 2018 15:48:12 +0100 Subject: 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 --- src/tbf.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/tbf.h') diff --git a/src/tbf.h b/src/tbf.h index 6c9946e5..bf6ce4cd 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_name(this), tbf_state_name[state], tbf_state_name[new_state]); state = new_state; -- cgit v1.2.3