Change in osmo-bts[master]: Use LOGPLCHAN whenever possible

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
Fri May 24 16:03:04 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14111 )

Change subject: Use LOGPLCHAN whenever possible
......................................................................

Use LOGPLCHAN whenever possible

There's no point in open-coding what LOGPLCHAN was created to do:
Log some event while stating the name of the logical channel.

Change-Id: I6913ac8fb543811126b85a54118333155c03bc03
---
M src/common/handover.c
M src/common/l1sap.c
M src/common/msg_utils.c
M src/common/oml.c
M src/common/rsl.c
M src/common/sysinfo.c
6 files changed, 150 insertions(+), 210 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/common/handover.c b/src/common/handover.c
index 54b131f..63a9832 100644
--- a/src/common/handover.c
+++ b/src/common/handover.c
@@ -44,9 +44,7 @@
 	if (!msg)
 		return -ENOMEM;
 
-	LOGP(DHO, LOGL_INFO,
-		"%s Sending PHYSICAL INFORMATION to MS.\n",
-		gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DHO, LOGL_INFO, "Sending PHYSICAL INFORMATION to MS.\n");
 
 	/* Build RSL UNITDATA REQUEST message with 04.08 PHYS INFO */
 	msg->l3h = msg->data;
@@ -68,20 +66,18 @@
 	struct gsm_lchan *lchan = data;
 	struct gsm_bts *bts = lchan->ts->trx->bts;
 
-	LOGP(DHO, LOGL_INFO, "%s T3105 timeout (%d resends left)\n",
-		gsm_lchan_name(lchan), bts->ny1 - lchan->ho.phys_info_count);
+	LOGPLCHAN(lchan, DHO, LOGL_INFO, "T3105 timeout (%d resends left)\n",
+		  bts->ny1 - lchan->ho.phys_info_count);
 
 	if (lchan->state != LCHAN_S_ACTIVE) {
-		LOGP(DHO, LOGL_NOTICE,
-			"%s is in not active. It is in state %s. Ignoring\n",
-			gsm_lchan_name(lchan), gsm_lchans_name(lchan->state));
+		LOGPLCHAN(lchan, DHO, LOGL_NOTICE, "is in not active. It is in state %s. Ignoring\n",
+			  gsm_lchans_name(lchan->state));
 		return;
 	}
 
 	if (lchan->ho.phys_info_count >= bts->ny1) {
 		/* HO Abort */
-		LOGP(DHO, LOGL_NOTICE, "%s NY1 reached, sending CONNection "
-			"FAILure to BSC.\n", gsm_lchan_name(lchan));
+		LOGPLCHAN(lchan, DHO, LOGL_NOTICE, "NY1 reached, sending CONNection FAILure to BSC.\n");
 		rsl_tx_conn_fail(lchan, RSL_ERR_HANDOVER_ACC_FAIL);
 		return;
 	}
@@ -98,23 +94,21 @@
 
 	/* Ignore invalid handover ref */
 	if (lchan->ho.ref != ra) {
-		LOGP(DHO, LOGL_INFO, "%s RACH on dedicated channel received, but "
-			"ra=0x%02x != expected ref=0x%02x. (This is no bug)\n",
-			gsm_lchan_name(lchan), ra, lchan->ho.ref);
+		LOGPLCHAN(lchan, DHO, LOGL_INFO, "RACH on dedicated channel received, but "
+			  "ra=0x%02x != expected ref=0x%02x. (This is no bug)\n", ra, lchan->ho.ref);
 		return;
 	}
 
 	/* Ignore handover on channels other than DCCH and SACCH */
 	if (lchan->type != GSM_LCHAN_SDCCH && lchan->type != GSM_LCHAN_TCH_H &&
 		lchan->type != GSM_LCHAN_TCH_F) {
-		LOGP(DHO, LOGL_ERROR, "%s handover RACH received on %s?!\n",
-		     gsm_lchan_name(lchan), gsm_lchant_name(lchan->type));
+		LOGPLCHAN(lchan, DHO, LOGL_ERROR, "handover RACH received on %s?!\n",
+			  gsm_lchant_name(lchan->type));
 		return;
 	}
 
-	LOGP(DHO, LOGL_NOTICE,
-	     "%s RACH on dedicated channel type %s received with TA=%u, ref=%u\n",
-	     gsm_lchan_name(lchan), gsm_lchant_name(lchan->type), acc_delay, ra);
+	LOGPLCHAN(lchan, DHO, LOGL_NOTICE, "RACH on dedicated channel type %s received with "
+		  "TA=%u, ref=%u\n", gsm_lchant_name(lchan->type), acc_delay, ra);
 
 	/* Set timing advance */
 	lchan->rqd_ta = acc_delay;
@@ -122,9 +116,7 @@
 	/* Stop handover detection, wait for valid frame */
 	lchan->ho.active = HANDOVER_WAIT_FRAME;
 	if (l1sap_chan_modify(lchan->ts->trx, gsm_lchan2chan_nr(lchan)) != 0) {
-		LOGP(DHO, LOGL_ERROR,
-			"%s failed to modify channel after handover\n",
-			gsm_lchan_name(lchan));
+		LOGPLCHAN(lchan, DHO, LOGL_ERROR, "failed to modify channel after handover\n");
 		rsl_tx_conn_fail(lchan, RSL_ERR_HANDOVER_ACC_FAIL);
 		return;
 	}
@@ -137,9 +129,7 @@
 	ho_tx_phys_info(lchan);
 
 	/* Start T3105 */
-	LOGP(DHO, LOGL_DEBUG,
-		"%s Starting T3105 with %u ms\n",
-		gsm_lchan_name(lchan), bts->t3105_ms);
+	LOGPLCHAN(lchan, DHO, LOGL_DEBUG, "Starting T3105 with %u ms\n", bts->t3105_ms);
 	lchan->ho.t3105.cb = ho_t3105_cb;
 	lchan->ho.t3105.data = lchan;
 	osmo_timer_schedule(&lchan->ho.t3105, 0, bts->t3105_ms * 1000);
@@ -148,8 +138,7 @@
 /* received frist valid data frame on dedicated channel */
 void handover_frame(struct gsm_lchan *lchan)
 {
-	LOGP(DHO, LOGL_INFO,
-		"%s First valid frame detected\n", gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DHO, LOGL_INFO, "First valid frame detected\n");
 	handover_reset(lchan);
 }
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 247763e..f31d822 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -114,9 +114,8 @@
 	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, chan_nr);
 
 	if (lchan && lchan->state != LCHAN_S_ACTIVE) {
-		LOGP(DL1P, LOGL_NOTICE, "%s: assuming active lchan, but "
-		     "state is %s\n", gsm_lchan_name(lchan),
-		     gsm_lchans_name(lchan->state));
+		LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "assuming active lchan, but state is %s\n",
+			  gsm_lchans_name(lchan->state));
 		return NULL;
 	}
 	return lchan;
