Harald Welte has submitted this change and it was merged. (
https://gerrit.osmocom.org/14117 )
Change subject: cbch: Improve verbosity and extend logging; Always indicate
BASIC/EXTD CBCH
..
cbch: Improve verbosity and extend logging; Always indicate BASIC/EXTD CBCH
Change-Id: I6c8f9fc6215b616371e46c1f4ca4e44b8c7ac096
---
M src/common/cbch.c
1 file changed, 35 insertions(+), 19 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/common/cbch.c b/src/common/cbch.c
index 6b65679..7ed11c2 100644
--- a/src/common/cbch.c
+++ b/src/common/cbch.c
@@ -71,6 +71,14 @@
OSMO_ASSERT(0);
}
+static const char *tb_to_chan_str(uint8_t tb)
+{
+ if (tb < 4)
+ return "CBCH-BASIC";
+ else
+ return "CBCH-EXTENDED";
+}
+
/* construct a SMSCB NULL block in the user-provided output buffer at 'out' */
static int get_smscb_null_block(uint8_t *out)
{
@@ -86,24 +94,26 @@
}
/* get the next block of the current CB message */
-static int get_smscb_block(struct bts_smscb_state *bts_ss, uint8_t *out,
uint8_t block_nr,
+static int get_smscb_block(struct bts_smscb_state *bts_ss, uint8_t *out,
uint8_t tb,
const struct gsm_time *g_time)
{
int to_copy;
struct gsm412_block_type *block_type;
struct smscb_msg *msg = bts_ss->cur_msg;
+ uint8_t block_nr = tb % 4;
+ const char *chan_name = tb_to_chan_str(tb);
if (!msg) {
/* No message: Send NULL block */
- DEBUGPGT(DLSMS, g_time, "No cur_msg; requesting NULL block\n");
+ DEBUGPGT(DLSMS, g_time, "%s: No cur_msg; requesting NULL
block\n", chan_name);
return get_smscb_null_block(out);
}
OSMO_ASSERT(block_nr < 4);
if (block_nr >= msg->num_segs) {
/* Higher block number than this message has blocks: Send NULL
block */
- DEBUGPGT(DLSMS, g_time, "cur_msg has only %u blocks; requesting
NULL block\n",
-msg->num_segs);
+ DEBUGPGT(DLSMS, g_time, "%s: cur_msg has only %u blocks;
requesting NULL block\n",
+chan_name, msg->num_segs);
return get_smscb_null_block(out);
}
@@ -136,12 +146,14 @@
if (block_nr == 4) {
if (msg != bts_ss->default_msg) {
- DEBUGPGT(DLSMS, g_time, "deleting fully-transmitted
message %p\n", msg);
+ DEBUGPGT(DLSMS, g_time, "%s: deleting fully-transmitted
message %p\n",
+chan_name, msg);
/* delete any fully-transmitted normal message (or
superseded default) */
talloc_free(bts_ss->cur_msg);
bts_ss->cur_msg = NULL;
} else {
- DEBUGPGT(DLSMS, g_time, "keeping fully-transmitted
default message %p\n", msg);
+ DEBUGPGT(DLSMS, g_time, "%s: keeping fully-transmitted
default message %p\n",
+chan_name, msg);
}
}
@@ -170,16 +182,19 @@
{
struct smscb_msg *scm;
struct bts_smscb_state *bts_ss;
+ const char *chan_name;
- if (extended_cbch)
+ if (extended_cbch) {
+ chan_name = tb_to_chan_str(4);
bts_ss = &bts->smscb_extended;
- else
+ } else {
+ chan_name = tb_to_chan_str(0);
bts_ss = &bts->smscb_basic;
+ }
if (msg_len > sizeof(scm->msg)) {
- LOGP(DLSMS, LOGL_ERROR,
-"Cannot process SMSCB of %u bytes (max %zu)\n",
-msg_len, sizeof(scm->msg));
+ LOGP(DLSMS, LOGL_ERROR, "%s: Cannot process SMSCB of %u bytes
(max %zu)\n",
+chan_name, msg_len, sizeof(scm->msg));
return -EINVAL;
}
@@ -197,8 +212,7 @@
memcpy(scm->msg, msg, msg_len);
LOGP(DLSMS, LOGL_INFO, "RSL SMSCB COMMAND (chan=%s, type=%s,
num_blocks=%u)\n",
- extended_cbch ? "EXTENDED" : "BASIC",
- get_value_string(rsl_cb_cmd_names, cmd_type.command),
scm->num_segs);
+ chan_name, get_value_string(rsl_cb_cmd_names,
cmd_type.command), scm->num_segs);
switch (cmd_type.command) {
case RSL_CB_CMD_TYPE_NORMAL:
@@ -207,6 +221,8 @@
/* def_bcast is ignored as per Section 9.3.41 of 3GPP TS 48.058
*/
/* limit queue size and optionally send CBCH LOAD Information
(overflow) via RSL */
if (bts_ss->queue_len >= bts->smscb_queue_max_len) {
+ LOGP(DLSMS, LOGL_NOTICE, "RSL SMSCB COMMAND (chan=%s,
type=%s): OVERFLOW\n",
+chan_name, get_value_string(rsl_cb