fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/34512?usp=email )
Change subject: rlcmac: deal with RACH retransmissions (drop rach_req_ra) ...................................................................... rlcmac: deal with RACH retransmissions (drop rach_req_ra) The RA value does change during RACH retransmissions, so we cannot expect a specific value in gprs_rlcmac_handle_ccch_imm_ass_ul_tbf() anymore. Offload checking it to the lower layers. * Rename submit_rach_req() to submit_packet_access_req(). * Get rid of gen_chan_req(), indicate only the access cause. Ideally, we should also rename the OSMO_GPRS_RLCMAC_L1CTL_RACH to something like OSMO_GPRS_RLCMAC_L1CTL_PKT_CHAN_ACCESS, but let's better do this separately. Change-Id: If0de3ed86b1e2897d70183f3b0f4fbfd7d2bda80 Related: osmocom-bb.git Iab6d9147f6e0aeb99239affacf318a3897fd6ffe Related: OS#5500, OS#6131 --- 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, 42 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/12/34512/1 diff --git a/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h b/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h index ad32471..162517d 100644 --- a/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h +++ b/include/osmocom/gprs/rlcmac/tbf_ul_ass_fsm.h @@ -35,7 +35,6 @@ }; const struct gprs_rlcmac_dl_tbf *dl_tbf; /* Not null if assignment was started by a DL TBF ACK/NACK */ enum gprs_rlcmac_tbf_ul_ass_type ass_type; - uint8_t rach_req_ra; struct gprs_rlcmac_ul_tbf_allocation phase1_alloc; struct gprs_rlcmac_ul_tbf_allocation phase2_alloc; bool tbf_starting_time_exists; @@ -85,7 +84,7 @@ int gprs_rlcmac_tbf_ul_ass_start_from_dl_tbf_ack_nack(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_dl_tbf *dl_tbf, uint8_t tn); bool gprs_rlcmac_tbf_ul_ass_pending(struct gprs_rlcmac_ul_tbf *ul_tbf); -bool gprs_rlcmac_tbf_ul_ass_match_rach_req(struct gprs_rlcmac_ul_tbf *ul_tbf, uint8_t ra); +bool gprs_rlcmac_tbf_ul_ass_wait_ccch_imm_ass(const struct gprs_rlcmac_ul_tbf *ul_tbf); bool gprs_rlcmac_tbf_ul_ass_waiting_tbf_starting_time(const struct gprs_rlcmac_ul_tbf *ul_tbf); void gprs_rlcmac_tbf_ul_ass_fn_tick(const struct gprs_rlcmac_ul_tbf *ul_tbf, uint32_t fn, uint8_t ts_nr); bool gprs_rlcmac_tbf_ul_ass_rts(const struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_rts_block_ind *bi); diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c index 212b801..2c809ec 100644 --- a/src/rlcmac/rlcmac.c +++ b/src/rlcmac/rlcmac.c @@ -219,7 +219,7 @@ ul_tbf = gre->ul_tbf; if (!ul_tbf) continue; - if (!gprs_rlcmac_tbf_ul_ass_match_rach_req(ul_tbf, ia->req_ref.ra)) + if (!gprs_rlcmac_tbf_ul_ass_wait_ccch_imm_ass(ul_tbf)) continue; rc = osmo_fsm_inst_dispatch(ul_tbf->ul_ass_fsm.fi, GPRS_RLCMAC_TBF_UL_ASS_EV_RX_CCCH_IMM_ASS, diff --git a/src/rlcmac/tbf_ul_ass_fsm.c b/src/rlcmac/tbf_ul_ass_fsm.c index 5587ddb..64797aa 100644 --- a/src/rlcmac/tbf_ul_ass_fsm.c +++ b/src/rlcmac/tbf_ul_ass_fsm.c @@ -103,27 +103,24 @@ return NULL; } -/* Generate a 8-bit CHANNEL REQUEST message as per 3GPP TS 44.018, 9.1.8 */ -static uint8_t gen_chan_req(bool single_block) -{ - uint8_t rnd = (uint8_t)rand(); - - if (single_block) /* 01110xxx */ - return 0x70 | (rnd & 0x07); - - /* 011110xx or 01111x0x or 01111xx0 */ - if ((rnd & 0x07) == 0x07) - return 0x78; - return 0x78 | (rnd & 0x07); -} - -static int submit_rach_req(struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *ctx) +static int submit_packet_access_req(const struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *ctx) { struct osmo_gprs_rlcmac_prim *rlcmac_prim; - ctx->rach_req_ra = gen_chan_req(ctx->ass_type == GPRS_RLCMAC_TBF_UL_ASS_TYPE_2PHASE); - LOGPFSML(ctx->fi, LOGL_INFO, "Send RACH.req ra=0x%02x\n", ctx->rach_req_ra); - rlcmac_prim = gprs_rlcmac_prim_alloc_l1ctl_rach8_req(ctx->rach_req_ra); + switch (ctx->ass_type) { + case GPRS_RLCMAC_TBF_UL_ASS_TYPE_1PHASE: + /* 3GPP TS 44.018, table 9.1.8.1: cause 011110xx or 01111x0x or 01111xx0 */ + LOGPFSML(ctx->fi, LOGL_INFO, "Requesting one-phase packet access using CCCH\n"); + rlcmac_prim = gprs_rlcmac_prim_alloc_l1ctl_rach8_req(0x78); + break; + case GPRS_RLCMAC_TBF_UL_ASS_TYPE_2PHASE: + /* 3GPP TS 44.018, table 9.1.8.1: cause 011110xx */ + LOGPFSML(ctx->fi, LOGL_INFO, "Requesting two-phase packet access using CCCH\n"); + rlcmac_prim = gprs_rlcmac_prim_alloc_l1ctl_rach8_req(0x70); + break; + /* TODO: EGPRS specific modes (11-bit RACH) */ + } + return gprs_rlcmac_prim_call_down_cb(rlcmac_prim); } @@ -271,7 +268,7 @@ /* Inform the main TBF state about the assignment starting: */ osmo_fsm_inst_dispatch(ctx->ul_tbf->state_fsm.fi, GPRS_RLCMAC_TBF_UL_EV_UL_ASS_START, NULL); ctx->ass_type = *(enum gprs_rlcmac_tbf_ul_ass_type *)data; - rc = submit_rach_req(ctx); + rc = submit_packet_access_req(ctx); if (rc < 0) { osmo_fsm_inst_dispatch(ctx->ul_tbf->state_fsm.fi, GPRS_RLCMAC_TBF_UL_EV_UL_ASS_REJ, NULL); break; @@ -702,10 +699,9 @@ return ul_tbf->ul_ass_fsm.fi->state != GPRS_RLCMAC_TBF_UL_ASS_ST_IDLE; } -bool gprs_rlcmac_tbf_ul_ass_match_rach_req(struct gprs_rlcmac_ul_tbf *ul_tbf, uint8_t ra) +bool gprs_rlcmac_tbf_ul_ass_wait_ccch_imm_ass(const struct gprs_rlcmac_ul_tbf *ul_tbf) { - return ul_tbf->ul_ass_fsm.fi->state == GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_CCCH_IMM_ASS && - ul_tbf->ul_ass_fsm.rach_req_ra == ra; + return ul_tbf->ul_ass_fsm.fi->state == GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_CCCH_IMM_ASS; } bool gprs_rlcmac_tbf_ul_ass_waiting_tbf_starting_time(const struct gprs_rlcmac_ul_tbf *ul_tbf) -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/34512?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: If0de3ed86b1e2897d70183f3b0f4fbfd7d2bda80 Gerrit-Change-Number: 34512 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanits...@sysmocom.de> Gerrit-MessageType: newchange