diff options
author | Max <msuraev@sysmocom.de> | 2017-07-10 14:40:09 +0200 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2017-08-14 15:19:08 +0000 |
commit | f60cf62f4fca3ee0f3803ecc0b7e87b35d74d9f3 (patch) | |
tree | d3077982c72c0386d41bbe3fbfb350b437a4fe72 /src/tbf.cpp | |
parent | a10c39866b4b6e5515b1ceb35b15955226679eb3 (diff) |
Simplify polling troubleshooting
* introduce enum describing poll kind and use it in set_polling()
* move state change into set_polling()
* move logging into set_polling() and unify output
* move duplicated code into static function
* adjust tests to match unified logging output
Change-Id: I14074207f8bbc18b3ebd60875bb99a0a3a4b399d
Related: OS#1524
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r-- | src/tbf.cpp | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp index 5b28d9b3..c5f43482 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -593,16 +593,50 @@ int gprs_rlcmac_tbf::check_polling(uint32_t fn, uint8_t ts, return 0; } -void gprs_rlcmac_tbf::set_polling(uint32_t new_poll_fn, uint8_t ts) +void gprs_rlcmac_tbf::set_polling(uint32_t new_poll_fn, uint8_t ts, enum gprs_rlcmac_tbf_poll_type t) { - LOGP(DRLCMAC, LOGL_DEBUG, - "%s: Scheduling polling at FN %d TS %d\n", - name(), new_poll_fn, ts); + const char *chan = "UNKNOWN"; + + if (state_flags & (1 << (GPRS_RLCMAC_FLAG_CCCH))) + chan = "CCCH"; + + if (state_flags & (1 << (GPRS_RLCMAC_FLAG_PACCH))) + chan = "PACCH"; + + if ((state_flags & (1 << (GPRS_RLCMAC_FLAG_PACCH))) && (state_flags & (1 << (GPRS_RLCMAC_FLAG_CCCH)))) + LOGP(DRLCMACDL, LOGL_ERROR, + "%s Attempt to schedule polling on %s (FN=%d, TS=%d) with both CCCH and PACCH flags set - FIXME!\n", + name(), chan, poll_fn, poll_ts); /* schedule polling */ poll_state = GPRS_RLCMAC_POLL_SCHED; poll_fn = new_poll_fn; poll_ts = ts; + + switch (t) { + case GPRS_RLCMAC_POLL_UL_ASS: + ul_ass_state = GPRS_RLCMAC_UL_ASS_WAIT_ACK; + + LOGP(DRLCMACDL, LOGL_INFO, "%s Scheduled UL Assignment polling on %s (FN=%d, TS=%d)\n", + name(), chan, poll_fn, poll_ts); + break; + case GPRS_RLCMAC_POLL_DL_ASS: + dl_ass_state = GPRS_RLCMAC_DL_ASS_WAIT_ACK; + + LOGP(DRLCMACDL, LOGL_INFO, "%s Scheduled DL Assignment polling on %s (FN=%d, TS=%d)\n", + name(), chan, poll_fn, poll_ts); + break; + case GPRS_RLCMAC_POLL_UL_ACK: + ul_ack_state = GPRS_RLCMAC_UL_ACK_WAIT_ACK; + + LOGP(DRLCMACUL, LOGL_DEBUG, "%s Scheduled UL Acknowledgement polling on %s (FN=%d, TS=%d)\n", + name(), chan, poll_fn, poll_ts); + break; + case GPRS_RLCMAC_POLL_DL_ACK: + LOGP(DRLCMACDL, LOGL_DEBUG, "%s Scheduled DL Acknowledgement polling on %s (FN=%d, TS=%d)\n", + name(), chan, poll_fn, poll_ts); + break; + } } void gprs_rlcmac_tbf::poll_timeout() @@ -1152,11 +1186,7 @@ struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn, uint8_t ts) talloc_free(mac_control_block); if (poll_ass_dl) { - set_polling(new_poll_fn, ts); - dl_ass_state = GPRS_RLCMAC_DL_ASS_WAIT_ACK; - LOGP(DRLCMACDL, LOGL_INFO, - "%s Scheduled DL Assignment polling on FN=%d, TS=%d\n", - name(), poll_fn, poll_ts); + 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); @@ -1253,11 +1283,7 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn, uint8_t ts) bitvec_free(ass_vec); talloc_free(mac_control_block); - set_polling(new_poll_fn, ts); - ul_ass_state = GPRS_RLCMAC_UL_ASS_WAIT_ACK; - LOGP(DRLCMACDL, LOGL_INFO, - "%s Scheduled UL Assignment polling on FN=%d, TS=%d\n", - name(), poll_fn, poll_ts); + set_polling(new_poll_fn, ts, GPRS_RLCMAC_POLL_UL_ASS); return msg; } |