pespin has uploaded this change for review.

View Change

rlcmac: tbf_ul: Handle SBA from CCCH Imm Ass

Change-Id: I8563b6d61b93d86c15282995352ca9312e167160
---
M src/rlcmac/csn1_ts_44_018.c
M src/rlcmac/rlcmac.c
M src/rlcmac/tbf_ul_ass_fsm.c
3 files changed, 26 insertions(+), 5 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/59/33159/1
diff --git a/src/rlcmac/csn1_ts_44_018.c b/src/rlcmac/csn1_ts_44_018.c
index 3606346..2a1de42 100644
--- a/src/rlcmac/csn1_ts_44_018.c
+++ b/src/rlcmac/csn1_ts_44_018.c
@@ -648,6 +648,7 @@
data, data_len);
}

+/* TS 44.018 10.5.2.16 IA Rest Octets */
int osmo_gprs_rlcmac_decode_imm_ass_ro(IA_RestOctets_t *storage,
const uint8_t *data, size_t data_len)
{
diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c
index 22464b1..318e3a7 100644
--- a/src/rlcmac/rlcmac.c
+++ b/src/rlcmac/rlcmac.c
@@ -260,6 +260,7 @@
return rc;
}

+ /* TS 44.018 10.5.2.16 IA Rest Octets */
rc = osmo_gprs_rlcmac_decode_imm_ass_ro(&iaro, iaro_raw, iaro_raw_len);
if (rc != 0) {
LOGRLCMAC(LOGL_ERROR, "Failed to decode IA Rest Octets IE\n");
@@ -294,8 +295,7 @@
case 0: /* iaro.u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.* (Packet_Uplink_ImmAssignment_t) */
switch (iaro.u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.UnionType) {
case 0: /* iaro.u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.SingleBlockAllocation.* (GPRS_SingleBlockAllocation_t) */
- /* TODO: 2phase access support: Schedule transmit of PKT_RES_REQ on FN=(GPRS_SingleBlockAllocation_t).TBF_STARTING_TIME */
- LOGRLCMAC(LOGL_ERROR, "ImmAss SingleBlock (2phase access) not yet supported!\n");
+ rc = gprs_rlcmac_handle_ccch_imm_ass_ul_tbf(ch_ts, fn, ia, &iaro);
break;
case 1: /* iaro.u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.* (GPRS_DynamicOrFixedAllocation_t) */
switch (iaro.u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.UnionType) {
diff --git a/src/rlcmac/tbf_ul_ass_fsm.c b/src/rlcmac/tbf_ul_ass_fsm.c
index 103af97..da6e7a7 100644
--- a/src/rlcmac/tbf_ul_ass_fsm.c
+++ b/src/rlcmac/tbf_ul_ass_fsm.c
@@ -128,6 +128,7 @@

static int handle_imm_ass(struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *ctx, const struct tbf_ul_ass_ev_rx_ccch_imm_ass_ctx *d)
{
+ /* TS 44.018 10.5.2.16 IA Rest Octets */
switch (d->iaro->UnionType) {
case 1: /* d->iaro->u.lh.* (IA_RestOctetsLH_t) */
switch (d->iaro->u.lh.lh0x.UnionType) {
@@ -142,7 +143,16 @@
switch (d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.UnionType) {
case 0: /* d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.SingleBlockAllocation.* (GPRS_SingleBlockAllocation_t) */
/* TODO: 2phase access support: Schedule transmit of PKT_RES_REQ on FN=(GPRS_SingleBlockAllocation_t).TBF_STARTING_TIME */
- LOGPFSML(ctx->fi, LOGL_ERROR, "ImmAss SingleBlock (2phase access) not yet supported!\n");
+ if (ctx->ass_type == GPRS_RLCMAC_TBF_UL_ASS_TYPE_1PHASE) {
+ LOGPFSML(ctx->fi, LOGL_INFO, "MS requested 1-Phase-Access, but Network forces 2-Phase-Access\n");
+ ctx->ass_type = GPRS_RLCMAC_TBF_UL_ASS_TYPE_2PHASE;
+ }
+ ctx->tbf_starting_time_exists = true;
+ ctx->tbf_starting_time = TBF_StartingTime_to_fn(&d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.SingleBlockAllocation.TBF_STARTING_TIME,
+ d->fn);
+ ctx->phase1_alloc.ts[d->ts_nr].allocated = true;
+ ctx->phase1_alloc.num_ts = 1;
+ LOGPFSML(ctx->fi, LOGL_INFO, "ImmAss SingleBlock (2phase access) ts_nr=%u start_fn=%u\n", d->ts_nr, ctx->tbf_starting_time);
return -ENOTSUP;
case 1: /* d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.* (GPRS_DynamicOrFixedAllocation_t) */
ctx->phase1_alloc.ul_tfi = d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.TFI_ASSIGNMENT;
@@ -155,7 +165,6 @@
ctx->phase1_alloc.ul_tfi, gprs_rlcmac_mcs_name(ctx->ul_tbf->tx_cs), ctx->tbf_starting_time);
switch (d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.UnionType) {
case 0: /* d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.Allocation.DynamicAllocation (DynamicAllocation_t) */
- /* TODO: 2phase access support: Schedule transmit of PKT_RES_REQ on FN=(GPRS_SingleBlockAllocation_t).TBF_STARTING_TIME */
ctx->phase1_alloc.ts[d->ts_nr].allocated = true;
ctx->phase1_alloc.ts[d->ts_nr].usf = d->iaro->u.hh.u.UplinkDownlinkAssignment.ul_dl.Packet_Uplink_ImmAssignment.Access.DynamicOrFixedAllocation.Allocation.DynamicAllocation.USF;
ctx->phase1_alloc.num_ts = 1;
@@ -638,7 +647,9 @@
{
OSMO_ASSERT(gprs_rlcmac_tbf_ul_ass_waiting_tbf_starting_time(ul_tbf));
OSMO_ASSERT(ul_tbf->ul_ass_fsm.tbf_starting_time_exists);
- if (fn != ul_tbf->ul_ass_fsm.tbf_starting_time)
+ OSMO_ASSERT(ul_tbf->ul_ass_fsm.phase1_alloc.num_ts > 0);
+ if (fn != ul_tbf->ul_ass_fsm.tbf_starting_time ||
+ !ul_tbf->ul_ass_fsm.phase1_alloc.ts[ts_nr].allocated)
return;

osmo_fsm_inst_dispatch(ul_tbf->ul_ass_fsm.fi, GPRS_RLCMAC_TBF_UL_ASS_EV_TBF_STARTING_TIME, NULL);

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

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I8563b6d61b93d86c15282995352ca9312e167160
Gerrit-Change-Number: 33159
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange