aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-07-04 14:21:19 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-07-05 13:49:20 +0200
commit5dc23ea408c7066fe235240d2e3e69444e9082e9 (patch)
tree7782d2f721dcaf8e1b13f9e0cfad2141f8b98fa6
parent1026e0a417115ef66fa891b150077c427a54c8fc (diff)
rlcmac: tbf_dl: Implement T3190
-rw-r--r--include/osmocom/gprs/rlcmac/tbf_dl.h6
-rw-r--r--src/rlcmac/rlcmac.c1
-rw-r--r--src/rlcmac/tbf_dl.c32
-rw-r--r--src/rlcmac/tbf_dl_fsm.c2
4 files changed, 37 insertions, 4 deletions
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_dl_tbf {
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..f9281fb 100644
--- a/src/rlcmac/rlcmac.c
+++ b/src/rlcmac/rlcmac.c
@@ -49,6 +49,7 @@ static struct osmo_tdef T_defs_rlcmac[] = {
/* 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 Valid Downlink Data Received from the Network (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 @@ struct gprs_rlcmac_dl_tbf *gprs_rlcmac_dl_tbf_alloc(struct gprs_rlcmac_entity *g
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 @@ void gprs_rlcmac_dl_tbf_free(struct gprs_rlcmac_dl_tbf *dl_tbf)
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 @@ void gprs_rlcmac_dl_tbf_free(struct gprs_rlcmac_dl_tbf *dl_tbf)
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 @@ int gprs_rlcmac_dl_tbf_configure_l1ctl(struct gprs_rlcmac_dl_tbf *dl_tbf)
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 @@ struct msgb *gprs_rlcmac_dl_tbf_create_pkt_dl_ack_nack(const struct gprs_rlcmac_
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 @@ int gprs_rlcmac_dl_tbf_rcv_data_block(struct gprs_rlcmac_dl_tbf *dl_tbf,
{
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 @@ int gprs_rlcmac_dl_tbf_rcv_data_block(struct gprs_rlcmac_dl_tbf *dl_tbf,
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 @@ static void st_new(struct osmo_fsm_inst *fi, uint32_t event, void *data)
/* 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);