@@ -139,9 +138,9 @@
 		r -= r % GSM_RTP_DURATION;
 
 		if (r != GSM_RTP_DURATION)
-			LOGP(DRTP, LOGL_ERROR, "RTP clock out of sync with lower layer:"
-				" %"PRIu32" vs %d (%"PRIu32"->%"PRIu32")\n",
-				r, GSM_RTP_DURATION, lchan->tch.last_fn, fn);
+			LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "RTP clock out of sync with lower layer:"
+				  " %"PRIu32" vs %d (%"PRIu32"->%"PRIu32")\n",
+				  r, GSM_RTP_DURATION, lchan->tch.last_fn, fn);
 	}
 	return GSM_RTP_DURATION;
 }
@@ -183,8 +182,7 @@
 {
 	struct osmo_phsap_prim *l1sap;
 
-	LOGP(DL1P, LOGL_DEBUG, "%s Rx -> RTP: %s\n",
-	     gsm_lchan_name(lchan), osmo_hexdump(rmsg->data, rmsg->len));
+	LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "Rx -> RTP: %s\n", osmo_hexdump(rmsg->data, rmsg->len));
 
 	rmsg->l2h = rmsg->data;
 	rmsg->l1h = msgb_push(rmsg, sizeof(*l1sap));
@@ -530,8 +528,8 @@
 		return;
 
 	if (data + 63 > 255) { /* According to 3GPP TS 48.058 §9.3.37 Timing Offset field cannot exceed 255 */
-		LOGP(DL1P, LOGL_ERROR, "Attempting to set invalid Timing Offset value %d (MS TO = %u)!\n",
-		     data, set_ms_to);
+		LOGPLCHAN(lchan, DL1P, LOGL_ERROR, "Attempting to set invalid Timing Offset value "
+			  "%d (MS TO = %u)!\n", data, set_ms_to);
 		return;
 	}
 
@@ -617,12 +615,10 @@
 	struct osmo_phsap_prim *l1sap,
 	struct info_act_cnf_param *info_act_cnf)
 {
-	struct gsm_lchan *lchan;
+	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, info_act_cnf->chan_nr);
 
-	LOGP(DL1C, LOGL_INFO, "activate confirm chan_nr=%s trx=%d\n",
-		rsl_chan_nr_str(info_act_cnf->chan_nr), trx->nr);
-
-	lchan = get_lchan_by_chan_nr(trx, info_act_cnf->chan_nr);
+	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "activate confirm chan_nr=%s trx=%d\n",
+		  rsl_chan_nr_str(info_act_cnf->chan_nr), trx->nr);
 
 	rsl_tx_chan_act_acknack(lchan, info_act_cnf->cause);
 
@@ -642,12 +638,10 @@
 	struct osmo_phsap_prim *l1sap,
 	struct info_act_cnf_param *info_act_cnf)
 {
-	struct gsm_lchan *lchan;
+	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, info_act_cnf->chan_nr);
 
-	LOGP(DL1C, LOGL_INFO, "deactivate confirm chan_nr=%s trx=%d\n",
-	     rsl_chan_nr_str(info_act_cnf->chan_nr), trx->nr);
-
-	lchan = get_lchan_by_chan_nr(trx, info_act_cnf->chan_nr);
+	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "deactivate confirm chan_nr=%s trx=%d\n",
+		  rsl_chan_nr_str(info_act_cnf->chan_nr), trx->nr);
 
 	rsl_tx_rf_rel_ack(lchan);
 
@@ -894,9 +888,9 @@
 	 * don't support it. */
 	if(lchan->tch_mode == GSM48_CMODE_SPEECH_AMR &&
 		!rtppayload_is_octet_aligned(resp_msg->data, resp_msg->len)) {
-		LOGP(DL1P, LOGL_NOTICE,
-			"%s RTP->L1: Dropping unexpected AMR encoding (bw-efficient?) %s\n",
-			gsm_lchan_name(lchan), osmo_hexdump(resp_msg->data, resp_msg->len));
+		LOGPLCHAN(lchan, DL1P, LOGL_NOTICE,
+			  "RTP->L1: Dropping unexpected AMR encoding (bw-efficient?) %s\n",
+			  osmo_hexdump(resp_msg->data, resp_msg->len));
 		return false;
 	}
 	return true;
@@ -1469,8 +1463,8 @@
 	struct gsm48_chan_desc *cd;
 	int rc;
 
-	LOGP(DL1C, LOGL_INFO, "activating channel chan_nr=%s trx=%d\n",
-		rsl_chan_nr_str(chan_nr), trx->nr);
+	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "activating channel chan_nr=%s trx=%d\n",
+		  rsl_chan_nr_str(chan_nr), trx->nr);
 
 	/* osmo-pcu calls this without a valid 'tp' parameter, so we
 	 * need to make sure ew don't crash here */
@@ -1483,8 +1477,8 @@
 		 * one one TRX, so we need to make sure not to activate
 		 * channels with a different TSC!! */
 		if (cd->h0.tsc != (lchan->ts->trx->bts->bsic & 7)) {
-			LOGP(DL1C, LOGL_ERROR, "lchan TSC %u != BSIC-TSC %u\n",
-				cd->h0.tsc, lchan->ts->trx->bts->bsic & 7);
+			LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "lchan TSC %u != BSIC-TSC %u\n",
+				  cd->h0.tsc, lchan->ts->trx->bts->bsic & 7);
 			return -RSL_ERR_SERV_OPT_UNIMPL;
 		}
 	}
@@ -1517,8 +1511,8 @@
 int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr)
 {
 	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, chan_nr);
-	LOGP(DL1C, LOGL_INFO, "deactivating channel chan_nr=%s trx=%d\n",
-		rsl_chan_nr_str(chan_nr), trx->nr);
+	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "deactivating channel chan_nr=%s trx=%d\n",
+		  rsl_chan_nr_str(chan_nr), trx->nr);
 
 	if (lchan->tch.dtx.dl_amr_fsm) {
 		osmo_fsm_inst_free(lchan->tch.dtx.dl_amr_fsm);
@@ -1533,8 +1527,8 @@
 {
 	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, chan_nr);
 
-	LOGP(DL1C, LOGL_INFO, "deactivating sacch chan_nr=%s trx=%d\n",
-		rsl_chan_nr_str(chan_nr), trx->nr);
+	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "deactivating sacch chan_nr=%s trx=%d\n",
+		  rsl_chan_nr_str(chan_nr), trx->nr);
 
 	lchan->sacch_deact = 1;
 
diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index f936c98..52b0566 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -203,8 +203,8 @@
 
 	rc = osmo_amr_rtp_dec(rtp_pl, rtp_pl_len, &cmr, &cmi, &ft, &bfi, &sti);
 	if (rc < 0) {
-		LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu, "
-		     "%p)\n", rtp_pl_len, rtp_pl);
+		LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu, "
+			  "%p)\n", rtp_pl_len, rtp_pl);
 		return rc;
 	}
 
@@ -274,7 +274,7 @@
 	}
 
 	if (ft != AMR_NO_DATA) {
-		LOGP(DRTP, LOGL_ERROR, "unsupported AMR FT 0x%02x\n", ft);
+		LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "unsupported AMR FT 0x%02x\n", ft);
 		return -ENOTSUP;
 	}
 
@@ -505,9 +505,9 @@
 		return lchan->tch.dtx.len + 1;
 	}
 
-	LOGP(DL1C, LOGL_DEBUG, "Have to send %s frame on TCH but SID buffer "
-	     "is empty - sent nothing\n",
-	     get_value_string(gsm48_chan_mode_names, lchan->tch_mode));
+	LOGPLCHAN(lchan, DL1C, LOGL_DEBUG, "Have to send %s frame on TCH but SID buffer "
+		  "is empty - sent nothing\n",
+		  get_value_string(gsm48_chan_mode_names, lchan->tch_mode));
 
 	return 0;
 }
diff --git a/src/common/oml.c b/src/common/oml.c
index 260dfc4..186c2a2 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -527,9 +527,8 @@
 		return -1;
 	}
 
-	DEBUGP(DLLAPD, "%s: Setting T200 D0=%u, D3=%u, S0=%u, S3=%u"
-		"(all in ms)\n", gsm_lchan_name(lchan), t200_dcch,
-		t200_dcch_sapi3, t200_acch, t200_acch_sapi3);
+	LOGPLCHAN(lchan, DLLAPD, LOGL_DEBUG, "Setting T200 D0=%u, D3=%u, S0=%u, S3=%u (all in ms)\n",
+		  t200_dcch, t200_dcch_sapi3, t200_acch, t200_acch_sapi3);
 
 	dl_set_t200(&lc->lapdm_dcch.datalink[DL_SAPI0], t200_dcch);
 	dl_set_t200(&lc->lapdm_dcch.datalink[DL_SAPI3], t200_dcch_sapi3);
diff --git a/src/common/rsl.c b/src/common/rsl.c
index af0b72d..e6fbe6f 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -695,8 +695,7 @@
 		switch (lchan->ts->pchan) {
 		case GSM_PCHAN_TCH_F_TCH_H_PDCH:
 			if (lchan->ts->dyn.pchan_is != GSM_PCHAN_PDCH) {
-				LOGP(DRSL, LOGL_ERROR,
-				     "%s (ss=%d) PDCH release: not in PDCH mode\n",
+				LOGP(DRSL, LOGL_ERROR, "%s (ss=%d) PDCH release: not in PDCH mode\n",
 				     gsm_ts_and_pchan_name(lchan->ts), lchan->nr);
 				/* well, what to do about it ... carry on and hope it's fine. */
 			}
@@ -712,8 +711,8 @@
 			send_rel_ack = false;
 			break;
 		default:
-			LOGP(DRSL, LOGL_ERROR, "%s PCU rel ack for unexpected lchan kind %s\n",
-			     gsm_lchan_name(lchan), gsm_pchan_name(lchan->rel_act_kind));
+			LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "PCU rel ack for unexpected lchan kind %s\n",
+				  gsm_pchan_name(lchan->rel_act_kind));
 			/* Release certainly was not requested by the BSC via RSL, so don't ack. */
 			send_rel_ack = false;
 			break;
@@ -728,8 +727,7 @@
 	}
 
 	if (!send_rel_ack) {
-		LOGP(DRSL, LOGL_NOTICE, "%s not sending REL ACK\n",
-			gsm_lchan_name(lchan));
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "%s not sending REL ACK\n", gsm_lchan_name(lchan));
 		return 0;
 	}
 
@@ -779,7 +777,7 @@
 	struct msgb *msg;
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
-	LOGP(DRSL, LOGL_INFO, "Sending HANDOver DETect\n");
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Sending HANDOver DETect\n");
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -826,8 +824,8 @@
 int rsl_tx_chan_act_acknack(struct gsm_lchan *lchan, uint8_t cause)
 {
 	if (lchan->rel_act_kind != LCHAN_REL_ACT_RSL) {
-		LOGP(DRSL, LOGL_NOTICE, "%s not sending CHAN ACT %s\n",
-			gsm_lchan_name(lchan), cause ? "NACK" : "ACK");
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "not sending CHAN ACT %s\n",
+			  cause ? "NACK" : "ACK");
 		return 0;
 	}
 
@@ -842,9 +840,7 @@
 	struct msgb *msg;
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
-	LOGP(DRSL, LOGL_NOTICE,
-		"%s Sending Connection Failure: cause = 0x%02x\n",
-		gsm_lchan_name(lchan), cause);
+	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Sending Connection Failure: cause = 0x%02x\n", cause);
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -920,15 +916,13 @@
 	/* check if the encryption algorithm sent by BSC is supported! */
 	rc = bts_supports_cipher(bts, *val);
 	if (rc != 1) {
-		LOGP(DRSL, LOGL_ERROR, "%s: BTS doesn't support cipher %s\n",
-			gsm_lchan_name(lchan), ciph_name);
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "BTS doesn't support cipher %s\n", ciph_name);
 		return -EINVAL;
 	}
 
 	/* length can be '1' in case of no ciphering */
 	if (len < 1) {
-		LOGP(DRSL, LOGL_ERROR, "%s: Encryption Info cannot have len=%d\n",
-			gsm_lchan_name(lchan), len);
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Encryption Info cannot have len=%d\n", len);
 		return -EINVAL;
 	}
 
@@ -937,8 +931,7 @@
 	if (lchan->encr.key_len > sizeof(lchan->encr.key))
 		lchan->encr.key_len = sizeof(lchan->encr.key);
 	memcpy(lchan->encr.key, val, lchan->encr.key_len);
