rlcmac: Implement T3168 (Pkt Res Req timeout 2phase access)

Change-Id: Ibf011ca94e50542b67353cd8f7f74c5be955af34
This commit is contained in:
Pau Espin 2023-02-21 13:04:57 +01:00
parent 96fe992644
commit 46a4f3ed66
3 changed files with 35 additions and 10 deletions

View File

@ -40,6 +40,8 @@ struct gprs_rlcmac_tbf_ul_ass_fsm_ctx {
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 {

View File

@ -44,8 +44,10 @@ struct gprs_rlcmac_ctx *g_ctx;
/* 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 @@ int gprs_rlcmac_handle_bcch_si13(const struct gsm48_system_information_type_13 *
}
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;
}

View File

@ -48,7 +48,7 @@ static const struct osmo_tdef_state_timeout tbf_ul_ass_fsm_timeouts[32] = {
[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 @@ static void st_sched_pkt_res_req(struct osmo_fsm_inst *fi, uint32_t event, void
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 @@ static struct osmo_fsm_state tbf_ul_ass_fsm_states[] = {
.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 @@ static int tbf_ul_ass_fsm_timer_cb(struct osmo_fsm_inst *fi)
{
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);