Change in ...osmo-pcu[master]: pdch.cpp: Refactor bitvec param passing in rcv_control_block

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/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Sep 26 12:14:00 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-pcu/+/15600 )

Change subject: pdch.cpp: Refactor bitvec param passing in rcv_control_block
......................................................................

pdch.cpp: Refactor bitvec param passing in rcv_control_block

Move code in rcv_block_gprs() only needed for rcv_control_block() into
the later. This way rcv_block_gprs() is simplified and shows similar
code paths with regards to rcv_data_block().
It can now be seen that the main difference between both is the meas
param no being passed in the control case.

Change-Id: I2a0133463edced93c72ccc743a0cf00d1d6922cf
---
M src/pdch.cpp
M src/pdch.h
2 files changed, 14 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/pdch.cpp b/src/pdch.cpp
index 7488b96..5ae7e63 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -680,10 +680,18 @@
 }
 
 /* Received Uplink RLC control block. */
-int gprs_rlcmac_pdch::rcv_control_block(
-	const uint8_t *data, uint8_t data_len, bitvec *rlc_block, uint32_t fn)
+int gprs_rlcmac_pdch::rcv_control_block(const uint8_t *data, uint8_t data_len,
+					uint32_t fn, GprsCodingScheme cs)
 {
-	RlcMacUplink_t * ul_control_block = (RlcMacUplink_t *)talloc_zero(tall_pcu_ctx, RlcMacUplink_t);
+	bitvec *rlc_block;
+	RlcMacUplink_t *ul_control_block;
+	unsigned len = cs.maxBytesUL();
+
+	if (!(rlc_block = bitvec_alloc(len, tall_pcu_ctx)))
+		return -ENOMEM;
+	bitvec_unpack(rlc_block, data);
+	ul_control_block = (RlcMacUplink_t *)talloc_zero(tall_pcu_ctx, RlcMacUplink_t);
+
 	LOGP(DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++\n");
 	decode_gsm_rlcmac_uplink(rlc_block, ul_control_block);
 	LOGPC(DCSN1, LOGL_NOTICE, "\n");
@@ -721,6 +729,7 @@
 			ul_control_block->u.MESSAGE_TYPE);
 	}
 	talloc_free(ul_control_block);
+	bitvec_free(rlc_block);
 	return 1;
 }
 
@@ -816,21 +825,14 @@
 	struct pcu_l1_meas *meas, GprsCodingScheme cs)
 {
 	unsigned payload = data[0] >> 6;
-	bitvec *block;
 	int rc = 0;
-	unsigned len = cs.maxBytesUL();
 
 	switch (payload) {
 	case GPRS_RLCMAC_DATA_BLOCK:
 		rc = rcv_data_block(data, data_len, fn, meas, cs);
 		break;
 	case GPRS_RLCMAC_CONTROL_BLOCK:
-		block = bitvec_alloc(len, tall_pcu_ctx);
-		if (!block)
-			return -ENOMEM;
-		bitvec_unpack(block, data);
-		rc = rcv_control_block(data, data_len, block, fn);
-		bitvec_free(block);
+		rc = rcv_control_block(data, data_len, fn, cs);
 		break;
 	case GPRS_RLCMAC_CONTROL_BLOCK_OPT:
 		LOGP(DRLCMAC, LOGL_NOTICE, "GPRS_RLCMAC_CONTROL_BLOCK_OPT block payload is not supported.\n");
@@ -961,4 +963,3 @@
 {
 	return trx->bts->bts_data();
 }
-
diff --git a/src/pdch.h b/src/pdch.h
index cf9804d..e23d56f 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -94,7 +94,7 @@
 
 #ifdef __cplusplus
 private:
-	int rcv_control_block(const uint8_t *data, uint8_t data_len, bitvec *rlc_block, uint32_t fn);
+	int rcv_control_block(const uint8_t *data, uint8_t data_len, uint32_t fn, GprsCodingScheme cs);
 
 	void rcv_control_ack(Packet_Control_Acknowledgement_t *, uint32_t fn);
 	void rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *, uint32_t fn);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15600
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I2a0133463edced93c72ccc743a0cf00d1d6922cf
Gerrit-Change-Number: 15600
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190926/7d356d61/attachment.htm>


More information about the gerrit-log mailing list