-	DEBUGP(DRSL, "%s: Setting lchan cipher algorithm %s\n",
-		gsm_lchan_name(lchan), ciph_name);
+	LOGPLCHAN(lchan, DRSL, LOGL_DEBUG, "Setting lchan cipher algorithm %s\n", ciph_name);
 
 	return 0;
 }
@@ -1026,9 +1019,8 @@
 	int rc;
 
 	if (lchan->state != LCHAN_S_NONE) {
-		LOGP(DRSL, LOGL_ERROR,
-		     "%s: error: lchan is not available, but in state: %s.\n",
-		     gsm_lchan_name(lchan), gsm_lchans_name(lchan->state));
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "error: lchan is not available, but in state: %s.\n",
+			  gsm_lchans_name(lchan->state));
 		return rsl_tx_chan_act_nack(lchan, RSL_ERR_EQUIPMENT_FAIL);
 	}
 
@@ -1050,8 +1042,8 @@
 		}
 	}
 
-	LOGP(DRSL, LOGL_DEBUG, "%s: rx Channel Activation in state: %s.\n",
-	     gsm_lchan_name(lchan), gsm_lchans_name(lchan->state));
+	LOGPLCHAN(lchan, DRSL, LOGL_DEBUG, "rx Channel Activation in state: %s.\n",
+		  gsm_lchans_name(lchan->state));
 
 	/* Initialize channel defaults */
 	lchan->ms_power = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, 0);
@@ -1062,7 +1054,7 @@
 
 	/* 9.3.3 Activation Type */
 	if (!TLVP_PRESENT(&tp, RSL_IE_ACT_TYPE)) {
-		LOGP(DRSL, LOGL_NOTICE, "missing Activation Type\n");
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "missing Activation Type\n");
 		return rsl_tx_chan_act_nack(lchan, RSL_ERR_MAND_IE_ERROR);
 	}
 	type = *TLVP_VAL(&tp, RSL_IE_ACT_TYPE);
@@ -1070,7 +1062,7 @@
 	/* 9.3.6 Channel Mode */
 	if (type != RSL_ACT_OSMO_PDCH) {
 		if (!TLVP_PRESENT(&tp, RSL_IE_CHAN_MODE)) {
-			LOGP(DRSL, LOGL_NOTICE, "missing Channel Mode\n");
+			LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "missing Channel Mode\n");
 			return rsl_tx_chan_act_nack(lchan, RSL_ERR_MAND_IE_ERROR);
 		}
 		cm = (struct rsl_ie_chan_mode *) TLVP_VAL(&tp, RSL_IE_CHAN_MODE);
@@ -1134,7 +1126,7 @@
 
 			osmo_si = osmo_rsl2sitype(rsl_si);
 			if (osmo_si == SYSINFO_TYPE_NONE) {
-				LOGP(DRSL, LOGL_NOTICE, " Rx SACCH SI 0x%02x not supported.\n", rsl_si);
+				LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Rx SACCH SI 0x%02x not supported.\n", rsl_si);
 				rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT, &dch->chan_nr,
 						    NULL, msg);
 				return rsl_tx_chan_act_acknack(lchan, RSL_ERR_IE_CONTENT);
@@ -1144,7 +1136,7 @@
 
 			cur += si_len;
 			if (cur > val + tot_len) {
-				LOGP(DRSL, LOGL_ERROR, "Error parsing SACCH INFO IE\n");
+				LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Error parsing SACCH INFO IE\n");
 				rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT, &dch->chan_nr,
 						    NULL, msg);
 				return rsl_tx_chan_act_acknack(lchan, RSL_ERR_IE_CONTENT);
@@ -1157,7 +1149,7 @@
 	/* 9.3.52 MultiRate Configuration */
 	if (TLVP_PRESENT(&tp, RSL_IE_MR_CONFIG)) {
 		if (TLVP_LEN(&tp, RSL_IE_MR_CONFIG) > sizeof(lchan->mr_bts_lv) - 1) {
-			LOGP(DRSL, LOGL_ERROR, "Error parsing MultiRate conf IE\n");
+			LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Error parsing MultiRate conf IE\n");
 			rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT, &dch->chan_nr, NULL, msg);
 			return rsl_tx_chan_act_acknack(lchan, RSL_ERR_IE_CONTENT);
 		}
@@ -1172,9 +1164,8 @@
 	/* 9.3.53 MultiRate Control */
 	/* 9.3.54 Supported Codec Types */
 
-	LOGP(DRSL, LOGL_INFO, "%s: chan_nr=%s type=0x%02x mode=%s\n",
-	     gsm_lchan_name(lchan), rsl_chan_nr_str(dch->chan_nr), type,
-	     gsm48_chan_mode_name(lchan->tch_mode));
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "chan_nr=%s type=0x%02x mode=%s\n",
+		  rsl_chan_nr_str(dch->chan_nr), type, gsm48_chan_mode_name(lchan->tch_mode));
 
 	/* Connecting PDCH on dyn TS goes via PCU instead. */
 	if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH
@@ -1362,9 +1353,8 @@
 	struct ciph_mod_compl *cmc = data;
 	const char *imeisv = NULL;
 
-	LOGP(DRSL, LOGL_NOTICE,
-	     "%s Sending FAKE CIPHERING MODE COMPLETE to BSC (Alg %u)\n",
-	     gsm_lchan_name(cmc->lchan), cmc->lchan->encr.alg_id);
+	LOGPLCHAN(cmc->lchan, DRSL, LOGL_NOTICE, "Sending FAKE CIPHERING MODE COMPLETE to BSC (Alg %u)\n",
+		  cmc->lchan->encr.alg_id);
 
 	if (cmc->send_imeisv)
 		imeisv = "0123456789012345";
