[MERGED] osmo-bts[master]: osmo-bts-virtual: Make use of LOGL1S() macro for context

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 12:36:00 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: osmo-bts-virtual: Make use of LOGL1S() macro for context
......................................................................


osmo-bts-virtual: Make use of LOGL1S() macro for context

In Change-Id I5703b46c8a59fe00a3cdc063bcf72872980ec5e5 we introduced
LOGL1S and starte to use in in common/scheduler.c as well as
osmo-bts-trx but somehow we didn't introduce it in osmo-bts-virtual
at the time.  Let's catch up.

Change-Id: I0b5fd3b7982b9119becda844531108f64c68d19f
---
M src/osmo-bts-virtual/scheduler_virtbts.c
1 file changed, 40 insertions(+), 67 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-virtual/scheduler_virtbts.c b/src/osmo-bts-virtual/scheduler_virtbts.c
index 22ec037..2283be1 100644
--- a/src/osmo-bts-virtual/scheduler_virtbts.c
+++ b/src/osmo-bts-virtual/scheduler_virtbts.c
@@ -98,13 +98,15 @@
 
 		rc = virt_um_write_msg(pinst->phy_link->u.virt.virt_um, outmsg);
 		if (rc < 0)
-			LOGP(DL1P, LOGL_ERROR, "%s GSMTAP msg could not send to virtual Um\n", gsmtap_hdr_stringify(gh));
+			LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn,
+				"%s GSMTAP msg could not send to virtual Um\n", gsmtap_hdr_stringify(gh));
 		else if (rc == 0)
 			bts_shutdown(l1t->trx->bts, "VirtPHY write socket died\n");
 		else
-			DEBUGP(DL1P, "%s Sending GSMTAP message to virtual Um\n", gsmtap_hdr_stringify(gh));
+			LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn,
+				"%s Sending GSMTAP message to virtual Um\n", gsmtap_hdr_stringify(gh));
 	} else
-		LOGP(DL1P, LOGL_ERROR, "GSMTAP msg could not be created!\n");
+		LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "GSMTAP msg could not be created!\n");
 
 	/* free incoming message */
 	msgb_free(msg);
