pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33554 )
Change subject: rlcmac: tbf_dl: Implement T3190 ......................................................................
rlcmac: tbf_dl: Implement T3190
Change-Id: I3f69fde298dcd64d30b9d648a96717a8378864c4 --- M include/osmocom/gprs/rlcmac/tbf_dl.h M src/rlcmac/rlcmac.c M src/rlcmac/tbf_dl.c M src/rlcmac/tbf_dl_fsm.c 4 files changed, 46 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/54/33554/1
diff --git a/include/osmocom/gprs/rlcmac/tbf_dl.h b/include/osmocom/gprs/rlcmac/tbf_dl.h index f398c0a..7fb3c9e 100644 --- a/include/osmocom/gprs/rlcmac/tbf_dl.h +++ b/include/osmocom/gprs/rlcmac/tbf_dl.h @@ -33,14 +33,18 @@ struct gprs_rlcmac_rlc_window *w; struct gprs_rlcmac_rlc_dl_window *dlw; }; + + struct osmo_timer_list t3190; };
struct gprs_rlcmac_dl_tbf *gprs_rlcmac_dl_tbf_alloc(struct gprs_rlcmac_entity *gre); void gprs_rlcmac_dl_tbf_free(struct gprs_rlcmac_dl_tbf *dl_tbf);
+void gprs_rlcmac_dl_tbf_t3190_start(struct gprs_rlcmac_dl_tbf *dl_tbf); + int gprs_rlcmac_dl_tbf_configure_l1ctl(struct gprs_rlcmac_dl_tbf *dl_tbf);
-struct msgb *gprs_rlcmac_dl_tbf_create_pkt_dl_ack_nack(const struct gprs_rlcmac_dl_tbf *dl_tbf); +struct msgb *gprs_rlcmac_dl_tbf_create_pkt_dl_ack_nack(struct gprs_rlcmac_dl_tbf *dl_tbf);
int gprs_rlcmac_dl_tbf_rcv_data_block(struct gprs_rlcmac_dl_tbf *dl_tbf, const struct gprs_rlcmac_rlc_data_info *rlc, diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c index 5cf4bb9..8a4153f 100644 --- a/src/rlcmac/rlcmac.c +++ b/src/rlcmac/rlcmac.c @@ -49,6 +49,7 @@ /* T3168: dynamically updated with what's received in BCCH SI13 */ { .T=3168, .default_val=5000, .unit = OSMO_TDEF_MS, .desc="Wait for PACKET UPLINK ASSIGNMENT (updated by BCCH SI13) (ms)" }, { .T=3182, .default_val=5, .unit = OSMO_TDEF_S, .desc="Wait for Acknowledgement (s)" }, + { .T=3190, .default_val=5, .unit = OSMO_TDEF_S, .desc="Wait for DL data blocks (s)" }, { 0 } /* empty item at the end */ };
diff --git a/src/rlcmac/tbf_dl.c b/src/rlcmac/tbf_dl.c index 570b0d7..c6205c3 100644 --- a/src/rlcmac/tbf_dl.c +++ b/src/rlcmac/tbf_dl.c @@ -27,6 +27,8 @@ #include <osmocom/gprs/rlcmac/rlcmac_enc.h> #include <osmocom/gprs/rlcmac/pdch_ul_controller.h>
+static void gprs_rlcmac_dl_tbf_t3190_timer_cb(void *data); + struct gprs_rlcmac_dl_tbf *gprs_rlcmac_dl_tbf_alloc(struct gprs_rlcmac_entity *gre) { struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -51,6 +53,8 @@ dl_tbf->blkst = gprs_rlcmac_rlc_block_store_alloc(dl_tbf); OSMO_ASSERT(dl_tbf->blkst);
+ osmo_timer_setup(&dl_tbf->t3190, gprs_rlcmac_dl_tbf_t3190_timer_cb, dl_tbf); + return dl_tbf;
err_tbf_destruct: @@ -70,6 +74,8 @@ tbf = dl_tbf_as_tbf(dl_tbf); gre = tbf->gre;
+ osmo_timer_del(&dl_tbf->t3190); + msgb_free(dl_tbf->llc_rx_msg); dl_tbf->llc_rx_msg = NULL;
@@ -87,6 +93,21 @@ gprs_rlcmac_entity_dl_tbf_freed(gre, dl_tbf); }
+static void gprs_rlcmac_dl_tbf_t3190_timer_cb(void *data) +{ + struct gprs_rlcmac_dl_tbf *dl_tbf = data; + + LOGPTBFDL(dl_tbf, LOGL_NOTICE, "Timeout of T3190\n"); + + gprs_rlcmac_dl_tbf_free(dl_tbf); +} + +void gprs_rlcmac_dl_tbf_t3190_start(struct gprs_rlcmac_dl_tbf *dl_tbf) +{ + unsigned long val_sec; + val_sec = osmo_tdef_get(g_rlcmac_ctx->T_defs, 3190, OSMO_TDEF_S, -1); + osmo_timer_schedule(&dl_tbf->t3190, val_sec, 0); +}
static uint8_t dl_tbf_dl_slotmask(struct gprs_rlcmac_dl_tbf *dl_tbf) { @@ -113,7 +134,7 @@ return gprs_rlcmac_prim_call_down_cb(rlcmac_prim); }
-struct msgb *gprs_rlcmac_dl_tbf_create_pkt_dl_ack_nack(const struct gprs_rlcmac_dl_tbf *dl_tbf) +struct msgb *gprs_rlcmac_dl_tbf_create_pkt_dl_ack_nack(struct gprs_rlcmac_dl_tbf *dl_tbf) { struct msgb *msg; struct bitvec bv; @@ -140,6 +161,10 @@ goto free_ret; }
+ /* Stop T3190 if transmitting final Downlink Ack/Nack */ + if (gprs_rlcmac_tbf_dl_state(dl_tbf) == GPRS_RLCMAC_TBF_DL_ST_FINISHED) + osmo_timer_del(&dl_tbf->t3190); + return msg;
free_ret: @@ -214,7 +239,7 @@ { const struct gprs_rlcmac_rlc_block_info *rdbi; struct gprs_rlcmac_rlc_block *block; - + unsigned int block_idx; const uint16_t ws = gprs_rlcmac_rlc_window_ws(dl_tbf->w);
LOGPTBFDL(dl_tbf, LOGL_DEBUG, "DL DATA TFI=%d received (V(Q)=%d .. V(R)=%d)\n", @@ -222,7 +247,8 @@ gprs_rlcmac_rlc_dl_window_v_q(dl_tbf->dlw), gprs_rlcmac_rlc_dl_window_v_r(dl_tbf->dlw));
- unsigned int block_idx; + /* Re-arm T3190: */ + gprs_rlcmac_dl_tbf_t3190_start(dl_tbf);
/* Loop over num_blocks */ for (block_idx = 0; block_idx < rlc->num_data_blocks; block_idx++) { diff --git a/src/rlcmac/tbf_dl_fsm.c b/src/rlcmac/tbf_dl_fsm.c index 606b985..342256f 100644 --- a/src/rlcmac/tbf_dl_fsm.c +++ b/src/rlcmac/tbf_dl_fsm.c @@ -58,6 +58,8 @@ /* Configure DL TBF on the lower MAC side: */ gprs_rlcmac_dl_tbf_configure_l1ctl(ctx->dl_tbf); tbf_dl_fsm_state_chg(fi, GPRS_RLCMAC_TBF_DL_ST_FLOW); + /* FIXME: This should ideally be done after TbfStartTime has elapsed: */ + gprs_rlcmac_dl_tbf_t3190_start(ctx->dl_tbf); break; default: OSMO_ASSERT(0);