summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-14 19:15:41 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commit9d2055ca9aadf3b92189a5095c38fc176dd6dacb (patch)
treef2fcd540566a419be73d9ba3922907ec7a615938
parent785d9d24247c82cfd06745fb311c93039e2b0f23 (diff)
host/trxcon/l1ctl.c: fix L1CTL_RACH_{REQ,CONF} handling
Previously, L1CTL_RACH_REQ / L1CTL_RACH_CONF messages were handled without l1ctl_info_ul / l1ctl_info_dl header, what caused incorrect data parsing. Change-Id: I145d137f2cc7de234965e4fe64d9367ed6ccb999
-rw-r--r--src/host/trxcon/l1ctl.c25
-rw-r--r--src/host/trxcon/l1ctl.h2
-rw-r--r--src/host/trxcon/sched_lchan_handlers.c2
3 files changed, 18 insertions, 11 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 9b0d35a..3e9732f 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -197,14 +197,23 @@ int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data)
return l1ctl_link_send(l1l, msg);
}
-int l1ctl_tx_rach_conf(struct l1ctl_link *l1l)
+int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn)
{
+ struct l1ctl_info_dl *dl;
struct msgb *msg;
+ size_t len;
msg = l1ctl_alloc_msg(L1CTL_RACH_CONF);
if (msg == NULL)
return -ENOMEM;
+ len = sizeof(struct l1ctl_info_dl);
+ dl = (struct l1ctl_info_dl *) msgb_put(msg, len);
+
+ memset(dl, 0x00, len);
+ dl->band_arfcn = htons(l1l->trx->band_arfcn);
+ dl->frame_nr = htonl(fn);
+
return l1ctl_link_send(l1l, msg);
}
@@ -369,22 +378,20 @@ exit:
static int l1ctl_rx_rach_req(struct l1ctl_link *l1l, struct msgb *msg)
{
struct l1ctl_rach_req *req;
+ struct l1ctl_info_ul *ul;
struct trx_ts_prim *prim;
struct trx_ts *ts;
int len, rc = 0;
- req = (struct l1ctl_rach_req *) msg->l1h;
- len = sizeof(*req);
- if (msgb_l1len(msg) < len) {
- LOGP(DL1C, LOGL_ERROR, "MSG too short RACH Req: %d\n", len);
- rc = -EINVAL;
- goto exit;
- }
+ ul = (struct l1ctl_info_ul *) msg->l1h;
+ req = (struct l1ctl_rach_req *) ul->payload;
+ len = sizeof(struct l1ctl_rach_req);
/* Convert offset value to host format */
req->offset = ntohs(req->offset);
- LOGP(DL1C, LOGL_DEBUG, "Recv RACH Req (offset=%u)\n", req->offset);
+ LOGP(DL1C, LOGL_DEBUG, "Recv RACH Req (offset=%u ra=0x%02x)\n",
+ req->offset, req->ra);
/* FIXME: can we use other than TS0? */
ts = sched_trx_find_ts(l1l->trx, 0);
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index af53b77..596a5b0 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -16,4 +16,4 @@ int l1ctl_tx_reset_ind(struct l1ctl_link *l1l, uint8_t type);
int l1ctl_rx_cb(struct l1ctl_link *l1l, struct msgb *msg);
int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *ind);
-int l1ctl_tx_rach_conf(struct l1ctl_link *l1l);
+int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn);
diff --git a/src/host/trxcon/sched_lchan_handlers.c b/src/host/trxcon/sched_lchan_handlers.c
index 64893d7..b27f811 100644
--- a/src/host/trxcon/sched_lchan_handlers.c
+++ b/src/host/trxcon/sched_lchan_handlers.c
@@ -303,7 +303,7 @@ int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
}
/* Confirm RACH request */
- l1ctl_tx_rach_conf(trx->l1l);
+ l1ctl_tx_rach_conf(trx->l1l, fn);
/* Remove primitive from queue and free memory */
llist_del(&prim->list);