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/.
Harald Welte gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/6729
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
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl.h
M src/host/trxcon/sched_lchan_handlers.c
3 files changed, 18 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/29/6729/1
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,13 +197,22 @@
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 @@
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_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 @@
}
/* 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);
--
To view, visit https://gerrit.osmocom.org/6729
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I145d137f2cc7de234965e4fe64d9367ed6ccb999
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>