Review at https://gerrit.osmocom.org/2859
Simplify polling troubleshooting * introduce enum describing poll kind and use it in set_polling() * move state change and logging into set_polling() Change-Id: I14074207f8bbc18b3ebd60875bb99a0a3a4b399d Related: OS#1524 --- M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp M src/tbf_ul.cpp 4 files changed, 38 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/59/2859/1 diff --git a/src/tbf.cpp b/src/tbf.cpp index 48e8289..8864198 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -593,16 +593,37 @@ 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); - /* 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 FN=%d, TS=%d\n", + name(), 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 FN=%d, TS=%d\n", + name(), 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 FN=%d, TS=%d\n", + name(), poll_fn, poll_ts); + break; + case GPRS_RLCMAC_POLL_DL_ACK: + LOGP(DRLCMACDL, LOGL_DEBUG, "%s Scheduled DL Acknowledgement polling on FN=%d, TS=%d\n", + name(), poll_fn, poll_ts); + break; + } } void gprs_rlcmac_tbf::poll_timeout() @@ -1135,11 +1156,7 @@ 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); @@ -1236,11 +1253,7 @@ 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; } diff --git a/src/tbf.h b/src/tbf.h index 09e3122..5621ebe 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -54,6 +54,13 @@ GPRS_RLCMAC_RELEASING, /* releasing, wait to free TBI/USF */ }; +enum gprs_rlcmac_tbf_poll_type { + GPRS_RLCMAC_POLL_UL_ASS, + GPRS_RLCMAC_POLL_DL_ASS, + GPRS_RLCMAC_POLL_UL_ACK, + GPRS_RLCMAC_POLL_DL_ACK, +}; + enum gprs_rlcmac_tbf_poll_state { GPRS_RLCMAC_POLL_NONE = 0, GPRS_RLCMAC_POLL_SCHED, /* a polling was scheduled */ @@ -173,7 +180,7 @@ int check_polling(uint32_t fn, uint8_t ts, uint32_t *poll_fn, unsigned int *rrbp); - void set_polling(uint32_t poll_fn, uint8_t ts); + void set_polling(uint32_t poll_fn, uint8_t ts, enum gprs_rlcmac_tbf_poll_type t); void poll_timeout(); /** tlli handling */ diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 24c6385..d904ca5 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -798,10 +798,8 @@ rc = check_polling(fn, ts, &new_poll_fn, &rrbp); if (rc >= 0) { - set_polling(new_poll_fn, ts); + set_polling(new_poll_fn, ts, GPRS_RLCMAC_POLL_DL_ACK); - LOGP(DRLCMACDL, LOGL_DEBUG, "Polling scheduled in this " - "TS %d\n", ts); m_tx_counter = 0; /* start timer whenever we send the final block */ if (is_final) diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 1eee41a..4801753 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -137,9 +137,8 @@ m_contention_resolution_done = 1; if (final) { - set_polling(new_poll_fn, ts); + set_polling(new_poll_fn, ts, GPRS_RLCMAC_POLL_UL_ACK); /* waiting for final acknowledge */ - ul_ack_state = GPRS_RLCMAC_UL_ACK_WAIT_ACK; m_final_ack_sent = 1; } else ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE; -- To view, visit https://gerrit.osmocom.org/2859 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I14074207f8bbc18b3ebd60875bb99a0a3a4b399d Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de>