fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/31572 )
Change subject: modem: route L1CTL prims to/from libosmo-gprs-rlcmac
......................................................................
modem: route L1CTL prims to/from libosmo-gprs-rlcmac
Change-Id: I38e9a686f8edc3fe55f961d75e68602c33bbbaaf
Related: OS#5500
---
M src/host/layer23/src/modem/rlcmac.c
1 file changed, 78 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/72/31572/1
diff --git a/src/host/layer23/src/modem/rlcmac.c b/src/host/layer23/src/modem/rlcmac.c
index 83dcd6c..3a391ed 100644
--- a/src/host/layer23/src/modem/rlcmac.c
+++ b/src/host/layer23/src/modem/rlcmac.c
@@ -36,10 +36,13 @@
#include <osmocom/gprs/llc/llc_prim.h>
#include <osmocom/bb/common/logging.h>
+#include <osmocom/bb/common/l1ctl.h>
#include <osmocom/bb/common/apn.h>
#include <osmocom/bb/common/ms.h>
#include <osmocom/bb/modem/rlcmac.h>
+#include <l1ctl_proto.h>
+
static int modem_rlcmac_handle_grr(struct osmo_gprs_rlcmac_prim *rlcmac_prim)
{
int rc;
@@ -110,12 +113,50 @@
return rc;
}
+static int modem_rlcmac_handle_l1ctl(struct osmocom_ms *ms,
+ const struct osmo_gprs_rlcmac_prim *rlcmac_prim)
+{
+ const struct osmo_gprs_rlcmac_l1ctl_prim *prim = &rlcmac_prim->l1ctl;
+
+ switch (rlcmac_prim->oph.primitive) {
+ case OSMO_GPRS_RLCMAC_L1CTL_RACH:
+ if (prim->rach_req.is_11bit) {
+ LOGP(DRLCMAC, LOGL_NOTICE,
+ "%s(): 11-bit RACH is not supported\n", __func__);
+ return -ENOTSUP;
+ }
+ return l1ctl_tx_rach_req(ms, 0, 0, prim->rach_req.ra, 0, 0);
+ case OSMO_GPRS_RLCMAC_L1CTL_PDCH_DATA:
+ return l1ctl_tx_gprs_ul_block_req(ms, prim->pdch_data_req.fn,
+ prim->pdch_data_req.ts_nr,
+ prim->pdch_data_req.data,
+ prim->pdch_data_req.data_len);
+ case OSMO_GPRS_RLCMAC_L1CTL_CFG_UL_TBF:
+ return l1ctl_tx_gprs_ul_tbf_cfg_req(ms, prim->cfg_ul_tbf_req.ul_tbf_nr,
+ prim->cfg_ul_tbf_req.ul_slotmask);
+ case OSMO_GPRS_RLCMAC_L1CTL_CFG_DL_TBF:
+ return l1ctl_tx_gprs_dl_tbf_cfg_req(ms, prim->cfg_dl_tbf_req.dl_tbf_nr,
+ prim->cfg_dl_tbf_req.dl_slotmask,
+ prim->cfg_dl_tbf_req.dl_tfi);
+ default:
+ LOGP(DRLCMAC, LOGL_DEBUG,
+ "%s(): Unexpected L1CTL prim 0x%02x\n",
+ __func__, rlcmac_prim->oph.primitive);
+ return -ENOTSUP;
+ }
+}
+
static int modem_rlcmac_prim_down_cb(struct osmo_gprs_rlcmac_prim *rlcmac_prim, void
*user_data)
{
const char *pdu_name = osmo_gprs_rlcmac_prim_name(rlcmac_prim);
+ struct osmocom_ms *ms = user_data;
int rc = 0;
switch (rlcmac_prim->oph.sap) {
+ case OSMO_GPRS_RLCMAC_SAP_L1CTL:
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s(): Rx %s\n", __func__, pdu_name);
+ rc = modem_rlcmac_handle_l1ctl(ms, rlcmac_prim);
+ break;
default:
LOGP(DRLCMAC, LOGL_DEBUG, "%s(): Unexpected Rx %s\n", __func__, pdu_name);
OSMO_ASSERT(0);
@@ -123,6 +164,30 @@
return rc;
}
+static int l1ctl_dl_block_cb(struct osmocom_ms *ms, struct msgb *msg)
+{
+ const struct l1ctl_gprs_dl_block_ind *ind = (void *)msg->l1h;
+ struct osmo_gprs_rlcmac_prim *prim;
+
+ /* FIXME: rlcmac_prim_l1ctl_alloc() is not exposed */
+ prim = rlcmac_prim_l1ctl_alloc(OSMO_GPRS_RLCMAC_L1CTL_PDCH_DATA,
+ PRIM_OP_INDICATION, msgb_l2len(msg));
+ prim->l1ctl = (struct osmo_gprs_rlcmac_l1ctl_prim) {
+ .pdch_data_ind = {
+ /* TODO: ind->usf */
+ .fn = osmo_load32be(&ind->hdr.fn),
+ .ts_nr = ind->hdr.tn,
+ .rx_lev = ind->meas.rx_lev,
+ .ber10k = osmo_load16be(&ind->meas.ber10k),
+ .ci_cb = osmo_load16be(&ind->meas.ci_cb),
+ .data_len = msgb_l2len(msg),
+ .data = msgb_l2(msg),
+ }
+ };
+
+ return osmo_gprs_rlcmac_prim_lower_up(prim);
+}
+
int modem_rlcmac_init(struct osmocom_ms *ms)
{
int rc;
@@ -134,5 +199,8 @@
osmo_gprs_rlcmac_prim_set_up_cb(modem_rlcmac_prim_up_cb, ms);
osmo_gprs_rlcmac_prim_set_down_cb(modem_rlcmac_prim_down_cb, ms);
+
+ ms->l1_entity.l1_gprs_dl_block_ind = &l1ctl_dl_block_cb;
+
return rc;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/31572
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I38e9a686f8edc3fe55f961d75e68602c33bbbaaf
Gerrit-Change-Number: 31572
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange