pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/34045 )


Change subject: rlcmac: ul_tbf: Factor out functin configuring TBF to lower 
layers
......................................................................

rlcmac: ul_tbf: Factor out functin configuring TBF to lower layers

This code part will also be used by tbf_ul_ass_fsm.c to temporarily
configure lower layers with ctx->phase1_alloc in order to receive RTS
indications which the RLC/MAC uses to tick the FSM in state
GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_TBF_STARTING_TIME1.

Change-Id: I174327b25b726662a6b5902008e205ddb3de2fe0
---
M include/osmocom/gprs/rlcmac/tbf_ul.h
M src/rlcmac/tbf_ul.c
M src/rlcmac/tbf_ul_fsm.c
3 files changed, 49 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/45/34045/1

diff --git a/include/osmocom/gprs/rlcmac/tbf_ul.h 
b/include/osmocom/gprs/rlcmac/tbf_ul.h
index fe9db64..1abde9a 100644
--- a/include/osmocom/gprs/rlcmac/tbf_ul.h
+++ b/include/osmocom/gprs/rlcmac/tbf_ul.h
@@ -52,6 +52,10 @@
 struct gprs_rlcmac_ul_tbf *gprs_rlcmac_ul_tbf_alloc(struct gprs_rlcmac_entity 
*gre);
 void gprs_rlcmac_ul_tbf_free(struct gprs_rlcmac_ul_tbf *ul_tbf);

+int gprs_rlcmac_ul_tbf_submit_configure_req(const struct gprs_rlcmac_ul_tbf 
*ul_tbf,
+                                           const struct 
gprs_rlcmac_ul_tbf_allocation *alloc,
+                                           bool starting_time_present, 
uint32_t starting_time_fn);
+
 void gprs_rlcmac_ul_tbf_countdown_proc_update_cv(struct gprs_rlcmac_ul_tbf 
*ul_tbf);

 bool gprs_rlcmac_ul_tbf_in_contention_resolution(const struct 
gprs_rlcmac_ul_tbf *ul_tbf);
diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c
index 369be55..0c95a9c 100644
--- a/src/rlcmac/tbf_ul.c
+++ b/src/rlcmac/tbf_ul.c
@@ -102,6 +102,35 @@
        gprs_rlcmac_entity_ul_tbf_freed(gre, ul_tbf);
 }

+int gprs_rlcmac_ul_tbf_submit_configure_req(const struct gprs_rlcmac_ul_tbf 
*ul_tbf,
+                                           const struct 
gprs_rlcmac_ul_tbf_allocation *alloc,
+                                           bool starting_time_present, 
uint32_t starting_time_fn)
+{
+       struct osmo_gprs_rlcmac_prim *rlcmac_prim;
+
+       rlcmac_prim = 
gprs_rlcmac_prim_alloc_l1ctl_cfg_ul_tbf_req(ul_tbf->tbf.nr, 0x00);
+
+       /* TODO: submit start_fn when L1CTL supports it: */
+
+       for (unsigned int tn = 0; tn < ARRAY_SIZE(alloc->ts); tn++) {
+               const struct gprs_rlcmac_ul_tbf_allocation_ts *ts;
+
+               ts = &alloc->ts[tn];
+               if (!ts->allocated)
+                       continue;
+               rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_slotmask |= (1 << tn);
+               rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_usf[tn] = ts->usf;
+       }
+
+       LOGPTBFUL(ul_tbf, LOGL_INFO,
+                "Send L1CTL-CFG_UL_TBF.req ul_tbf_nr=%u ul_slotmask=0x%02x 
tbf_starting_time(present=%u fn=%u)\n",
+                rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_tbf_nr,
+                rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_slotmask,
+                starting_time_present, starting_time_fn);
+
+       return gprs_rlcmac_prim_call_down_cb(rlcmac_prim);
+}
+
 /* whether the UL TBF is in Contention Resolution state (false = already 
succeeded)*/
 bool gprs_rlcmac_ul_tbf_in_contention_resolution(const struct 
gprs_rlcmac_ul_tbf *ul_tbf)
 {
diff --git a/src/rlcmac/tbf_ul_fsm.c b/src/rlcmac/tbf_ul_fsm.c
index 7639d83..3c041a6 100644
--- a/src/rlcmac/tbf_ul_fsm.c
+++ b/src/rlcmac/tbf_ul_fsm.c
@@ -59,26 +59,8 @@

 static int configure_ul_tbf(const struct gprs_rlcmac_tbf_ul_fsm_ctx *ctx)
 {
-       struct osmo_gprs_rlcmac_prim *rlcmac_prim;
-
-       rlcmac_prim = gprs_rlcmac_prim_alloc_l1ctl_cfg_ul_tbf_req(ctx->tbf->nr, 
0x00);
-
-       for (unsigned int tn = 0; tn < ARRAY_SIZE(ctx->ul_tbf->cur_alloc.ts); 
tn++) {
-               const struct gprs_rlcmac_ul_tbf_allocation_ts *ts;
-
-               ts = &ctx->ul_tbf->cur_alloc.ts[tn];
-               if (!ts->allocated)
-                       continue;
-               rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_slotmask |= (1 << tn);
-               rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_usf[tn] = ts->usf;
-       }
-
-       LOGPFSML(ctx->fi, LOGL_INFO,
-                "Send L1CTL-CFG_UL_TBF.req ul_tbf_nr=%u ul_slotmask=0x%02x\n",
-                rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_tbf_nr,
-                rlcmac_prim->l1ctl.cfg_ul_tbf_req.ul_slotmask);
-
-       return gprs_rlcmac_prim_call_down_cb(rlcmac_prim);
+       return gprs_rlcmac_ul_tbf_submit_configure_req(ctx->ul_tbf, 
&ctx->ul_tbf->cur_alloc,
+                                                      false, 0);
 }

 static int release_ul_tbf(const struct gprs_rlcmac_tbf_ul_fsm_ctx *ctx)

--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/34045
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I174327b25b726662a6b5902008e205ddb3de2fe0
Gerrit-Change-Number: 34045
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to