@@ -1440,8 +1430,7 @@
 	} else
 #endif
 	{
-	LOGP(DRSL, LOGL_INFO, "%s Fwd RSL ENCR CMD (Alg %u) to LAPDm\n",
-		gsm_lchan_name(lchan), lchan->encr.alg_id);
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Fwd RSL ENCR CMD (Alg %u) to LAPDm\n", lchan->encr.alg_id);
 	/* hand it into RSLms for transmission of L3_INFO to the MS */
 	lapdm_rslms_recvmsg(msg, &lchan->lapdm_ch);
 	/* return 1 to make sure the msgb is not free'd */
@@ -1487,7 +1476,7 @@
 	struct msgb *msg;
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
-	LOGP(DRSL, LOGL_INFO, "%s Tx MODE MODIF ACK\n", gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Tx MODE MODIF ACK\n");
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -1511,17 +1500,15 @@
 
 	/* 9.3.6 Channel Mode */
 	if (!TLVP_PRESENT(&tp, RSL_IE_CHAN_MODE)) {
-		LOGP(DRSL, LOGL_NOTICE, "missing Channel Mode\n");
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "missing Channel Mode\n");
 		return rsl_tx_mode_modif_nack(lchan, RSL_ERR_MAND_IE_ERROR);
 	}
 	cm = (struct rsl_ie_chan_mode *) TLVP_VAL(&tp, RSL_IE_CHAN_MODE);
 	lchan_tchmode_from_cmode(lchan, cm);
 
 	if (bts_supports_cm(lchan->ts->trx->bts, ts_pchan(lchan->ts), lchan->tch_mode) != 1) {
-		LOGP(DRSL, LOGL_ERROR,
-		     "%s %s: invalid mode: %s (wrong BSC configuration?)\n",
-		     gsm_ts_and_pchan_name(lchan->ts), gsm_lchan_name(lchan),
-		     gsm48_chan_mode_name(lchan->tch_mode));
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "%s: invalid mode: %s (wrong BSC configuration?)\n",
+			  gsm_ts_and_pchan_name(lchan->ts), gsm48_chan_mode_name(lchan->tch_mode));
 		return rsl_tx_mode_modif_nack(lchan, RSL_ERR_SERV_OPT_UNAVAIL);
 	}
 
@@ -1541,7 +1528,7 @@
 	/* 9.3.52 MultiRate Configuration */
 	if (TLVP_PRESENT(&tp, RSL_IE_MR_CONFIG)) {
 		if (TLVP_LEN(&tp, RSL_IE_MR_CONFIG) > sizeof(lchan->mr_bts_lv) - 1) {
-			LOGP(DRSL, LOGL_ERROR, "Error parsing MultiRate conf IE\n");
+			LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Error parsing MultiRate conf IE\n");
 			rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT, &dch->chan_nr, NULL, msg);
 			return rsl_tx_mode_modif_nack(lchan, RSL_ERR_IE_CONTENT);;
 		}
@@ -1576,8 +1563,7 @@
 		lchan->ms_power_ctrl.fixed = 1;
 		lchan->ms_power_ctrl.current = pwr;
 
-		LOGP(DRSL, LOGL_NOTICE, "%s forcing power to %d\n",
-			gsm_lchan_name(lchan), lchan->ms_power_ctrl.current);
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "forcing power to %d\n", lchan->ms_power_ctrl.current);
 		bts_model_adjst_ms_pwr(lchan);
 	}
 
@@ -1596,7 +1582,7 @@
 	rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
 
 	if (TLVP_PRESENT(&tp, RSL_IE_STARTNG_TIME)) {
-		LOGP(DRSL, LOGL_NOTICE, "Starting time not supported\n");
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Starting time not supported\n");
 		return rsl_tx_error_report(msg->trx, RSL_ERR_SERV_OPT_UNIMPL, &dch->chan_nr, NULL, msg);
 	}
 
@@ -1610,8 +1596,7 @@
 
 	osmo_si = osmo_rsl2sitype(rsl_si);
 	if (osmo_si == SYSINFO_TYPE_NONE) {
-		LOGP(DRSL, LOGL_NOTICE, "%s Rx SACCH SI 0x%02x not supported.\n",
-			gsm_lchan_name(lchan), rsl_si);
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Rx SACCH SI 0x%02x not supported.\n", rsl_si);
 		return rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT, &dch->chan_nr, NULL, msg);
 	}
 	if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
@@ -1623,14 +1608,12 @@
 		else
 			lchan->si.overridden &= ~(1 << osmo_si);
 
-		LOGP(DRSL, LOGL_INFO, "%s Rx RSL SACCH FILLING (SI%s)\n",
-			gsm_lchan_name(lchan),
-			get_value_string(osmo_sitype_strs, osmo_si));
+		LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Rx RSL SACCH FILLING (SI%s)\n",
+			  get_value_string(osmo_sitype_strs, osmo_si));
 	} else {
 		lchan->si.valid &= ~(1 << osmo_si);
-		LOGP(DRSL, LOGL_INFO, "%s Rx RSL Disabling SACCH FILLING (SI%s)\n",
-			gsm_lchan_name(lchan),
-			get_value_string(osmo_sitype_strs, osmo_si));
+		LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Rx RSL Disabling SACCH FILLING (SI%s)\n",
+			  get_value_string(osmo_sitype_strs, osmo_si));
 	}
 
 	return 0;
@@ -1700,8 +1683,8 @@
 {
 	struct msgb *nmsg;
 
-	LOGP(DRSL, LOGL_NOTICE, "%s Sending RTP delete indication: cause = %s\n",
-	     gsm_lchan_name(lchan), rsl_err_name(cause));
+	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Sending RTP delete indication: cause = %s\n",
+		  rsl_err_name(cause));
 
 	nmsg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!nmsg)
@@ -1732,9 +1715,8 @@
 		name = "MDCX";
 
 	ia.s_addr = htonl(lchan->abis_ip.bound_ip);
-	LOGP(DRSL, LOGL_INFO, "%s RSL Tx IPAC_%s_ACK (local %s:%u, ",
-	     gsm_lchan_name(lchan), name,
-	     inet_ntoa(ia), lchan->abis_ip.bound_port);
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "RSL Tx IPAC_%s_ACK (local %s:%u, ",
+		  name, inet_ntoa(ia), lchan->abis_ip.bound_port);
 	ia.s_addr = htonl(lchan->abis_ip.connect_ip);
 	LOGPC(DRSL, LOGL_INFO, "remote %s:%u)\n",
 		inet_ntoa(ia), lchan->abis_ip.connect_port);
@@ -1773,8 +1755,7 @@
 	struct msgb *msg;
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
-	LOGP(DRSL, LOGL_INFO, "%s RSL Tx IPAC_DLCX_ACK\n",
-		gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "RSL Tx IPAC_DLCX_ACK\n");
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -1797,8 +1778,7 @@
 	struct msgb *msg;
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
-	LOGP(DRSL, LOGL_INFO, "%s RSL Tx IPAC_DLCX_NACK\n",
-		gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DRSL, LOGL_INFO, "RSL Tx IPAC_DLCX_NACK\n");
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -1825,8 +1805,7 @@
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
 	/* FIXME: allocate new msgb and copy old over */
