summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-08-04 16:31:04 +0600
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commitf6b1fc2470b119ef749fb771a79a751d9cfc2347 (patch)
tree29883af6cee72c0e07ea6c697ac27759671db134
parent8daa2c5c96d76a4b52c9827d28b5c030fb57c204 (diff)
host/trxcon: separate logging of L1 Control and L1 Data
L1 Data is quite verbose, while Control is typically limited. And if you would need to debug some Control message handling, the Data messages wont overflow your terminal anymore. This change introduces a new logging category named 'DL1D'. Change-Id: Id830c8bf913f7a8ddc87c47f70a337ee4623abd8
-rw-r--r--src/host/trxcon/l1ctl.c14
-rw-r--r--src/host/trxcon/l1ctl_link.c16
-rw-r--r--src/host/trxcon/logging.c6
-rw-r--r--src/host/trxcon/logging.h3
4 files changed, 23 insertions, 16 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index ec774d7..ddea262 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -185,7 +185,7 @@ int l1ctl_tx_data_ind(struct l1ctl_link *l1l,
size_t len;
if (msg_type != L1CTL_DATA_IND && msg_type != L1CTL_TRAFFIC_IND) {
- LOGP(DL1C, LOGL_DEBUG, "Incorrect indication type\n");
+ LOGP(DL1D, LOGL_DEBUG, "Incorrect indication type\n");
return -EINVAL;
}
@@ -233,7 +233,7 @@ int l1ctl_tx_data_conf(struct l1ctl_link *l1l)
if (msg == NULL)
return -ENOMEM;
- LOGP(DL1C, LOGL_DEBUG, "Send Data Conf\n");
+ LOGP(DL1D, LOGL_DEBUG, "Send Data Conf\n");
return l1ctl_link_send(l1l, msg);
}
@@ -601,13 +601,13 @@ static int l1ctl_rx_data_req(struct l1ctl_link *l1l, struct msgb *msg)
chan_nr = ul->chan_nr;
link_id = ul->link_id & 0x40;
- LOGP(DL1C, LOGL_DEBUG, "Recv Data Req (chan_nr=0x%02x, "
+ LOGP(DL1D, LOGL_DEBUG, "Recv Data Req (chan_nr=0x%02x, "
"link_id=0x%02x)\n", chan_nr, link_id);
/* Determine TS index */
tn = chan_nr & 0x7;
if (tn > 7) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect TS index %u\n", tn);
+ LOGP(DL1D, LOGL_ERROR, "Incorrect TS index %u\n", tn);
rc = -EINVAL;
goto exit;
}
@@ -615,7 +615,7 @@ static int l1ctl_rx_data_req(struct l1ctl_link *l1l, struct msgb *msg)
/* Determine lchan type */
lchan_type = sched_trx_chan_nr2lchan_type(chan_nr, link_id);
if (!lchan_type) {
- LOGP(DL1C, LOGL_ERROR, "Couldn't determine lchan type "
+ LOGP(DL1D, LOGL_ERROR, "Couldn't determine lchan type "
"for chan_nr=%02x and link_id=%02x\n", chan_nr, link_id);
rc = -EINVAL;
goto exit;
@@ -624,7 +624,7 @@ static int l1ctl_rx_data_req(struct l1ctl_link *l1l, struct msgb *msg)
/* Check whether required timeslot is allocated and configured */
ts = l1l->trx->ts_list[tn];
if (ts == NULL || ts->mf_layout == NULL) {
- LOGP(DL1C, LOGL_ERROR, "Timeslot %u isn't configured\n", tn);
+ LOGP(DL1D, LOGL_ERROR, "Timeslot %u isn't configured\n", tn);
rc = -EINVAL;
goto exit;
}
@@ -633,7 +633,7 @@ static int l1ctl_rx_data_req(struct l1ctl_link *l1l, struct msgb *msg)
len = sizeof(struct trx_ts_prim) + sizeof(struct l1ctl_info_ul) + 23;
prim = talloc_zero_size(ts, len);
if (prim == NULL) {
- LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n");
+ LOGP(DL1D, LOGL_ERROR, "Failed to allocate memory\n");
rc = -ENOMEM;
goto exit;
}
diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c
index 265bfeb..c38a871 100644
--- a/src/host/trxcon/l1ctl_link.c
+++ b/src/host/trxcon/l1ctl_link.c
@@ -81,7 +81,7 @@ static int l1ctl_link_read_cb(struct osmo_fd *bfd)
/* Attempt to read from socket */
rc = read(bfd->fd, &len, sizeof(len));
if (rc < sizeof(len)) {
- LOGP(DL1C, LOGL_NOTICE, "L1CTL has lost connection\n");
+ LOGP(DL1D, LOGL_NOTICE, "L1CTL has lost connection\n");
msgb_free(msg);
if (rc >= 0)
rc = -EIO;
@@ -92,7 +92,7 @@ static int l1ctl_link_read_cb(struct osmo_fd *bfd)
/* Check message length */
len = ntohs(len);
if (len > L1CTL_LENGTH) {
- LOGP(DL1C, LOGL_ERROR, "Length is too big: %u\n", len);
+ LOGP(DL1D, LOGL_ERROR, "Length is too big: %u\n", len);
msgb_free(msg);
return -EINVAL;
}
@@ -100,14 +100,14 @@ static int l1ctl_link_read_cb(struct osmo_fd *bfd)
msg->l1h = msgb_put(msg, len);
rc = read(bfd->fd, msg->l1h, msgb_l1len(msg));
if (rc != len) {
- LOGP(DL1C, LOGL_ERROR, "Can not read data: len=%d < rc=%d: "
+ LOGP(DL1D, LOGL_ERROR, "Can not read data: len=%d < rc=%d: "
"%s\n", len, rc, strerror(errno));
msgb_free(msg);
return rc;
}
/* Debug print */
- LOGP(DL1C, LOGL_DEBUG, "RX: '%s'\n",
+ LOGP(DL1D, LOGL_DEBUG, "RX: '%s'\n",
osmo_hexdump(msg->data, msg->len));
/* Call L1CTL handler */
@@ -125,7 +125,7 @@ static int l1ctl_link_write_cb(struct osmo_fd *bfd, struct msgb *msg)
len = write(bfd->fd, msg->data, msg->len);
if (len != msg->len) {
- LOGP(DL1C, LOGL_ERROR, "Failed to write data: "
+ LOGP(DL1D, LOGL_ERROR, "Failed to write data: "
"written (%d) < msg_len (%d)\n", len, msg->len);
return -1;
}
@@ -186,18 +186,18 @@ int l1ctl_link_send(struct l1ctl_link *l1l, struct msgb *msg)
uint16_t *len;
/* Debug print */
- LOGP(DL1C, LOGL_DEBUG, "TX: '%s'\n",
+ LOGP(DL1D, LOGL_DEBUG, "TX: '%s'\n",
osmo_hexdump(msg->data, msg->len));
if (msg->l1h != msg->data)
- LOGP(DL1C, LOGL_INFO, "Message L1 header != Message Data\n");
+ LOGP(DL1D, LOGL_INFO, "Message L1 header != Message Data\n");
/* Prepend 16-bit length before sending */
len = (uint16_t *) msgb_push(msg, sizeof(*len));
*len = htons(msg->len - sizeof(*len));
if (osmo_wqueue_enqueue(&l1l->wq, msg) != 0) {
- LOGP(DL1C, LOGL_ERROR, "Failed to enqueue msg!\n");
+ LOGP(DL1D, LOGL_ERROR, "Failed to enqueue msg!\n");
msgb_free(msg);
return -EIO;
}
diff --git a/src/host/trxcon/logging.c b/src/host/trxcon/logging.c
index 3381c6a..338deaf 100644
--- a/src/host/trxcon/logging.c
+++ b/src/host/trxcon/logging.c
@@ -40,6 +40,12 @@ static struct log_info_cat trx_log_info_cat[] = {
.color = "\033[1;31m",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
+ [DL1D] = {
+ .name = "DL1D",
+ .description = "Layer 1 data",
+ .color = "\033[1;31m",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
[DTRX] = {
.name = "DTRX",
.description = "Transceiver interface",
diff --git a/src/host/trxcon/logging.h b/src/host/trxcon/logging.h
index 52afd4b..22f3251 100644
--- a/src/host/trxcon/logging.h
+++ b/src/host/trxcon/logging.h
@@ -2,11 +2,12 @@
#include <osmocom/core/logging.h>
-#define DEBUG_DEFAULT "DAPP:DL1C:DTRX:DSCH"
+#define DEBUG_DEFAULT "DAPP:DL1C:DL1D:DTRX:DSCH"
enum {
DAPP,
DL1C,
+ DL1D,
DTRX,
DSCH,
};