Simplify tbf::set_polling()

When setting a POLL, it will always happen on PACCH, so all the CCCH
part makes no sense there. Let's drop it and move the logging of each
case to the caller, where logging file+line is more useful.

Change-Id: I242f97fd6f927131ac64c1a7c9c3812b6389de04
This commit is contained in:
Pau Espin 2021-07-30 13:42:06 +02:00
parent ea8dbddab1
commit a161bf48bd
7 changed files with 20 additions and 46 deletions

View File

@ -207,6 +207,8 @@ static struct msgb *create_packet_cell_chg_continue(const struct nacc_fsm_ctx *c
rate_ctr_inc(rate_ctr_group_get_ctr(bts_rate_counters(ms->bts), CTR_PKT_CELL_CHG_CONTINUE));
talloc_free(mac_control_block);
tbf_set_polling(tbf, *new_poll_fn, data->ts, PDCH_ULC_POLL_CELL_CHG_CONTINUE);
LOGPTBFDL(tbf, LOGL_DEBUG, "Scheduled 'Packet Cell Change Continue' polling on PACCH (FN=%d, TS=%d)\n",
*new_poll_fn, data->ts);
return msg;
free_ret:

View File

@ -529,49 +529,10 @@ int gprs_rlcmac_tbf::check_polling(uint32_t fn, uint8_t ts,
void gprs_rlcmac_tbf::set_polling(uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason)
{
const char *chan = "UNKNOWN";
if (state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_CCCH)))
chan = "CCCH";
if (state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_PACCH)))
chan = "PACCH";
if ((state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_PACCH))) &&
(state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_CCCH))))
LOGPTBFDL(this, LOGL_ERROR,
"Attempt to schedule polling on %s (FN=%d, TS=%d) with both CCCH and PACCH flags set - FIXME!\n",
chan, new_poll_fn, ts);
/* schedule polling */
if (pdch_ulc_reserve_tbf_poll(trx->pdch[ts].ulc, new_poll_fn, this, reason) < 0) {
LOGPTBFDL(this, LOGL_ERROR, "Failed scheduling poll on %s (FN=%d, TS=%d)\n",
chan, new_poll_fn, ts);
return;
}
switch (reason) {
case PDCH_ULC_POLL_UL_ASS:
LOGPTBFDL(this, LOGL_INFO, "Scheduled UL Assignment polling on %s (FN=%d, TS=%d)\n",
chan, new_poll_fn, ts);
break;
case PDCH_ULC_POLL_DL_ASS:
LOGPTBFDL(this, LOGL_INFO, "Scheduled DL Assignment polling on %s (FN=%d, TS=%d)\n",
chan, new_poll_fn, ts);
break;
case PDCH_ULC_POLL_UL_ACK:
LOGPTBFUL(this, LOGL_DEBUG, "Scheduled UL Acknowledgement polling on %s (FN=%d, TS=%d)\n",
chan, new_poll_fn, ts);
break;
case PDCH_ULC_POLL_DL_ACK:
LOGPTBFDL(this, LOGL_DEBUG, "Scheduled DL Acknowledgement polling on %s (FN=%d, TS=%d)\n",
chan, new_poll_fn, ts);
break;
case PDCH_ULC_POLL_CELL_CHG_CONTINUE:
LOGPTBFDL(this, LOGL_DEBUG, "Scheduled 'Packet Cell Change Continue' polling on %s (FN=%d, TS=%d)\n",
chan, new_poll_fn, ts);
break;
}
if (pdch_ulc_reserve_tbf_poll(trx->pdch[ts].ulc, new_poll_fn, this, reason) < 0)
LOGPTBFDL(this, LOGL_ERROR, "Failed scheduling poll on PACCH (FN=%d, TS=%d)\n",
new_poll_fn, ts);
}
void gprs_rlcmac_tbf::poll_timeout(struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason)

View File

@ -958,6 +958,9 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
rc = check_polling(fn, ts, &new_poll_fn, &rrbp);
if (rc >= 0) {
set_polling(new_poll_fn, ts, PDCH_ULC_POLL_DL_ACK);
LOGPTBFDL(this, LOGL_DEBUG,
"Scheduled DL Acknowledgement polling on PACCH (FN=%d, TS=%d)\n",
new_poll_fn, ts);
m_tx_counter = 0;
/* start timer whenever we send the final block */

View File

@ -38,8 +38,6 @@ enum tbf_dl_prio {
DL_PRIO_CONTROL, /* a control block needs to be sent */
};
#define LOGPTBFDL(tbf, level, fmt, args...) LOGP(DTBFDL, level, "%s " fmt, tbf_name(tbf), ## args)
struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms);
~gprs_rlcmac_dl_tbf();
@ -153,6 +151,8 @@ int dl_tbf_handle(struct gprs_rlcmac_bts *bts,
const uint8_t *data, const uint16_t len);
void tbf_dl_trigger_ass(struct gprs_rlcmac_dl_tbf *tbf, struct gprs_rlcmac_tbf *old_tbf);
#define LOGPTBFDL(tbf, level, fmt, args...) LOGP(DTBFDL, level, "%s " fmt, tbf_name(tbf), ## args)
#ifdef __cplusplus
}
#endif

View File

@ -31,7 +31,7 @@
#include <encoding.h>
#include <bts.h>
#include <tbf.h>
#include <tbf_ul.h>
#include <tbf_dl.h>
#define X(s) (1 << (s))
@ -137,6 +137,8 @@ struct msgb *create_packet_dl_assign(const struct tbf_dl_ass_fsm_ctx *ctx,
bts_do_rate_ctr_inc(ms->bts, CTR_PKT_DL_ASSIGNMENT);
tbf_set_polling(ctx->tbf, new_poll_fn, d->ts, PDCH_ULC_POLL_DL_ASS);
LOGPTBFDL(ctx->tbf, LOGL_INFO, "Scheduled DL Assignment polling on PACCH (FN=%d, TS=%d)\n",
new_poll_fn, d->ts);
talloc_free(mac_control_block);
return msg;

View File

@ -91,8 +91,12 @@ static struct msgb *create_ul_ack_nack(const struct tbf_ul_ack_fsm_ctx *ctx,
if (ms_tlli(ms) != GSM_RESERVED_TMSI)
ul_tbf_contention_resolution_success(ctx->tbf);
if (final)
if (final) {
tbf_set_polling(tbf, new_poll_fn, d->ts, PDCH_ULC_POLL_UL_ACK);
LOGPTBFUL(tbf, LOGL_DEBUG,
"Scheduled UL Acknowledgement polling on PACCH (FN=%d, TS=%d)\n",
new_poll_fn, d->ts);
}
return msg;
}

View File

@ -127,6 +127,8 @@ struct msgb *create_packet_ul_assign(const struct tbf_ul_ass_fsm_ctx *ctx,
bts_do_rate_ctr_inc(ms->bts, CTR_PKT_UL_ASSIGNMENT);
tbf_set_polling(ctx->tbf, new_poll_fn, d->ts, PDCH_ULC_POLL_UL_ASS);
LOGPTBFDL(ctx->tbf, LOGL_INFO, "Scheduled UL Assignment polling on PACCH (FN=%d, TS=%d)\n",
new_poll_fn, d->ts);
talloc_free(mac_control_block);
return msg;