-	LOGP(DRSL, LOGL_NOTICE, "%s RSL Tx IPAC_BIND_NACK\n",
-		gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "RSL Tx IPAC_BIND_NACK\n");
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -1926,7 +1905,7 @@
 		return tx_ipac_XXcx_nack(lchan, RSL_ERR_MAND_IE_ERROR,
 					 0, dch->c.msg_type);
 
-	LOGP(DRSL, LOGL_DEBUG, "%s IPAC_%s: ", gsm_lchan_name(lchan), name);
+	LOGPLCHAN(lchan, DRSL, LOGL_DEBUG, "IPAC_%s: ", name);
 	if (TLVP_PRES_LEN(&tp, RSL_IE_IPAC_REMOTE_IP, 4)) {
 		connect_ip = tlvp_val32_unal(&tp, RSL_IE_IPAC_REMOTE_IP);
 		addr.s_addr = connect_ip;
@@ -1955,9 +1934,8 @@
 		inc_ip_port = 1;
 
 	if (payload_type && payload_type2) {
-		LOGP(DRSL, LOGL_ERROR, "%s Rx RSL IPAC %s, "
-			"RTP_PT and RTP_PT2 in same msg !?!\n",
-			gsm_lchan_name(lchan), name);
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Rx RSL IPAC %s, "
+			"RTP_PT and RTP_PT2 in same msg !?!\n", name);
 		return tx_ipac_XXcx_nack(lchan, RSL_ERR_MAND_IE_ERROR,
 					 inc_ip_port, dch->c.msg_type);
 	}
@@ -1966,9 +1944,8 @@
 		char cname[32];
 		char *ipstr = NULL;
 		if (lchan->abis_ip.rtp_socket) {
-			LOGP(DRSL, LOGL_ERROR, "%s Rx RSL IPAC CRCX, "
-				"but we already have socket!\n",
-				gsm_lchan_name(lchan));
+			LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Rx RSL IPAC CRCX, "
+				  "but we already have socket!\n");
 			return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL,
 						 inc_ip_port, dch->c.msg_type);
 		}
@@ -1978,9 +1955,7 @@
 		lchan->abis_ip.rtp_socket = osmo_rtp_socket_create(lchan->ts->trx,
 								OSMO_RTP_F_POLL);
 		if (!lchan->abis_ip.rtp_socket) {
-			LOGP(DRTP, LOGL_ERROR,
-			     "%s IPAC Failed to create RTP/RTCP sockets\n",
-			     gsm_lchan_name(lchan));
+			LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "IPAC Failed to create RTP/RTCP sockets\n");
 			oml_tx_failure_event_rep(&lchan->ts->trx->mo,
 						 OSMO_EVT_CRIT_RTP_TOUT,
 						 "%s IPAC Failed to create RTP/RTCP sockets",
@@ -1994,13 +1969,10 @@
 					       OSMO_RTP_P_JITBUF,
 					       bts->rtp_jitter_buf_ms);
 		if (rc < 0)
-			LOGP(DRTP, LOGL_ERROR,
-			     "%s IPAC Failed to set RTP socket parameters: %s\n",
-			     gsm_lchan_name(lchan), strerror(-rc));
+			LOGPLCHAN(lchan, DRTP, LOGL_ERROR,
+				  "IPAC Failed to set RTP socket parameters: %s\n", strerror(-rc));
 		else
-			LOGP(DRTP, LOGL_INFO,
-			     "%s IPAC set RTP socket parameters: %d\n",
-			     gsm_lchan_name(lchan), rc);
+			LOGPLCHAN(lchan, DRTP, LOGL_INFO, "IPAC set RTP socket parameters: %d\n", rc);
 		lchan->abis_ip.rtp_socket->priv = lchan;
 		lchan->abis_ip.rtp_socket->rx_cb = &l1sap_rtp_rx_cb;
 
@@ -2020,9 +1992,7 @@
 		}
 		rc = bind_rtp(bts, lchan->abis_ip.rtp_socket, ipstr);
 		if (rc < 0) {
-			LOGP(DRTP, LOGL_ERROR,
-			     "%s IPAC Failed to bind RTP/RTCP sockets\n",
-			     gsm_lchan_name(lchan));
+			LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "IPAC Failed to bind RTP/RTCP sockets\n");
 			oml_tx_failure_event_rep(&lchan->ts->trx->mo,
 						 OSMO_EVT_CRIT_RTP_TOUT,
 						 "%s IPAC Failed to bind RTP/RTCP sockets",
@@ -2043,9 +2013,8 @@
 	} else {
 		/* MDCX */
 		if (!lchan->abis_ip.rtp_socket) {
-			LOGP(DRSL, LOGL_ERROR, "%s Rx RSL IPAC MDCX, "
-				"but we have no RTP socket!\n",
-				gsm_lchan_name(lchan));
+			LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Rx RSL IPAC MDCX, "
+				  "but we have no RTP socket!\n");
 			return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL,
 						 inc_ip_port, dch->c.msg_type);
 		}
@@ -2064,9 +2033,7 @@
 	rc = osmo_rtp_socket_connect(lchan->abis_ip.rtp_socket,
 				     inet_ntoa(ia), ntohs(connect_port));
 	if (rc < 0) {
-		LOGP(DRTP, LOGL_ERROR,
-		     "%s Failed to connect RTP/RTCP sockets\n",
-		     gsm_lchan_name(lchan));
+		LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "Failed to connect RTP/RTCP sockets\n");
 		osmo_rtp_socket_free(lchan->abis_ip.rtp_socket);
 		lchan->abis_ip.rtp_socket = NULL;
 		msgb_queue_flush(&lchan->dl_tch_queue);
@@ -2081,9 +2048,7 @@
 					&lchan->abis_ip.bound_ip,
 					&port);
 	if (rc < 0)
-		LOGP(DRTP, LOGL_ERROR, "%s IPAC cannot obtain "
-		     "locally bound IP/port: %d\n",
-		     gsm_lchan_name(lchan), rc);
+		LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "IPAC cannot obtain locally bound IP/port: %d\n", rc);
 	lchan->abis_ip.bound_port = port;
 
 	/* Everything has succeeded, we can store new values in lchan */
@@ -2145,8 +2110,7 @@
 	struct msgb *msg;
 	uint8_t ie[2];
 
