summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-08-15 16:03:02 +0600
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commit41b0b3f33363327a090f66bd06a84f83a9af1baa (patch)
tree3f92df160020197060e43705bc310947e03c198b
parent842a5b2edc1c3588e9439b7adca812c7dd5facf1 (diff)
host/trxcon/l1ctl.c: include DL frame info in L1CTL_DATA_CONF
The l1ctl_info_dl header is expected to be a part of a L1CTL_DATA_CONF message, but was missing previously. Change-Id: Ia8dfaed924fd84395ba9ae539164eaa94f52d30b
-rw-r--r--src/host/trxcon/l1ctl.c17
-rw-r--r--src/host/trxcon/l1ctl.h3
-rw-r--r--src/host/trxcon/sched_lchan_common.c31
-rw-r--r--src/host/trxcon/sched_lchan_xcch.c5
4 files changed, 51 insertions, 5 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 65850843..5303130c 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -225,15 +225,26 @@ 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)
+int l1ctl_tx_data_conf(struct l1ctl_link *l1l,
+ struct l1ctl_info_dl *data, uint8_t msg_type)
{
+ 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(L1CTL_DATA_CONF);
+ msg = l1ctl_alloc_msg(msg_type);
if (msg == NULL)
return -ENOMEM;
- LOGP(DL1D, LOGL_DEBUG, "Send Data Conf\n");
+ /* Copy DL frame header from source message */
+ len = sizeof(struct l1ctl_info_dl);
+ dl = (struct l1ctl_info_dl *) msgb_put(msg, len);
+ memcpy(dl, data, len);
return l1ctl_link_send(l1l, msg);
}
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index 4f48aaa0..91a7f0f6 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -20,5 +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_rach_conf(struct l1ctl_link *l1l, uint32_t fn);
-int l1ctl_tx_data_conf(struct l1ctl_link *l1l);
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index 7dad7502..5383ef42 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -112,3 +112,34 @@ int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts,
return 0;
}
+
+int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts,
+ struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len)
+{
+ 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);
+ if (data == NULL)
+ return -ENOMEM;
+
+ /* Set up pointers */
+ lchan_desc = &trx_lchan_desc[lchan->type];
+
+ /* Fill in known downlink info */
+ data->chan_nr = lchan_desc->chan_nr | ts->index;
+ data->link_id = lchan_desc->link_id;
+ data->band_arfcn = htons(trx->band_arfcn);
+ data->frame_nr = htonl(fn);
+
+ /* Choose a confirmation type */
+ conf_type = l2_len == 23 ?
+ L1CTL_DATA_CONF : L1CTL_TRAFFIC_CONF;
+
+ l1ctl_tx_data_conf(trx->l1l, data, conf_type);
+ talloc_free(data);
+
+ return 0;
+}
diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c
index 62c44f9a..dd76d0a6 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -48,6 +48,9 @@ extern const uint8_t nb_training_bits[8][26];
int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len);
+int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts,
+ struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len);
+
int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
sbit_t *bits, int8_t rssi, float toa)
@@ -221,7 +224,7 @@ send_burst:
*mask = 0x00;
/* Confirm data sending */
- l1ctl_tx_data_conf(trx->l1l);
+ sched_send_data_conf(trx, ts, lchan, fn, 23);
}
return 0;