summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-03-09 14:34:21 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-03-11 17:38:29 +0700
commitddddf9e0c488b51d08f6127e29a2d2e48e440095 (patch)
treed55c5e239b18a3e1cd1064eea0e836fc66f1d115
parentd316b84413a4646b440ff5a5ab198a9f10aa9459 (diff)
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
-rw-r--r--src/host/trxcon/l1ctl.c16
-rw-r--r--src/host/trxcon/l1ctl.h4
-rw-r--r--src/host/trxcon/sched_lchan_common.c8
3 files changed, 12 insertions, 16 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 0bcd5d99..3702e8a7 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -231,19 +231,19 @@ int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn)
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 91a7f0f6..290a0f52 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -20,6 +20,6 @@ int l1ctl_tx_reset_ind(struct l1ctl_link *l1l, uint8_t type);
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 52c9a21f..d946e577 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -129,7 +129,6 @@ int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts,
{
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 @@ int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts,
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;