summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-14 10:28:26 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commit785d9d24247c82cfd06745fb311c93039e2b0f23 (patch)
treede577c0516b0e9f2a67be68afca82e069898e836
parentf2cedcf6972aef4b7231ac78aec2b98111870fb9 (diff)
host/trxcon/l1ctl.c: fix incomplete msg in l1ctl_tx_fbsb_conf()
Previously, all L1CTL_FBSB_CONF messages were sent without required l1ctl_info_dl header, what caused unpredictable behavior on higher layers (L2 & L3). Let's fix it. Change-Id: I8dae597bb4c09df36f80944434ce3624569f2cf8
-rw-r--r--src/host/trxcon/l1ctl.c12
-rw-r--r--src/host/trxcon/l1ctl.h3
-rw-r--r--src/host/trxcon/sched_lchan_handlers.c29
3 files changed, 38 insertions, 6 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index d5c3b57..9b0d35a 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -126,10 +126,13 @@ int l1ctl_tx_reset_conf(struct l1ctl_link *l1l, uint8_t type)
return l1ctl_link_send(l1l, msg);
}
-int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result, uint8_t bsic)
+int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result,
+ struct l1ctl_info_dl *dl_info, uint8_t bsic)
{
struct l1ctl_fbsb_conf *conf;
+ struct l1ctl_info_dl *dl;
struct msgb *msg;
+ size_t len;
msg = l1ctl_alloc_msg(L1CTL_FBSB_CONF);
if (msg == NULL)
@@ -138,6 +141,13 @@ int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result, uint8_t bsic)
LOGP(DL1C, LOGL_DEBUG, "Send FBSB Conf (result=%u, bsic=%u)\n",
result, bsic);
+ /* Copy DL info provided by handler */
+ len = sizeof(struct l1ctl_info_dl);
+ dl = (struct l1ctl_info_dl *) msgb_put(msg, len);
+ memcpy(dl, dl_info, len);
+ talloc_free(dl_info);
+
+ /* Fill in FBSB payload: BSIC and sync result */
conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, sizeof(*conf));
conf->result = result;
conf->bsic = bsic;
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index 165865a..af53b77 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -6,7 +6,8 @@
#include "l1ctl_link.h"
#include "l1ctl_proto.h"
-int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result, uint8_t bsic);
+int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result,
+ struct l1ctl_info_dl *dl_info, uint8_t bsic);
int l1ctl_tx_ccch_mode_conf(struct l1ctl_link *l1l, uint8_t mode);
int l1ctl_tx_pm_conf(struct l1ctl_link *l1l, uint16_t band_arfcn,
int dbm, int last);
diff --git a/src/host/trxcon/sched_lchan_handlers.c b/src/host/trxcon/sched_lchan_handlers.c
index 49a28ef..64893d7 100644
--- a/src/host/trxcon/sched_lchan_handlers.c
+++ b/src/host/trxcon/sched_lchan_handlers.c
@@ -224,11 +224,32 @@ int rx_sch_fn(struct trx_instance *trx, struct trx_ts *ts,
return -EINVAL;
}
+ /* We don't need to send L1CTL_FBSB_CONF */
+ if (trx->l1l->fbsb_conf_sent)
+ return 0;
+
/* Send L1CTL_FBSB_CONF to higher layers */
- if (!trx->l1l->fbsb_conf_sent) {
- l1ctl_tx_fbsb_conf(trx->l1l, 0, bsic);
- trx->bsic = bsic;
- }
+ struct l1ctl_info_dl *data;
+ data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl));
+ if (data == NULL)
+ return -ENOMEM;
+
+ /* Fill in some downlink info */
+ data->chan_nr = trx_lchan_desc[chan].chan_nr | ts->index;
+ data->link_id = trx_lchan_desc[chan].link_id;
+ data->band_arfcn = htons(trx->band_arfcn);
+ data->frame_nr = htonl(fn);
+ data->rx_level = -rssi;
+
+ /* FIXME: set proper values */
+ data->num_biterr = 0;
+ data->fire_crc = 0;
+ data->snr = 0;
+
+ l1ctl_tx_fbsb_conf(trx->l1l, 0, data, bsic);
+
+ /* Update BSIC value of trx_instance */
+ trx->bsic = bsic;
return 0;
}