pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31443 )
Change subject: rlcmac: Implement T3168 (Pkt Res Req timeout 2phase access) ......................................................................
rlcmac: Implement T3168 (Pkt Res Req timeout 2phase access)
Change-Id: Ibf011ca94e50542b67353cd8f7f74c5be955af34 --- M include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h M src/rlcmac/rlcmac.c M src/rlcmac/tbf_ul_ass_fsm.c 3 files changed, 44 insertions(+), 10 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h b/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h index 28a51af..d1159d5 100644 --- a/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h +++ b/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h @@ -40,6 +40,8 @@ uint8_t ts; uint32_t fn; } sched_pkt_ctrl_ack; + /* Number of packet resource request transmitted (T3168) */ + unsigned int pkt_res_req_proc_attempts; };
enum tbf_ul_ass_fsm_event { diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c index 260749c..46addeb 100644 --- a/src/rlcmac/rlcmac.c +++ b/src/rlcmac/rlcmac.c @@ -44,8 +44,10 @@
/* TS 44.060 Table 13.1.1 */ static struct osmo_tdef T_defs_rlcmac[] = { - { .T=3164, .default_val=5, .desc="Wait for Uplink State Flag After Assignment (s)" }, - { .T=3166, .default_val=5, .desc="Wait for Packet Uplink ACK/NACK after sending of first data block (s)" }, + { .T=3164, .default_val=5, .unit = OSMO_TDEF_S, .desc="Wait for Uplink State Flag After Assignment (s)" }, + { .T=3166, .default_val=5, .unit = OSMO_TDEF_S, .desc="Wait for Packet Uplink ACK/NACK after sending of first data block (s)" }, + /* 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)" }, { 0 } /* empty item at the end */ };
@@ -315,6 +317,17 @@ }
g_ctx->si13_available = true; + + /* Update tdef for T3168: + * TS 44.060 Table 12.24.2: Range: 0 to 7. The timeout value is given as the binary value plus one in units of 500 ms. */ + osmo_tdef_set(g_ctx->T_defs, 3168, + (g_ctx->si13ro.u.PBCCH_Not_present.GPRS_Cell_Options.T3168 + 1) * 500, + OSMO_TDEF_MS); + + /* TODO: Update tdef for T3192 as per TS 44.060 Table 12.24.2 + * osmo_tdef_set(g_ctx->T_defs, 3192, si13ro.u.PBCCH_Not_present.GPRS_Cell_Options.T3192, enum osmo_tdef_unit val_unit); + */ + return rc; }
diff --git a/src/rlcmac/tbf_ul_ass_fsm.c b/src/rlcmac/tbf_ul_ass_fsm.c index 1eb38ae..a382ab2 100644 --- a/src/rlcmac/tbf_ul_ass_fsm.c +++ b/src/rlcmac/tbf_ul_ass_fsm.c @@ -48,7 +48,7 @@ [GPRS_RLCMAC_TBF_UL_ASS_ST_IDLE] = { }, [GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_CCCH_IMM_ASS] = { }, [GPRS_RLCMAC_TBF_UL_ASS_ST_SCHED_PKT_RES_REQ] = { }, - [GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_PKT_UL_ASS] = { }, + [GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_PKT_UL_ASS] = { .T = 3168 }, [GPRS_RLCMAC_TBF_UL_ASS_ST_SCHED_PKT_CTRL_ACK] = { }, [GPRS_RLCMAC_TBF_UL_ASS_ST_COMPL] = { }, }; @@ -217,7 +217,6 @@ switch (event) { case GPRS_RLCMAC_TBF_UL_ASS_EV_CREATE_RLCMAC_MSG: data_ctx = (struct tbf_ul_ass_ev_create_rlcmac_msg_ctx *)data; - LOGPFSML(fi, LOGL_ERROR, "TODO: create PKT RES REQ...\n"); data_ctx->msg = create_pkt_resource_req(ctx, data_ctx); if (!data_ctx->msg) return; @@ -308,6 +307,7 @@ .in_event_mask = X(GPRS_RLCMAC_TBF_UL_ASS_EV_RX_PKT_UL_ASS), .out_state_mask = + X(GPRS_RLCMAC_TBF_UL_ASS_ST_SCHED_PKT_RES_REQ) | X(GPRS_RLCMAC_TBF_UL_ASS_ST_SCHED_PKT_CTRL_ACK), .name = "WAIT_PKT_UL_ASS", .action = st_wait_pkt_ul_ass, @@ -334,12 +334,22 @@ { struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *ctx = (struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *)fi->priv; switch (fi->T) { - case -2001: - LOGPTBFUL(ctx->ul_tbf, LOGL_NOTICE, "releasing due to PACCH assignment timeout.\n"); - /* fall-through */ - case 3169: - case 3195: - gprs_rlcmac_ul_tbf_free(ctx->ul_tbf); + case 3168: + /* TS 44.060 7.1.3.3: "the mobile station shall then reinitiate the packet access + * procedure unless the packet access procedure has already been attempted four + * times. In that case, TBF failure has occurred and an RLC/MAC error should be + * reported to the higher layer for each of the TBFs for which resources were + * requested". */ + ctx->pkt_res_req_proc_attempts++; + LOGPFSML(ctx->fi, LOGL_INFO, "T3168 timeout attempts=%u\n", ctx->pkt_res_req_proc_attempts); + OSMO_ASSERT(fi->state == GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_PKT_UL_ASS); + if (ctx->pkt_res_req_proc_attempts == 4) { + LOGPFSML(ctx->fi, LOGL_NOTICE, "TBF establishment failure (T3168 timeout attempts=%u)\n", + ctx->pkt_res_req_proc_attempts); + gprs_rlcmac_ul_tbf_free(ctx->ul_tbf); + return 0; + } + tbf_ul_ass_fsm_state_chg(fi, GPRS_RLCMAC_TBF_UL_ASS_ST_SCHED_PKT_RES_REQ); break; default: OSMO_ASSERT(0);