aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-07-30 13:42:06 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-08-23 17:14:23 +0200
commita161bf48bd68d8fa1e1cbeb61f9d51d1de5f344c (patch)
treefafe92cb3fbbb460299c73cdabcde55a145c426e
parentea8dbddab1fc4c5ba932f070d2d2bc4126802e22 (diff)
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
-rw-r--r--src/nacc_fsm.c2
-rw-r--r--src/tbf.cpp45
-rw-r--r--src/tbf_dl.cpp3
-rw-r--r--src/tbf_dl.h4
-rw-r--r--src/tbf_dl_ass_fsm.c4
-rw-r--r--src/tbf_ul_ack_fsm.c6
-rw-r--r--src/tbf_ul_ass_fsm.c2
7 files changed, 20 insertions, 46 deletions
diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index 9a5f5b5e..738b2c58 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -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:
diff --git a/src/tbf.cpp b/src/tbf.cpp
index b43ffdee..acd191be 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -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)
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 905bf053..65785f20 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -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 */
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index 27b6a2c6..d20ad75f 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -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
diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c
index cf09588c..5ac1c1a1 100644
--- a/src/tbf_dl_ass_fsm.c
+++ b/src/tbf_dl_ass_fsm.c
@@ -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;
diff --git a/src/tbf_ul_ack_fsm.c b/src/tbf_ul_ack_fsm.c
index 16ca22b5..32e3533f 100644
--- a/src/tbf_ul_ack_fsm.c
+++ b/src/tbf_ul_ack_fsm.c
@@ -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;
}
diff --git a/src/tbf_ul_ass_fsm.c b/src/tbf_ul_ass_fsm.c
index 00f4bfd3..eab34ee9 100644
--- a/src/tbf_ul_ass_fsm.c
+++ b/src/tbf_ul_ass_fsm.c
@@ -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;