fixeria has uploaded this change for review.

View Change

rlcmac: add OSMO_GPRS_RLCMAC_L1CTL_PDCH_{ESTABLISH,RELEASE}.req

* Send the PDCH_ESTABLISH.req on receipt of RR IMM ASS,
* Sending of PDCH_RELEASE.req is to be implemented.

Change-Id: I2568c58646ce7511367275ac96cd55e7fdd7ec18
Related: OS#5500
---
M include/osmocom/gprs/rlcmac/rlcmac_prim.h
M src/rlcmac/rlcmac.c
M src/rlcmac/rlcmac_prim.c
3 files changed, 74 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/70/33370/1
diff --git a/include/osmocom/gprs/rlcmac/rlcmac_prim.h b/include/osmocom/gprs/rlcmac/rlcmac_prim.h
index fa1ee52..ce02e8f 100644
--- a/include/osmocom/gprs/rlcmac/rlcmac_prim.h
+++ b/include/osmocom/gprs/rlcmac/rlcmac_prim.h
@@ -111,6 +111,8 @@
OSMO_GPRS_RLCMAC_L1CTL_PDCH_RTS,
OSMO_GPRS_RLCMAC_L1CTL_CFG_UL_TBF,
OSMO_GPRS_RLCMAC_L1CTL_CFG_DL_TBF,
+ OSMO_GPRS_RLCMAC_L1CTL_PDCH_ESTABLISH,
+ OSMO_GPRS_RLCMAC_L1CTL_PDCH_RELEASE,
};

extern const struct value_string osmo_gprs_rlcmac_l1ctl_prim_type_names[];
@@ -174,6 +176,21 @@
uint8_t dl_slotmask;
uint8_t dl_tfi; /* DL TFI for all PDCHs indicated in the slotmask */
} cfg_dl_tbf_req;
+ /* OSMO_GPRS_RLCMAC_L1CTL_PDCH_ESTABLISH | Req */
+ struct {
+ uint8_t tsc; /* Training Sequence Code */
+ uint8_t ta; /* Timing Advance */
+ bool fh; /* Frequency Hopping */
+ union {
+ uint16_t arfcn;
+ struct {
+ uint8_t hsn;
+ uint8_t maio;
+ uint8_t ma_len;
+ uint8_t ma[8];
+ } fhp; /* fh == true */
+ };
+ } pdch_est_req;
};
};

@@ -211,3 +228,5 @@
uint8_t rx_lev, uint16_t ber10k, int16_t ci_cb,
uint8_t *data, uint8_t data_len);
struct osmo_gprs_rlcmac_prim *osmo_gprs_rlcmac_prim_alloc_l1ctl_pdch_rts_ind(uint8_t ts_nr, uint32_t fn, uint8_t usf);
+struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_pdch_est_req(uint8_t tsc, uint8_t ta);
+struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_pdch_rel_req(void);
diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c
index 318e3a7..45e5aa5 100644
--- a/src/rlcmac/rlcmac.c
+++ b/src/rlcmac/rlcmac.c
@@ -252,6 +252,7 @@
IA_RestOctets_t iaro;
const uint8_t *iaro_raw = ((uint8_t *)ia) + sizeof(*ia) + ia->mob_alloc_len;
size_t iaro_raw_len = GSM_MACBLOCK_LEN - (sizeof(*ia) + ia->mob_alloc_len);
+ struct osmo_gprs_rlcmac_prim *prim;

rc = rsl_dec_chan_nr(ia->chan_desc.chan_nr, &ch_type, &ch_subch, &ch_ts);
if (rc != 0) {
@@ -267,6 +268,29 @@
return rc;
}

+ prim = gprs_rlcmac_prim_alloc_l1ctl_pdch_est_req(ia->chan_desc.h0.tsc,
+ ia->timing_advance);
+ if (!ia->chan_desc.h0.h) {
+ prim->l1ctl.pdch_est_req.fh = false;
+ prim->l1ctl.pdch_est_req.arfcn = (ia->chan_desc.h0.arfcn_low)
+ | (ia->chan_desc.h0.arfcn_high << 8);
+ } else {
+ prim->l1ctl.pdch_est_req.fh = true;
+ prim->l1ctl.pdch_est_req.fhp.hsn = ia->chan_desc.h1.hsn;
+ prim->l1ctl.pdch_est_req.fhp.maio = (ia->chan_desc.h1.maio_low)
+ | (ia->chan_desc.h1.maio_high << 2);
+ /* TODO: ensure ia->mob_alloc_len <= sizeof(pdch_est_req.fhp.ma) */
+ prim->l1ctl.pdch_est_req.fhp.ma_len = ia->mob_alloc_len;
+ memcpy(&prim->l1ctl.pdch_est_req.fhp.ma[0], &ia->mob_alloc[0], ia->mob_alloc_len);
+ }
+
+ /* Request the lower layers to establish a PDCH channel */
+ rc = gprs_rlcmac_prim_call_down_cb(prim);
+ if (rc != 0) {
+ LOGRLCMAC(LOGL_ERROR, "PDCH channel establishment failed\n");
+ return rc;
+ }
+
switch (iaro.UnionType) {
case 0: /* iaro.u.ll.* (IA_RestOctetsLL_t) */
/* TODO: iaro.u.ll.Compressed_Inter_RAT_HO_INFO_IND */
diff --git a/src/rlcmac/rlcmac_prim.c b/src/rlcmac/rlcmac_prim.c
index a5f796a..b073240 100644
--- a/src/rlcmac/rlcmac_prim.c
+++ b/src/rlcmac/rlcmac_prim.c
@@ -325,6 +325,24 @@
return rlcmac_prim;
}

+/* L1CTL-PDCH_ESTABLISH.req */
+struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_pdch_est_req(uint8_t tsc, uint8_t ta)
+{
+ struct osmo_gprs_rlcmac_prim *rlcmac_prim;
+ rlcmac_prim = rlcmac_prim_l1ctl_alloc(OSMO_GPRS_RLCMAC_L1CTL_PDCH_ESTABLISH, PRIM_OP_REQUEST, 0);
+ rlcmac_prim->l1ctl.pdch_est_req.tsc = tsc;
+ rlcmac_prim->l1ctl.pdch_est_req.ta = ta;
+ return rlcmac_prim;
+}
+
+/* L1CTL-PDCH_RELEASE.req */
+struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_pdch_rel_req(void)
+{
+ struct osmo_gprs_rlcmac_prim *rlcmac_prim;
+ rlcmac_prim = rlcmac_prim_l1ctl_alloc(OSMO_GPRS_RLCMAC_L1CTL_PDCH_RELEASE, PRIM_OP_REQUEST, 0);
+ return rlcmac_prim;
+}
+
int gprs_rlcmac_prim_handle_unsupported(struct osmo_gprs_rlcmac_prim *rlcmac_prim)
{
LOGRLCMAC(LOGL_ERROR, "Unsupported rlcmac_prim! %s\n", osmo_gprs_rlcmac_prim_name(rlcmac_prim));

To view, visit change 33370. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I2568c58646ce7511367275ac96cd55e7fdd7ec18
Gerrit-Change-Number: 33370
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: newchange