From a03f36654b5ea6e9038d733da31fb3f29291da9d Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 22 May 2023 12:49:19 +0200 Subject: [PATCH] gmmrr: Add new LLC_TRANSMITTED.ind This event doesn't show up as an explicit primitive in TS 24.007 GMMRR SAP, but it is clearly needed to (re)arm the READY timer in GMM layer as per TS 24.008 section 4.7.2.1.1: """ The READY timer is started: - in the MS when the GMM entity receives an indication from lower layers that an LLC frame other than LLC NULL frame has been transmitted on the radio interface; """ Change-Id: I9fd4047cfae4a12ad3be41860032eeda263d3276 --- include/osmocom/gprs/gmm/gmm_prim.h | 5 +++++ include/osmocom/gprs/rlcmac/rlcmac_prim.h | 5 +++++ include/osmocom/gprs/rlcmac/rlcmac_private.h | 1 + src/gmm/gmm_prim.c | 5 +++++ src/rlcmac/rlcmac_prim.c | 11 +++++++++++ src/rlcmac/tbf_ul.c | 10 ++++++++++ tests/rlcmac/rlcmac_prim_test.ok | 7 +++++++ 7 files changed, 44 insertions(+) diff --git a/include/osmocom/gprs/gmm/gmm_prim.h b/include/osmocom/gprs/gmm/gmm_prim.h index 3b2ee70..4b8657f 100644 --- a/include/osmocom/gprs/gmm/gmm_prim.h +++ b/include/osmocom/gprs/gmm/gmm_prim.h @@ -161,11 +161,13 @@ struct osmo_gprs_gmm_gmmreg_prim { }; /* TS 24.007 Section 9.3.2 "Service primitives for GMMRR-SAP (GSM only)" + * OSMO_GPRS_GMM_GMMRR_LLC_TRANSMITTED: addition implementing TS 24.008 4.7.2.1.1 * Same as enum osmo_gprs_rlcmac_gmmrr_prim_type. */ enum osmo_gprs_gmm_gmmrr_prim_type { OSMO_GPRS_GMM_GMMRR_ASSIGN, /* Req: newTLLI */ OSMO_GPRS_GMM_GMMRR_PAGE, /* Ind: TLLI */ + OSMO_GPRS_GMM_GMMRR_LLC_TRANSMITTED, /* Ind: TLLI */ }; extern const struct value_string osmo_gprs_gmm_gmmrr_prim_type_names[]; static inline const char *osmo_gprs_gmm_gmmrr_prim_type_name(enum osmo_gprs_gmm_gmmrr_prim_type val) @@ -187,6 +189,9 @@ struct osmo_gprs_gmm_gmmrr_prim { /* OSMO_GPRS_GMM_GMMRR_PAGE | Ind */ struct { } page_ind; + /* OSMO_GPRS_GMM_GMMRR_LLC_TRANSMITTED | Ind */ + struct { + } llc_transmitted_ind; }; }; diff --git a/include/osmocom/gprs/rlcmac/rlcmac_prim.h b/include/osmocom/gprs/rlcmac/rlcmac_prim.h index ae6c0d1..c44de22 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac_prim.h +++ b/include/osmocom/gprs/rlcmac/rlcmac_prim.h @@ -66,10 +66,12 @@ struct osmo_gprs_rlcmac_grr_prim { }; /* TS 24.007 Section 9.3.2 "Service primitives for GMMRR-SAP (GSM only)" + * OSMO_GPRS_RLCMAC_GMMRR_LLC_TRANSMITTED: addition implementing TS 24.008 4.7.2.1.1 * Same as enum osmo_gprs_gmm_gmmrr_prim_type. */ enum osmo_gprs_rlcmac_gmmrr_prim_type { OSMO_GPRS_RLCMAC_GMMRR_ASSIGN, /* Req: newTLLI */ + OSMO_GPRS_RLCMAC_GMMRR_LLC_TRANSMITTED, /* Ind: TLLI */ OSMO_GPRS_RLCMAC_GMMRR_PAGE, /* Ind: TLLI */ }; @@ -93,6 +95,9 @@ struct osmo_gprs_rlcmac_gmmrr_prim { /* OSMO_GPRS_RLCMAC_GMMRR_PAGE | Ind */ struct { } page_ind; + /* OSMO_GPRS_RLCMAC_GMMRR_LLC_TRANSMITTED | Ind */ + struct { + } llc_transmitted_ind; }; }; diff --git a/include/osmocom/gprs/rlcmac/rlcmac_private.h b/include/osmocom/gprs/rlcmac/rlcmac_private.h index da7ba67..e73d23e 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac_private.h +++ b/include/osmocom/gprs/rlcmac/rlcmac_private.h @@ -100,6 +100,7 @@ int gprs_rlcmac_prim_call_down_cb(struct osmo_gprs_rlcmac_prim *rlcmac_prim); struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_grr_unitdata_ind( uint32_t tlli, uint8_t *ll_pdu, size_t ll_pdu_len); struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_gmmrr_page_ind(uint32_t tlli); +struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_gmmrr_llc_transmitted_ind(uint32_t tlli); struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_rach8_req(uint8_t ra); struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_rach11_req(uint16_t ra11, uint8_t synch_seq); diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c index b2f1fdc..7ca6535 100644 --- a/src/gmm/gmm_prim.c +++ b/src/gmm/gmm_prim.c @@ -56,6 +56,7 @@ const struct value_string osmo_gprs_gmm_gmmreg_prim_type_names[] = { const struct value_string osmo_gprs_gmm_gmmrr_prim_type_names[] = { { OSMO_GPRS_GMM_GMMRR_ASSIGN, "ASSIGN" }, { OSMO_GPRS_GMM_GMMRR_PAGE, "PAGE" }, + { OSMO_GPRS_GMM_GMMRR_LLC_TRANSMITTED, "LLC_TRANSMITTED" }, { 0, NULL } }; @@ -610,6 +611,10 @@ static int gprs_gmm_prim_handle_gmmrr(struct osmo_gprs_gmm_prim *gmm_prim) rc = gprs_gmm_prim_handle_unsupported(gmm_prim); rc = 1; break; + case OSMO_PRIM(OSMO_GPRS_GMM_GMMRR_LLC_TRANSMITTED, PRIM_OP_INDICATION): + rc = gprs_gmm_prim_handle_unsupported(gmm_prim); + rc = 1; + break; default: rc = gprs_gmm_prim_handle_unsupported(gmm_prim); rc = 1; diff --git a/src/rlcmac/rlcmac_prim.c b/src/rlcmac/rlcmac_prim.c index 3a05d4e..7337647 100644 --- a/src/rlcmac/rlcmac_prim.c +++ b/src/rlcmac/rlcmac_prim.c @@ -59,6 +59,7 @@ const struct value_string osmo_gprs_rlcmac_grr_prim_type_names[] = { const struct value_string osmo_gprs_rlcmac_gmmrr_prim_type_names[] = { { OSMO_GPRS_RLCMAC_GMMRR_ASSIGN, "ASSIGN" }, { OSMO_GPRS_RLCMAC_GMMRR_PAGE, "PAGE" }, + { OSMO_GPRS_RLCMAC_GMMRR_LLC_TRANSMITTED, "LLC_TRANSMITTED" }, { 0, NULL } }; @@ -222,6 +223,16 @@ struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_gmmrr_page_ind(uint32_t tll return rlcmac_prim; } +/* TS 24.008 4.7.2.1.1: indication towards GMM that an LLC frame other than LLC + * NULL frame has been transmitted on the radio interface */ +struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_gmmrr_llc_transmitted_ind(uint32_t tlli) +{ + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + rlcmac_prim = rlcmac_prim_gmmrr_alloc(OSMO_GPRS_RLCMAC_GMMRR_LLC_TRANSMITTED, PRIM_OP_INDICATION, 0); + rlcmac_prim->gmmrr.tlli = tlli; + return rlcmac_prim; +} + /* L1CTL-RACH.req (8bit) */ struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_l1ctl_rach8_req(uint8_t ra) { diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c index 8e03207..40e993c 100644 --- a/src/rlcmac/tbf_ul.c +++ b/src/rlcmac/tbf_ul.c @@ -330,6 +330,8 @@ bool gprs_rlcmac_ul_tbf_shall_keep_open(const struct gprs_rlcmac_ul_tbf *ul_tbf, void gprs_rlcmac_ul_tbf_schedule_next_llc_frame(struct gprs_rlcmac_ul_tbf *ul_tbf) { + struct osmo_gprs_rlcmac_prim *rlcmac_prim_tx; + if (ul_tbf->llc_tx_msg && msgb_length(ul_tbf->llc_tx_msg)) return; @@ -342,6 +344,14 @@ void gprs_rlcmac_ul_tbf_schedule_next_llc_frame(struct gprs_rlcmac_ul_tbf *ul_tb LOGPTBFUL(ul_tbf, LOGL_DEBUG, "Dequeue next LLC (len=%d)\n", msgb_length(ul_tbf->llc_tx_msg)); ul_tbf->last_ul_drained_fn = -1; + + /* TS 24.008 section 4.7.2.1.1: "The READY timer is started in the MS + * when the GMM entity receives an indication from lower layers that an LLC frame + * other than LLC NULL frame has been transmitted on the radio interface". + * hence, signal here to GMM the event. + */ + rlcmac_prim_tx = gprs_rlcmac_prim_alloc_gmmrr_llc_transmitted_ind(ul_tbf->tbf.gre->tlli); + gprs_rlcmac_prim_call_up_cb(rlcmac_prim_tx); } static int create_new_bsn(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_rts_block_ind *bi, enum gprs_rlcmac_coding_scheme cs) diff --git a/tests/rlcmac/rlcmac_prim_test.ok b/tests/rlcmac/rlcmac_prim_test.ok index 71b9888..24abafa 100644 --- a/tests/rlcmac/rlcmac_prim_test.ok +++ b/tests/rlcmac/rlcmac_prim_test.ok @@ -2,6 +2,7 @@ sys={0.000000}, mono={0.000000}: clock_override_set test_rlcmac_prim_down_cb(): Rx L1CTL-RACH.request ra=0x7e test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x80 +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00002342 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=4 ts=7 data_len=34 data=[3c 01 01 00 00 23 42 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 00 00 00 00 71 62 f2 24 6c 84 44 04 00 ] test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=8 ts=7 data_len=34 data=[00 01 02 1d 00 00 23 42 11 e5 10 00 e2 18 f2 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 00 ] test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x00 @@ -34,6 +35,7 @@ test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask= sys={0.000000}, mono={0.000000}: clock_override_set test_rlcmac_prim_down_cb(): Rx L1CTL-RACH.request ra=0x7a test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x80 +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00002342 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=4 ts=7 data_len=34 data=[3c 01 01 00 00 23 42 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 00 00 00 00 71 62 f2 24 6c 84 44 04 00 ] sys={5.000000}, mono={5.000000}: clock_override_add sys={5.000000}, mono={5.000000}: Expect T3166 timeout @@ -62,6 +64,7 @@ sys={0.000000}, mono={0.000000}: clock_override_set test_rlcmac_prim_down_cb(): Rx L1CTL-RACH.request ra=0x7a test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x80 RTS 0: FN=8 +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00002342 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=8 ts=7 data_len=34 data=[3c 01 01 00 00 23 42 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 00 00 00 00 71 62 f2 24 6c 84 44 04 00 ] RTS 1: FN=13 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=13 ts=7 data_len=34 data=[00 01 02 1d 00 00 23 42 11 e5 10 00 e2 18 f2 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 00 ] @@ -88,6 +91,7 @@ test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask= sys={0.000000}, mono={0.000000}: clock_override_set test_rlcmac_prim_down_cb(): Rx L1CTL-RACH.request ra=0x7a test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x80 +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00002342 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=4 ts=7 data_len=34 data=[3c 01 01 00 00 23 42 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 00 00 00 00 71 62 f2 24 6c 84 44 04 00 ] test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=8 ts=7 data_len=34 data=[00 00 02 1d 11 e5 10 00 e2 18 f2 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 00 ] sys={5.000000}, mono={5.000000}: clock_override_add @@ -98,6 +102,7 @@ test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask= sys={0.000000}, mono={0.000000}: clock_override_set test_rlcmac_prim_down_cb(): Rx L1CTL-RACH.request ra=0x7b test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x80 +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00002342 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=4 ts=7 data_len=34 data=[3c 01 01 00 00 23 42 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 00 00 00 00 71 62 f2 24 6c 84 44 04 00 ] test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=8 ts=7 data_len=34 data=[00 00 02 1d 11 e5 10 00 e2 18 f2 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 00 ] RTS 0: FN=13 @@ -114,6 +119,7 @@ test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=26 ts=7 data_len=34 da sys={0.000000}, mono={0.000000}: clock_override_set test_rlcmac_prim_down_cb(): Rx L1CTL-RACH.request ra=0x7b test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x80 +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00002342 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=4 ts=7 data_len=34 data=[00 01 00 39 00 00 23 42 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 00 ] test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x00 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=17 ts=7 data_len=23 data=[40 16 40 00 08 d0 a0 bc 00 00 00 00 00 00 70 00 38 00 00 2b 2b 2b 2b ] @@ -132,6 +138,7 @@ test_rlcmac_prim_up_cb(): Rx GRR-UNITDATA.indication TLLI=0x00000001 ll=[43 c0 0 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=21 ts=7 data_len=23 data=[40 08 10 20 00 00 00 00 00 00 00 30 40 00 00 00 00 03 2b 2b 2b 2b 2b ] test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0xc0 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=43 ts=7 data_len=23 data=[40 04 00 00 00 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b ] +test_rlcmac_prim_up_cb(): Rx GMMRR-LLC_TRANSMITTED.indication TLLI=0x00000001 test_rlcmac_prim_down_cb(): Rx L1CTL-PDCH_DATA.request fn=47 ts=6 data_len=34 data=[00 06 00 39 01 c0 00 08 01 01 d5 71 00 00 08 29 26 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 00 ] === test_dl_tbf_ccch_assign_requests_ul_tbf_pacch end === test_rlcmac_prim_down_cb(): Rx L1CTL-CFG_UL_TBF.request ul_tbf_nr=0 ul_slotmask=0x00