-	LOGP(DRSL, LOGL_NOTICE, "%s Tx PDCH %s ACK\n",
-	     gsm_lchan_name(lchan), pdch_act? "ACT" : "DEACT");
+	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Tx PDCH %s ACK\n", pdch_act? "ACT" : "DEACT");
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -2173,8 +2137,8 @@
 	struct msgb *msg;
 	uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
 
-	LOGP(DRSL, LOGL_NOTICE, "%s Tx PDCH %s NACK (cause = 0x%02x)\n",
-	     gsm_lchan_name(lchan), pdch_act? "ACT" : "DEACT", cause);
+	LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Tx PDCH %s NACK (cause = 0x%02x)\n",
+		  pdch_act ? "ACT" : "DEACT", cause);
 
 	msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr));
 	if (!msg)
@@ -2236,11 +2200,11 @@
 	if (ts->flags & TS_F_PDCH_PENDING_MASK) {
 		/* Only one of the pending flags should ever be set at the same
 		 * time, but just log both in case both should be set. */
-		LOGP(DRSL, LOGL_ERROR,
-		     "%s Request to PDCH %s, but PDCH%s%s is still pending\n",
-		     gsm_lchan_name(lchan), pdch_act? "ACT" : "DEACT",
-		     (ts->flags & TS_F_PDCH_ACT_PENDING)? " ACT" : "",
-		     (ts->flags & TS_F_PDCH_DEACT_PENDING)? " DEACT" : "");
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR,
+			  "Request to PDCH %s, but PDCH%s%s is still pending\n",
+			  pdch_act? "ACT" : "DEACT",
+			  (ts->flags & TS_F_PDCH_ACT_PENDING)? " ACT" : "",
+			  (ts->flags & TS_F_PDCH_DEACT_PENDING)? " DEACT" : "");
 		rsl_tx_dyn_pdch_nack(lchan, pdch_act, RSL_ERR_NORMAL_UNSPEC);
 		return;
 	}
@@ -2263,18 +2227,16 @@
 
 	/* ensure that this is indeed a dynamic-PDCH channel */
 	if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
-		LOGP(DRSL, LOGL_ERROR,
-		     "%s Attempt to PDCH %s on TS that is not a TCH/F_PDCH (is %s)\n",
-		     gsm_lchan_name(lchan), pdch_act? "ACT" : "DEACT",
-		     gsm_pchan_name(ts->pchan));
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR,
+			  "Attempt to PDCH %s on TS that is not a TCH/F_PDCH (is %s)\n",
+			  pdch_act? "ACT" : "DEACT", gsm_pchan_name(ts->pchan));
 		ipacc_dyn_pdch_complete(ts, -EINVAL);
 		return;
 	}
 
 	if (is_pdch_act == pdch_act) {
-		LOGP(DL1C, LOGL_NOTICE,
-		     "%s Request to PDCH %s, but is already so\n",
-		     gsm_lchan_name(lchan), pdch_act? "ACT" : "DEACT");
+		LOGPLCHAN(lchan, DL1C, LOGL_NOTICE, "Request to PDCH %s, but is already so\n",
+			  pdch_act? "ACT" : "DEACT");
 		ipacc_dyn_pdch_complete(ts, 0);
 		return;
 	}
@@ -2590,8 +2552,8 @@
 
 	lchan = lchan_lookup(trx, rh->chan_nr, "RSL rx RLL: ");
 	if (!lchan) {
-		LOGP(DRLL, LOGL_NOTICE, "Rx RLL %s for unknown lchan\n",
-			rsl_msg_name(rh->c.msg_type));
+		LOGPLCHAN(lchan, DRLL, LOGL_NOTICE, "Rx RLL %s for unknown lchan\n",
+			  rsl_msg_name(rh->c.msg_type));
 		return rsl_reject_unknown_lchan(msg);
 	}
 
@@ -2717,9 +2679,8 @@
 	int res_valid = lchan->meas.flags & LC_UL_M_F_RES_VALID;
 	struct gsm_bts *bts = lchan->ts->trx->bts;
 
-	LOGP(DRSL, LOGL_DEBUG,
-	     "%s chan_num:%u Tx MEAS RES valid(%d), flags(%02x)\n",
-	     gsm_lchan_name(lchan), chan_nr, res_valid, lchan->meas.flags);
+	LOGPLCHAN(lchan, DRSL, LOGL_DEBUG, "chan_num:%u Tx MEAS RES valid(%d), flags(%02x)\n",
+		  chan_nr, res_valid, lchan->meas.flags);
 
 	if (!res_valid)
 		return -EINPROGRESS;
@@ -2728,9 +2689,8 @@
 	if (!msg)
 		return -ENOMEM;
 
-	LOGP(DRSL, LOGL_DEBUG,
-	     "%s Send Meas RES: NUM:%u, RXLEV_FULL:%u, RXLEV_SUB:%u, RXQUAL_FULL:%u, RXQUAL_SUB:%u, MS_PWR:%u, UL_TA:%u, L3_LEN:%d, TimingOff:%u\n",
-	     gsm_lchan_name(lchan),
+	LOGPLCHAN(lchan, DRSL, LOGL_DEBUG,
+	     "Send Meas RES: NUM:%u, RXLEV_FULL:%u, RXLEV_SUB:%u, RXQUAL_FULL:%u, RXQUAL_SUB:%u, MS_PWR:%u, UL_TA:%u, L3_LEN:%d, TimingOff:%u\n",
 	     lchan->meas.res_nr,
 	     lchan->meas.ul_res.full.rx_lev,
 	     lchan->meas.ul_res.sub.rx_lev,
@@ -2794,9 +2754,8 @@
 	rh = msgb_l2(msg);
 
 	if (lchan->state != LCHAN_S_ACTIVE) {
-		LOGP(DRSL, LOGL_ERROR, "%s(%s) is not active. Dropping message (len=%u): %s\n",
-			gsm_lchan_name(lchan), gsm_lchans_name(lchan->state),
-			msgb_l2len(msg), msgb_hexdump_l2(msg));
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "(%s) is not active. Dropping message (len=%u): %s\n",
+			  gsm_lchans_name(lchan->state), msgb_l2len(msg), msgb_hexdump_l2(msg));
 		msgb_free(msg);
 		return 0;
 	}
@@ -2809,19 +2768,20 @@
 	if (rslms_is_meas_rep(msg)) {
 		int rc;
 
-		LOGP(DRSL, LOGL_INFO, "%s Handing RLL msg %s from LAPDm to MEAS REP\n",
-			gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));
+		LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Handing RLL msg %s from LAPDm to MEAS REP\n",
+			  rsl_msg_name(rh->msg_type));
 
 		/* REL_IND handling */
 		if (rh->msg_type == RSL_MT_REL_IND &&
 			(lchan->type == GSM_LCHAN_TCH_F || lchan->type == GSM_LCHAN_TCH_H)) {
-			LOGP(DRSL, LOGL_INFO, "%s Scheduling %s to L3 in next associated TCH-RTS.ind\n",
-				gsm_lchan_name(lchan),
-				rsl_msg_name(rh->msg_type));
+			LOGPLCHAN(lchan, DRSL, LOGL_INFO,
+				  "Scheduling %s to L3 in next associated TCH-RTS.ind\n",
+				  rsl_msg_name(rh->msg_type));
 
 			if(lchan->pending_rel_ind_msg) {
-				LOGP(DRSL, LOGL_INFO, "Dropping pending release indication message\n");
-					msgb_free(lchan->pending_rel_ind_msg);
+				LOGPLCHAN(lchan, DRSL, LOGL_INFO,
+					  "Dropping pending release indication message\n");
+				msgb_free(lchan->pending_rel_ind_msg);
 			}
 
 			lchan->pending_rel_ind_msg = msg;
@@ -2834,8 +2794,8 @@
 	} else if (rslms_is_gprs_susp_req(msg)) {
 		return handle_gprs_susp_req(msg);
 	} else {
-		LOGP(DRSL, LOGL_INFO, "%s Fwd RLL msg %s from LAPDm to A-bis\n",
-			gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));
+		LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Fwd RLL msg %s from LAPDm to A-bis\n",
+			  rsl_msg_name(rh->msg_type));
 
 		return abis_bts_rsl_sendmsg(msg);
 	}