@@ -144,16 +146,14 @@
 	/* get mac block from queue */
 	msg = _sched_dequeue_prim(l1t, tn, fn, chan);
 	if (!msg) {
-		LOGP(DL1P, LOGL_INFO, "%s has not been served !! No prim for "
-			"trx=%u ts=%u at fn=%u to transmit.\n", 
-			trx_chan_desc[chan].name, l1t->trx->nr, tn, fn);
+		LOGL1S(DL1P, LOGL_INFO, l1t, tn, chan, fn, "has not been served !! No prim\n");
 		return NULL;
 	}
 
 	/* check validity of message */
 	if (msgb_l2len(msg) != GSM_MACBLOCK_LEN) {
-		LOGP(DL1P, LOGL_FATAL, "Prim not 23 bytes, please FIX! "
-			"(len=%d)\n", msgb_l2len(msg));
+		LOGL1S(DL1P, LOGL_FATAL, l1t, tn, chan, fn, "Prim not 23 bytes, please FIX! (len=%d)\n",
+			msgb_l2len(msg));
 		/* free message */
 		msgb_free(msg);
 		return NULL;
@@ -176,9 +176,7 @@
 	/* get mac block from queue */
 	msg = _sched_dequeue_prim(l1t, tn, fn, chan);
 	if (!msg) {
-		LOGP(DL1P, LOGL_INFO, "%s has not been served !! No prim for "
-			"trx=%u ts=%u at fn=%u to transmit.\n", 
-			trx_chan_desc[chan].name, l1t->trx->nr, tn, fn);
+		LOGL1S(DL1P, LOGL_INFO, l1t, tn, chan, fn, "has not been served !! No prim\n");
 		return NULL;
 	}
 
@@ -204,7 +202,7 @@
 		uint8_t tch_data[GSM_FR_BYTES];
 		int len;
 
-		LOGP(DL1P, LOGL_NOTICE, "Missing TCH bursts detected, sending "
+		LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn, "Missing TCH bursts detected, sending "
 			"BFI for %s\n", trx_chan_desc[chan].name);
 
 		/* indicate bad frame */
@@ -255,8 +253,8 @@
 			if (msg2) {
 				l1sap = msgb_l1sap_prim(msg2);
 				if (l1sap->oph.primitive == PRIM_TCH) {
-					LOGP(DL1P, LOGL_FATAL, "TCH twice, "
-						"please FIX! ");
+					LOGL1S(DL1P, LOGL_FATAL, l1t, tn, chan, fn,
+						"TCH twice, please FIX! ");
 					msgb_free(msg2);
 				} else
 					msg_facch = msg2;
@@ -266,8 +264,8 @@
 			if (msg2) {
 				l1sap = msgb_l1sap_prim(msg2);
 				if (l1sap->oph.primitive != PRIM_TCH) {
-					LOGP(DL1P, LOGL_FATAL, "FACCH twice, "
-						"please FIX! ");
+					LOGL1S(DL1P, LOGL_FATAL, l1t, tn, chan, fn,
+						"FACCH twice, please FIX! ");
 					msgb_free(msg2);
 				} else
 					msg_tch = msg2;
@@ -283,8 +281,8 @@
 
 	/* check validity of message */
 	if (msg_facch && msgb_l2len(msg_facch) != GSM_MACBLOCK_LEN) {
-		LOGP(DL1P, LOGL_FATAL, "Prim not 23 bytes, please FIX! "
-			"(len=%d)\n", msgb_l2len(msg_facch));
+		LOGL1S(DL1P, LOGL_FATAL, l1t, tn, chan, fn, "Prim not 23 bytes, please FIX! (len=%d)\n",
+			msgb_l2len(msg_facch));
 		/* free message */
 		msgb_free(msg_facch);
 		msg_facch = NULL;
@@ -299,10 +297,8 @@
 #endif
 
 		if (rsl_cmode != RSL_CMOD_SPD_SPEECH) {
-			LOGP(DL1P, LOGL_NOTICE, "%s Dropping speech frame, "
-				"because we are not in speech mode trx=%u "
-				"ts=%u at fn=%u.\n", trx_chan_desc[chan].name,
-				l1t->trx->nr, tn, fn);
+			LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn, "Dropping speech frame, "
+				"because we are not in speech mode\n");
 			goto free_bad_msg;
 		}
 
@@ -312,12 +308,8 @@
 				len = 15;
 				if (msgb_l2len(msg_tch) >= 1
 				 && (msg_tch->l2h[0] & 0xf0) != 0x00) {
-					LOGP(DL1P, LOGL_NOTICE, "%s "
-						"Transmitting 'bad "
-						"HR frame' trx=%u ts=%u at "
-						"fn=%u.\n",
-						trx_chan_desc[chan].name,
-						l1t->trx->nr, tn, fn);
+					LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
+						"Transmitting 'bad HR frame'\n");
 					goto free_bad_msg;
 				}
 				break;
@@ -325,10 +317,8 @@
 			len = GSM_FR_BYTES;
 			if (msgb_l2len(msg_tch) >= 1
 			 && (msg_tch->l2h[0] >> 4) != 0xd) {
-				LOGP(DL1P, LOGL_NOTICE, "%s Transmitting 'bad "
-					"FR frame' trx=%u ts=%u at fn=%u.\n",
-					trx_chan_desc[chan].name,
-					l1t->trx->nr, tn, fn);
+				LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
+					"Transmitting 'bad FR frame'\n");
 				goto free_bad_msg;
 			}
 			break;
@@ -338,10 +328,8 @@
 			len = GSM_EFR_BYTES;
 			if (msgb_l2len(msg_tch) >= 1
 			 && (msg_tch->l2h[0] >> 4) != 0xc) {
-				LOGP(DL1P, LOGL_NOTICE, "%s Transmitting 'bad "
-					"EFR frame' trx=%u ts=%u at fn=%u.\n",
-					trx_chan_desc[chan].name,
-					l1t->trx->nr, tn, fn);
+				LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
+					"Transmitting 'bad EFR frame'\n");
 				goto free_bad_msg;
 			}
 			break;
