fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35656?usp=email )
Change subject: mobile: add a separate logging category for CSD ......................................................................
mobile: add a separate logging category for CSD
Change-Id: If9db0759aeb4324ace9ae258c852787f37897d83 Related: OS#4396 --- M src/host/layer23/include/osmocom/bb/common/logging.h M src/host/layer23/src/common/logging.c M src/host/layer23/src/mobile/tch_data.c M src/host/layer23/src/mobile/tch_data_sock.c 4 files changed, 36 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/56/35656/1
diff --git a/src/host/layer23/include/osmocom/bb/common/logging.h b/src/host/layer23/include/osmocom/bb/common/logging.h index 40a7e81..3920d2e 100644 --- a/src/host/layer23/include/osmocom/bb/common/logging.h +++ b/src/host/layer23/include/osmocom/bb/common/logging.h @@ -28,6 +28,7 @@ DPRIM, DLUA, DGAPK, + DCSD, DTUN, DRLCMAC, DLLC, diff --git a/src/host/layer23/src/common/logging.c b/src/host/layer23/src/common/logging.c index 0401360..283b7f1 100644 --- a/src/host/layer23/src/common/logging.c +++ b/src/host/layer23/src/common/logging.c @@ -159,6 +159,12 @@ .color = "\033[0;36m", .enabled = 1, .loglevel = LOGL_DEBUG, }, + [DCSD] = { + .name = "DCSD", + .description = "Circuit Switched Data", + .color = "\033[0;36m", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, [DTUN] = { .name = "DTUN", .description = "Tunnel interface", diff --git a/src/host/layer23/src/mobile/tch_data.c b/src/host/layer23/src/mobile/tch_data.c index 6ee89dc..7169efa 100644 --- a/src/host/layer23/src/mobile/tch_data.c +++ b/src/host/layer23/src/mobile/tch_data.c @@ -81,7 +81,7 @@ { struct tch_data_state *state = (struct tch_data_state *)priv;
- LOGP(DL1C, LOGL_DEBUG, "%s(): [flags=0x%08x] %s\n", + LOGP(DCSD, LOGL_DEBUG, "%s(): [flags=0x%08x] %s\n", __func__, flags, msgb_hexdump(msg));
if (state->sock != NULL && msgb_length(msg) > 0) @@ -96,7 +96,7 @@
tch_csd_sock_recv(state->sock, msg);
- LOGP(DL1C, LOGL_DEBUG, "%s(): [n_bytes=%u/%u] %s\n", + LOGP(DCSD, LOGL_DEBUG, "%s(): [n_bytes=%u/%u] %s\n", __func__, msg->len, msg->data_len, msgb_hexdump(msg)); }
@@ -166,7 +166,7 @@
tch_csd_sock_recv(state->sock, msg); if (msgb_length(msg) < buf_size) { - LOGP(DL1C, LOGL_NOTICE, + LOGP(DCSD, LOGL_NOTICE, "%s(): not enough bytes for sync Tx (%u < %zu)\n", __func__, msgb_length(msg), buf_size); } @@ -189,7 +189,7 @@
static void tch_v110_ta_status_update_cb(void *priv, unsigned int status) { - LOGP(DL1C, LOGL_DEBUG, "%s(): [status=0x%08x]\n", __func__, status); + LOGP(DCSD, LOGL_DEBUG, "%s(): [status=0x%08x]\n", __func__, status);
/* TODO: update status lines of the soft-UART (if state.suart != NULL) */ } @@ -233,7 +233,7 @@ * signalling rate shall be adapted to a synchronous 600 bit/s stream. */ case BCAP_RATE(GSM48_BCAP_IR_8k, GSM48_BCAP_UR_300): default: - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): IR 0x%02x / UR 0x%02x combination is not supported\n", __func__, bcap->data.interm_rate, bcap->data.user_rate); return NULL; @@ -367,20 +367,20 @@ static int tch_data_check_bcap(const struct gsm_mncc_bearer_cap *bcap) { if (bcap == NULL) { - LOGP(DL1C, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): CC transaction without BCap\n", __func__); return -ENODEV; }
if (bcap->mode != GSM48_BCAP_TMOD_CIRCUIT) { - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): Transfer mode 0x%02x is not supported\n", __func__, bcap->mode); return -ENOTSUP; } if (bcap->coding != GSM48_BCAP_CODING_GSM_STD) { - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): Coding standard 0x%02x is not supported\n", __func__, bcap->coding); return -ENOTSUP; @@ -392,26 +392,26 @@ case GSM48_BCAP_ITCAP_FAX_G3: break; default: - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): Information transfer capability 0x%02x is not supported\n", __func__, bcap->transfer); return -ENOTSUP; }
if (bcap->data.rate_adaption != GSM48_BCAP_RA_V110_X30) { - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): Rate adaption (octet 5) 0x%02x is not supported\n", __func__, bcap->data.rate_adaption); return -ENOTSUP; } if (bcap->data.sig_access != GSM48_BCAP_SA_I440_I450) { - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): Signalling access protocol (octet 5) 0x%02x is not supported\n", __func__, bcap->data.sig_access); return -ENOTSUP; } if (bcap->data.transp != GSM48_BCAP_TR_TRANSP) { - LOGP(DCC, LOGL_ERROR, + LOGP(DCSD, LOGL_ERROR, "%s(): only transparent calls are supported so far\n", __func__); return -ENOTSUP; @@ -514,7 +514,7 @@ struct tch_data_state *state = NULL;
if (ms->tch_state == NULL || ms->tch_state->is_voice) { - LOGP(DCC, LOGL_INFO, "No data call is ongoing, " + LOGP(DCSD, LOGL_INFO, "No data call is ongoing, " "ignoring [dis]connection event for CSD socket\n"); return; } diff --git a/src/host/layer23/src/mobile/tch_data_sock.c b/src/host/layer23/src/mobile/tch_data_sock.c index 7bfebf3..7ce5a4f 100644 --- a/src/host/layer23/src/mobile/tch_data_sock.c +++ b/src/host/layer23/src/mobile/tch_data_sock.c @@ -51,7 +51,7 @@ { struct osmo_fd *bfd = &state->conn_bfd;
- LOGP(DMOB, LOGL_NOTICE, "TCH CSD sock has closed connection\n"); + LOGP(DCSD, LOGL_NOTICE, "TCH CSD sock has closed connection\n");
tch_csd_sock_state_cb(state->ms, false);
@@ -155,25 +155,25 @@ len = sizeof(un_addr); rc = accept(bfd->fd, (struct sockaddr *)&un_addr, &len); if (rc < 0) { - LOGP(DMOB, LOGL_ERROR, "Failed to accept() a new connection\n"); + LOGP(DCSD, LOGL_ERROR, "Failed to accept() a new connection\n"); return -1; }
if (conn_bfd->fd >= 0) { - LOGP(DMOB, LOGL_NOTICE, "TCH CSD sock already has an active connection\n"); + LOGP(DCSD, LOGL_NOTICE, "TCH CSD sock already has an active connection\n"); close(rc); /* reject this connection request */ return 0; }
osmo_fd_setup(conn_bfd, rc, OSMO_FD_READ, &tch_csd_sock_cb, state, 0); if (osmo_fd_register(conn_bfd) != 0) { - LOGP(DMOB, LOGL_ERROR, "osmo_fd_register() failed\n"); + LOGP(DCSD, LOGL_ERROR, "osmo_fd_register() failed\n"); close(conn_bfd->fd); conn_bfd->fd = -1; return -1; }
- LOGP(DMOB, LOGL_NOTICE, "TCH CSD sock got a connection\n"); + LOGP(DCSD, LOGL_NOTICE, "TCH CSD sock got a connection\n");
tch_csd_sock_state_cb(state->ms, true);
@@ -200,7 +200,7 @@
rc = osmo_sock_unix_init_ofd(bfd, SOCK_STREAM, 0, sock_path, OSMO_SOCK_F_BIND); if (rc < 0) { - LOGP(DMOB, LOGL_ERROR, "Could not create unix socket: %s\n", strerror(errno)); + LOGP(DCSD, LOGL_ERROR, "Could not create unix socket: %s\n", strerror(errno)); talloc_free(state); return NULL; }