[PATCH] osmocom-bb[master]: host/trxcon: separate logging of L1 Control and L1 Data

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:20 UTC 2018


Review at  https://gerrit.osmocom.org/6769

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
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl_link.c
M src/host/trxcon/logging.c
M src/host/trxcon/logging.h
4 files changed, 23 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/69/6769/1

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 @@
 	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 @@
 	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 @@
 	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 @@
 	/* 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 @@
 	/* 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 @@
 	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 @@
 	/* 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 @@
 	/* 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 @@
 	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 @@
 
 	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 @@
 	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 @@
 		.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,
 };

-- 
To view, visit https://gerrit.osmocom.org/6769
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id830c8bf913f7a8ddc87c47f70a337ee4623abd8
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list