@@ -2868,8 +2828,7 @@
 		return rsl_reject_unknown_lchan(msg);
 	}
 
-	LOGP(DRSL, LOGL_INFO, "%s Rx RSL %s\n", gsm_lchan_name(msg->lchan),
-		rsl_msg_name(cch->c.msg_type));
+	LOGPLCHAN(msg->lchan, DRSL, LOGL_INFO, "Rx RSL %s\n", rsl_msg_name(cch->c.msg_type));
 
 	switch (cch->c.msg_type) {
 	case RSL_MT_BCCH_INFO:
@@ -2886,13 +2845,13 @@
 		break;
 	case RSL_MT_SMS_BC_REQ:
 	case RSL_MT_NOT_CMD:
-		LOGP(DRSL, LOGL_NOTICE, "unimplemented RSL cchan msg_type %s\n",
-			rsl_msg_name(cch->c.msg_type));
+		LOGPLCHAN(msg->lchan, DRSL, LOGL_NOTICE, "unimplemented RSL cchan msg_type %s\n",
+			  rsl_msg_name(cch->c.msg_type));
 		rsl_tx_error_report(trx, RSL_ERR_MSG_TYPE, &cch->chan_nr, NULL, msg);
 		break;
 	default:
-		LOGP(DRSL, LOGL_NOTICE, "undefined RSL cchan msg_type 0x%02x\n",
-			cch->c.msg_type);
+		LOGPLCHAN(msg->lchan, DRSL, LOGL_NOTICE, "undefined RSL cchan msg_type 0x%02x\n",
+			  cch->c.msg_type);
 		rsl_tx_error_report(trx, RSL_ERR_MSG_TYPE, &cch->chan_nr, NULL, msg);
 		ret = -EINVAL;
 		break;
@@ -2963,13 +2922,13 @@
 	case RSL_MT_PRE_HANDO_NOTIF:
 	case RSL_MT_MR_CODEC_MOD_REQ:
 	case RSL_MT_TFO_MOD_REQ:
-		LOGP(DRSL, LOGL_NOTICE, "unimplemented RSL dchan msg_type %s\n",
-			rsl_msg_name(dch->c.msg_type));
+		LOGPLCHAN(msg->lchan, DRSL, LOGL_NOTICE, "unimplemented RSL dchan msg_type %s\n",
+			  rsl_msg_name(dch->c.msg_type));
 		rsl_tx_error_report(trx, RSL_ERR_MSG_TYPE, &dch->chan_nr, NULL, msg);
 		break;
 	default:
-		LOGP(DRSL, LOGL_NOTICE, "undefined RSL dchan msg_type 0x%02x\n",
-			dch->c.msg_type);
+		LOGPLCHAN(msg->lchan, DRSL, LOGL_NOTICE, "undefined RSL dchan msg_type 0x%02x\n",
+			  dch->c.msg_type);
 		rsl_tx_error_report(trx, RSL_ERR_MSG_TYPE, &dch->chan_nr, NULL, msg);
 		ret = -EINVAL;
 	}
@@ -3033,8 +2992,7 @@
 		return rsl_reject_unknown_lchan(msg);
 	}
 
-	LOGP(DRSL, LOGL_INFO, "%s Rx RSL %s\n", gsm_lchan_name(msg->lchan),
-		rsl_ipac_msg_name(dch->c.msg_type));
+	LOGPLCHAN(msg->lchan, DRSL, LOGL_INFO, "Rx RSL %s\n", rsl_ipac_msg_name(dch->c.msg_type));
 
 	switch (dch->c.msg_type) {
 	case RSL_MT_IPAC_CRCX:
@@ -3045,8 +3003,8 @@
 		ret = rsl_rx_ipac_dlcx(msg);
 		break;
 	default:
-		LOGP(DRSL, LOGL_NOTICE, "unsupported RSL ip.access msg_type 0x%02x\n",
-			dch->c.msg_type);
+		LOGPLCHAN(msg->lchan, DRSL, LOGL_NOTICE, "unsupported RSL ip.access msg_type 0x%02x\n",
+			  dch->c.msg_type);
 		rsl_tx_error_report(trx, RSL_ERR_MSG_TYPE, &dch->chan_nr, NULL, msg);
 		ret = -EINVAL;
 	}
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index 5c66e08..e4a05c8 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -172,6 +172,6 @@
 		lchan->si.last = tmp;
 		return GSM_LCHAN_SI(lchan, tmp);
 	}
-	LOGP(DL1P, LOGL_NOTICE, "%s SACCH no SI available\n", gsm_lchan_name(lchan));
+	LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "SACCH no SI available\n");
 	return NULL;
 }

-- 
To view, visit https://gerrit.osmocom.org/14111
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6913ac8fb543811126b85a54118333155c03bc03
Gerrit-Change-Number: 14111
Gerrit-PatchSet: 6
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190524/b0391f53/attachment.htm>


More information about the gerrit-log mailing list