From de8e202d8304ba9013987336ccf0131f7f65ef15 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Fri, 22 Oct 2021 02:28:31 +0300 Subject: struct gsm_lchan: move tch.rep_facch to rep_acch.dl_facch Finally we have all ACCH repetition state variables in one place. Change-Id: I1469619528bb69c78c2fdc25bc1db208ead936d0 Related: SYS#5114 --- include/osmo-bts/lchan.h | 6 ++---- src/common/l1sap.c | 24 ++++++++++++------------ src/common/lchan.c | 8 ++++---- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h index 3eb4f935..a7e90043 100644 --- a/include/osmo-bts/lchan.h +++ b/include/osmo-bts/lchan.h @@ -254,9 +254,6 @@ struct gsm_lchan { uint8_t last_cmr; uint32_t last_fn; - /* SLOT #0 and #1 to store FACCH for repetition */ - struct gsm_rep_facch rep_facch[2]; - } tch; /* 3GPP TS 48.058 ยง 9.3.37: [0; 255] ok, -1 means invalid*/ @@ -311,7 +308,8 @@ struct gsm_lchan { bool ul_sacch_active; bool dl_sacch_active; - /* Message buffer to store DL-SACCH repeation candidate */ + /* Message buffers to store repeation candidates */ + struct gsm_rep_facch dl_facch[2]; struct msgb *dl_sacch_msg; } rep_acch; diff --git a/src/common/l1sap.c b/src/common/l1sap.c index d94e3bcf..c89b2c3c 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -987,14 +987,14 @@ static inline struct msgb *lapdm_phsap_dequeue_msg_facch(struct gsm_lchan *lchan /* Note: The repeated version of the FACCH block must be scheduled 8 or 9 bursts after the original * transmission. see 3GPP TS 44.006, section 10.2 for a more detailed explaination. */ - if (lchan->tch.rep_facch[0].msg && GSM_TDMA_FN_SUB(fn, lchan->tch.rep_facch[0].fn) >= 8) { + if (lchan->rep_acch.dl_facch[0].msg && GSM_TDMA_FN_SUB(fn, lchan->rep_acch.dl_facch[0].fn) >= 8) { /* Re-use stored FACCH message buffer from SLOT #0 for repetition. */ - msg = lchan->tch.rep_facch[0].msg; - lchan->tch.rep_facch[0].msg = NULL; - } else if (lchan->tch.rep_facch[1].msg && GSM_TDMA_FN_SUB(fn, lchan->tch.rep_facch[1].fn) >= 8) { + msg = lchan->rep_acch.dl_facch[0].msg; + lchan->rep_acch.dl_facch[0].msg = NULL; + } else if (lchan->rep_acch.dl_facch[1].msg && GSM_TDMA_FN_SUB(fn, lchan->rep_acch.dl_facch[1].fn) >= 8) { /* Re-use stored FACCH message buffer from SLOT #1 for repetition. */ - msg = lchan->tch.rep_facch[1].msg; - lchan->tch.rep_facch[1].msg = NULL; + msg = lchan->rep_acch.dl_facch[1].msg; + lchan->rep_acch.dl_facch[1].msg = NULL; } else { /* Fetch new FACCH from queue ... */ if (lapdm_phsap_dequeue_prim(le, &pp) < 0) @@ -1010,12 +1010,12 @@ static inline struct msgb *lapdm_phsap_dequeue_msg_facch(struct gsm_lchan *lchan return msg; /* ... and store the message buffer for repetition. */ - if (lchan->tch.rep_facch[0].msg == NULL) { - lchan->tch.rep_facch[0].msg = msgb_copy(msg, "rep_facch_0"); - lchan->tch.rep_facch[0].fn = fn; - } else if (lchan->tch.rep_facch[1].msg == NULL) { - lchan->tch.rep_facch[1].msg = msgb_copy(msg, "rep_facch_1"); - lchan->tch.rep_facch[1].fn = fn; + if (lchan->rep_acch.dl_facch[0].msg == NULL) { + lchan->rep_acch.dl_facch[0].msg = msgb_copy(msg, "rep_facch_0"); + lchan->rep_acch.dl_facch[0].fn = fn; + } else if (lchan->rep_acch.dl_facch[1].msg == NULL) { + lchan->rep_acch.dl_facch[1].msg = msgb_copy(msg, "rep_facch_1"); + lchan->rep_acch.dl_facch[1].fn = fn; } else { /* By definition 3GPP TS 05.02 does not allow more than two (for TCH/H only one) FACCH blocks * to be transmitted simultaniously. */ diff --git a/src/common/lchan.c b/src/common/lchan.c index 423ecc13..9f274098 100644 --- a/src/common/lchan.c +++ b/src/common/lchan.c @@ -292,10 +292,10 @@ void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state) lapdm_channel_exit(&lchan->lapdm_ch); /* Also ensure that there are no leftovers from repeated FACCH or * repeated SACCH that might cause memory leakage. */ - msgb_free(lchan->tch.rep_facch[0].msg); - msgb_free(lchan->tch.rep_facch[1].msg); - lchan->tch.rep_facch[0].msg = NULL; - lchan->tch.rep_facch[1].msg = NULL; + msgb_free(lchan->rep_acch.dl_facch[0].msg); + msgb_free(lchan->rep_acch.dl_facch[1].msg); + lchan->rep_acch.dl_facch[0].msg = NULL; + lchan->rep_acch.dl_facch[1].msg = NULL; msgb_free(lchan->rep_acch.dl_sacch_msg); lchan->rep_acch.dl_sacch_msg = NULL; /* fall through */ -- cgit v1.2.3