@@ -367,49 +355,39 @@
 				trx_loop_amr_set(chan_state, 1);
 			}
 			if (ft < 0) {
-				LOGP(DL1P, LOGL_ERROR, "%s Codec (FT = %d) "
-					" of RTP frame not in list. "
-					"trx=%u ts=%u\n",
-					trx_chan_desc[chan].name, ft_codec,
-					l1t->trx->nr, tn);
+				LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn,
+					"Codec (FT = %d) of RTP frame not in list. ", ft_codec);
 				goto free_bad_msg;
 			}
 			if (codec_mode_request && chan_state->dl_ft != ft) {
-				LOGP(DL1P, LOGL_NOTICE, "%s Codec (FT = %d) "
-					" of RTP cannot be changed now, but in "
-					"next frame. trx=%u ts=%u\n",
-					trx_chan_desc[chan].name, ft_codec,
-					l1t->trx->nr, tn);
+				LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
+					"Codec (FT = %d) of RTP cannot be changed now, but in "
+					"next frame\n", ft_codec);
 				goto free_bad_msg;
 			}
 			chan_state->dl_ft = ft;
 			if (bfi) {
-				LOGP(DL1P, LOGL_NOTICE, "%s Transmitting 'bad "
-					"AMR frame' trx=%u ts=%u at fn=%u.\n",
-					trx_chan_desc[chan].name,
-					l1t->trx->nr, tn, fn);
+				LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
+					"Transmitting 'bad AMR frame'\n");
 				goto free_bad_msg;
 			}
 #else
-			LOGP(DL1P, LOGL_ERROR, "AMR not supported!\n");
+			LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "AMR not supported!\n");
 			goto free_bad_msg;
 #endif
 			break;
 		default:
 inval_mode2:
-			LOGP(DL1P, LOGL_ERROR, "TCH mode invalid, please "
-				"fix!\n");
+			LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "TCH mode invalid, please fix!\n");
 			goto free_bad_msg;
 		}
 		if (len < 0) {
-			LOGP(DL1P, LOGL_ERROR, "Cannot send invalid AMR "
-				"payload\n");
+			LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "Cannot send invalid AMR payload\n");
 			goto free_bad_msg;
 		}
 		if (msgb_l2len(msg_tch) != len) {
-			LOGP(DL1P, LOGL_ERROR, "Cannot send payload with "
-				"invalid length! (expecing %d, received %d)\n",
-				len, msgb_l2len(msg_tch));
+			LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "Cannot send payload with "
+				"invalid length! (expecing %d, received %d)\n", len, msgb_l2len(msg_tch));
 free_bad_msg:
 			/* free message */
 			msgb_free(msg_tch);
@@ -436,9 +414,7 @@
 
 	/* no message at all */
 	if (!msg_tch && !msg_facch) {
-		LOGP(DL1P, LOGL_INFO, "%s has not been served !! No prim for "
-			"trx=%u ts=%u at fn=%u to transmit.\n", 
-			trx_chan_desc[chan].name, l1t->trx->nr, tn, fn);
+		LOGL1S(DL1P, LOGL_INFO, l1t, tn, chan, fn, "has not been served !! No prim\n");
 		goto send_burst;
 	}
 
@@ -471,18 +447,15 @@
 
 	/* check for FACCH alignment */
 	if (msg_facch && ((((fn + 4) % 26) >> 2) & 1)) {
-		LOGP(DL1P, LOGL_ERROR, "%s Cannot transmit FACCH starting on "
-			"even frames, please fix RTS!\n",
-			trx_chan_desc[chan].name);
+		LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "Cannot transmit FACCH starting on "
+			"even frames, please fix RTS!\n");
 		msgb_free(msg_facch);
 		msg_facch = NULL;
 	}
 
 	/* no message at all */
 	if (!msg_tch && !msg_facch && !chan_state->dl_ongoing_facch) {
-		LOGP(DL1P, LOGL_INFO, "%s has not been served !! No prim for "
-			"trx=%u ts=%u at fn=%u to transmit.\n", 
-			trx_chan_desc[chan].name, l1t->trx->nr, tn, fn);
+		LOGL1S(DL1P, LOGL_INFO, l1t, tn, chan, fn, "has not been served !! No prim\n");
 		goto send_burst;
 	}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0b5fd3b7982b9119becda844531108f64c68d19f
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list