[MERGED] osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC confirmation API

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sun Mar 11 11:19:10 UTC 2018


Vadim Yanitskiy has submitted this change and it was merged.

Change subject: trxcon: clean up DATA / TRAFFIC confirmation API
......................................................................


trxcon: clean up DATA / TRAFFIC confirmation API

  - change 'l1ctl_tx_data_conf' symbol to 'l1ctl_tx_dt_conf' in
    order to indicate that it's used for both DATA and TRAFFIC;

  - introduce a 'traffic' flag, which is used to define either
    TRAFFIC or DATA confirmation type;

Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl.h
M src/host/trxcon/sched_lchan_common.c
3 files changed, 12 insertions(+), 16 deletions(-)

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



diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 0bcd5d9..3702e8a 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -231,19 +231,19 @@
 	return l1ctl_link_send(l1l, msg);
 }
 
-int l1ctl_tx_data_conf(struct l1ctl_link *l1l,
-	struct l1ctl_info_dl *data, uint8_t msg_type)
+
+/**
+ * Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF.
+ */
+int l1ctl_tx_dt_conf(struct l1ctl_link *l1l,
+	struct l1ctl_info_dl *data, bool traffic)
 {
 	struct l1ctl_info_dl *dl;
 	struct msgb *msg;
 	size_t len;
 
-	if (msg_type != L1CTL_DATA_CONF && msg_type != L1CTL_TRAFFIC_CONF) {
-		LOGP(DL1D, LOGL_ERROR, "Incorrect confirmation type\n");
-		return -EINVAL;
-	}
-
-	msg = l1ctl_alloc_msg(msg_type);
+	msg = l1ctl_alloc_msg(traffic ?
+		L1CTL_TRAFFIC_CONF : L1CTL_DATA_CONF);
 	if (msg == NULL)
 		return -ENOMEM;
 
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index 91a7f0f..290a0f5 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -20,6 +20,6 @@
 
 int l1ctl_tx_data_ind(struct l1ctl_link *l1l,
 	struct l1ctl_info_dl *data, uint8_t msg_type);
-int l1ctl_tx_data_conf(struct l1ctl_link *l1l,
-	struct l1ctl_info_dl *data, uint8_t msg_type);
+int l1ctl_tx_dt_conf(struct l1ctl_link *l1l,
+	struct l1ctl_info_dl *data, bool traffic);
 int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn);
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index 52c9a21..d946e57 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -129,7 +129,6 @@
 {
 	const struct trx_lchan_desc *lchan_desc;
 	struct l1ctl_info_dl *data;
-	uint8_t conf_type;
 
 	/* Allocate memory */
 	data = talloc_zero(ts, struct l1ctl_info_dl);
@@ -145,11 +144,8 @@
 	data->band_arfcn = htons(trx->band_arfcn);
 	data->frame_nr = htonl(fn);
 
-	/* Choose a confirmation type */
-	conf_type = l2_len == GSM_MACBLOCK_LEN ?
-		L1CTL_DATA_CONF : L1CTL_TRAFFIC_CONF;
-
-	l1ctl_tx_data_conf(trx->l1l, data, conf_type);
+	l1ctl_tx_dt_conf(trx->l1l, data,
+		l2_len != GSM_MACBLOCK_LEN);
 	talloc_free(data);
 
 	return 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list