lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

November 2022

  • 2 participants
  • 2503 discussions
Change in osmo-pcu[master]: tbf_ul: Assign DL-TBF if needed after UL-TBF has gone over contenion ...
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29933 ) Change subject: tbf_ul: Assign DL-TBF if needed after UL-TBF has gone over contenion resolution ...................................................................... tbf_ul: Assign DL-TBF if needed after UL-TBF has gone over contenion resolution If data received from SGSN is waiting to be sent to the MS, we may have created a DL-TBF assignment over PCH if the MS was not in packet-active mode. If the MS instead reaches back to the PCU asking for an UL-TBF, the PCU has to wait until Content Resolution of the UL-TBF has succeeded in order to attempt now to assign the DL-TBF over PACCH. The delay was already there, but the trigger to attempt the DL-TBF assignment upon UL-TBF contention reslution success was missing. Related: OS#5700 Change-Id: Ib8f7ad2390485ce9fd76a9de6cd349a5f4037568 --- M src/tbf_ul.cpp 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index bd885b6..d07998c 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -287,6 +287,12 @@ t_stop(T3141, "Contention resolution success (UL-TBF, CCCH)"); bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_UL_TBF_CONTENTION_RESOLUTION_SUCCESS); + + /* Check if we can create a DL TBF to start sending the enqueued + * data. Otherwise it will be triggered later when it is reachable + * again. */ + if (ms_need_dl_tbf(ms()) && !tbf_ul_ack_waiting_cnf_final_ack(this)) + ms_new_dl_tbf_assigned_on_pacch(ms(), this); } /*! \brief receive data from PDCH/L1 */ -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29933 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ib8f7ad2390485ce9fd76a9de6cd349a5f4037568 Gerrit-Change-Number: 29933 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: tbf_fsm: Introduce new event to act upon contention resolution success
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29932 ) Change subject: tbf_fsm: Introduce new event to act upon contention resolution success ...................................................................... tbf_fsm: Introduce new event to act upon contention resolution success This is a preparation towards fixing MS not recreating a DL-TBF (being assigned on CCCH) when MS starts an UL-TBF and finishes contention resolution. A counter is removed which was counting contention resolution (MS) on the wrong place. Change-Id: I8b9555864d3615ce0a024b641c67921f82273a8d --- M src/tbf_fsm.c M src/tbf_fsm.h M src/tbf_ul.cpp M src/tbf_ul_ack_fsm.c M tests/tbf/TbfTest.err 5 files changed, 22 insertions(+), 9 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved dexter: Looks good to me, but someone else must approve diff --git a/src/tbf_fsm.c b/src/tbf_fsm.c index 9ddbd69..6fe2a7a 100644 --- a/src/tbf_fsm.c +++ b/src/tbf_fsm.c @@ -45,6 +45,7 @@ { TBF_EV_ASSIGN_READY_CCCH, "ASSIGN_READY_CCCH" }, { TBF_EV_ASSIGN_PCUIF_CNF, "ASSIGN_PCUIF_CNF" }, { TBF_EV_FIRST_UL_DATA_RECVD, "FIRST_UL_DATA_RECVD" }, + { TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS, "CONTENTION_RESOLUTION_MS_SUCCESS" }, { TBF_EV_DL_ACKNACK_MISS, "DL_ACKNACK_MISS" }, { TBF_EV_LAST_DL_DATA_SENT, "LAST_DL_DATA_SENT" }, { TBF_EV_LAST_UL_DATA_RECVD, "LAST_UL_DATA_RECVD" }, @@ -230,6 +231,10 @@ dl_tbf = NULL; } break; + case TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_UL_TBF); + ul_tbf_contention_resolution_success(tbf_as_ul_tbf(ctx->tbf)); + break; case TBF_EV_DL_ACKNACK_MISS: OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* DL TBF: we missed a DL ACK/NACK. If we started assignment @@ -279,6 +284,12 @@ bool new_ul_tbf_requested; switch (event) { + case TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_UL_TBF); + /* UL TBF: If MS only sends 1 RLCMAC UL block, it can be that we + * end up in FINISHED state before sending the first UL ACK/NACK */ + ul_tbf_contention_resolution_success(tbf_as_ul_tbf(ctx->tbf)); + break; case TBF_EV_DL_ACKNACK_MISS: OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); break; @@ -480,6 +491,7 @@ [TBF_ST_FLOW] = { .in_event_mask = X(TBF_EV_FIRST_UL_DATA_RECVD) | + X(TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS) | X(TBF_EV_DL_ACKNACK_MISS) | X(TBF_EV_LAST_DL_DATA_SENT) | X(TBF_EV_LAST_UL_DATA_RECVD) | @@ -496,6 +508,7 @@ }, [TBF_ST_FINISHED] = { .in_event_mask = + X(TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS) | X(TBF_EV_DL_ACKNACK_MISS) | X(TBF_EV_FINAL_ACK_RECVD) | X(TBF_EV_FINAL_UL_ACK_CONFIRMED) | diff --git a/src/tbf_fsm.h b/src/tbf_fsm.h index 903bcd7..0acd4e5 100644 --- a/src/tbf_fsm.h +++ b/src/tbf_fsm.h @@ -29,6 +29,7 @@ TBF_EV_ASSIGN_READY_CCCH, /* TBF Start Time timer triggered */ TBF_EV_ASSIGN_PCUIF_CNF, /* Transmission of IMM.ASS for DL TBF to the MS confirmed by BTS over PCUIF */ TBF_EV_FIRST_UL_DATA_RECVD, /* UL TBF: Received first UL data from MS. Equals to Contention Resolution completed on the network side */ + TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS, /* UL TBF: Contention resolution success at the mobile station side (first UL_ACK_NACK confirming TLLI is received at the MS) */ TBF_EV_DL_ACKNACK_MISS, /* DL TBF: We polled for DL ACK/NACK but we received none (POLL timeout) */ TBF_EV_LAST_DL_DATA_SENT, /* DL TBF sends RLCMAC block containing last DL avilable data buffered */ TBF_EV_LAST_UL_DATA_RECVD, /* UL TBF sends RLCMAC block containing last UL data (cv=0) */ diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 40129ec..bd885b6 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -257,6 +257,7 @@ return 0; } +/* 3GPP TS 44.060 sec 7a.2.1 Contention Resolution */ void gprs_rlcmac_ul_tbf::contention_resolution_start() { /* 3GPP TS 44.018 sec 11.1.2 Timers on the network side: "This timer is @@ -274,20 +275,17 @@ } void gprs_rlcmac_ul_tbf::contention_resolution_success() { - if (m_contention_resolution_done) - return; + /* now we must set this flag, so we are allowed to assign downlink + * TBF on PACCH. it is only allowed when TLLI is acknowledged + * (3GPP TS 44.060 sec 7.1.3.1). */ + m_contention_resolution_done = true; - /* 3GPP TS 44.060 sec 7a.2.1 Contention Resolution */ /* 3GPP TS 44.018 3.5.2.1.4 Packet access completion: The one phase packet access procedure is completed at a successful contention resolution. The mobile station has entered the packet transfer mode. Timer T3141 is stopped on the network side */ t_stop(T3141, "Contention resolution success (UL-TBF, CCCH)"); - /* now we must set this flag, so we are allowed to assign downlink - * TBF on PACCH. it is only allowed when TLLI is acknowledged. */ - m_contention_resolution_done = true; - bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_UL_TBF_CONTENTION_RESOLUTION_SUCCESS); } diff --git a/src/tbf_ul_ack_fsm.c b/src/tbf_ul_ack_fsm.c index b0506d1..f6e7a0d 100644 --- a/src/tbf_ul_ack_fsm.c +++ b/src/tbf_ul_ack_fsm.c @@ -89,8 +89,8 @@ * on the mobile station side when the mobile station receives a * PACKET UPLINK ACK/NACK" */ - if (ms_tlli(ms) != GSM_RESERVED_TMSI) - ul_tbf_contention_resolution_success(ctx->tbf); + if (ms_tlli(ms) != GSM_RESERVED_TMSI && !ul_tbf_contention_resolution_done(ctx->tbf)) + osmo_fsm_inst_dispatch(tbf_state_fi(ul_tbf_as_tbf(ctx->tbf)), TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS, NULL); if (final) { tbf_set_polling(ul_tbf_as_tbf(tbf), new_poll_fn, d->ts, PDCH_ULC_POLL_UL_ACK); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 1124462..31e2a4c 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -1912,6 +1912,7 @@ Got MS: TLLI = 0xf1223344, TA = 7 UL_ACK_TBF(UL-TFI_0){SCHED_UL_ACK}: Received Event CREATE_RLCMAC_MSG PDCH(bts=0,trx=0,ts=7) POLL scheduled at FN 2654167 + 17 = 2654184 +TBF(UL-TFI_0){FINISHED}: Received Event CONTENTION_RESOLUTION_MS_SUCCESS TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FINISHED) stopping timer T3141 [Contention resolution success (UL-TBF, CCCH)] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FINISHED) Scheduled UL Acknowledgement polling on PACCH (FN=2654184, TS=7) UL_ACK_TBF(UL-TFI_0){SCHED_UL_ACK}: state_chg to WAIT_ACK -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29932 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I8b9555864d3615ce0a024b641c67921f82273a8d Gerrit-Change-Number: 29932 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: tbf_fsm: Introduce new event TBF_EV_FIRST_UL_DATA_RECVD
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29930 ) Change subject: tbf_fsm: Introduce new event TBF_EV_FIRST_UL_DATA_RECVD ...................................................................... tbf_fsm: Introduce new event TBF_EV_FIRST_UL_DATA_RECVD This allows easier tracking of this event. It will also extended later on with more logic which is better placed in tbf_fsm. Change-Id: I5c935914e13db3928c32621ec04eb2760367615d --- M src/tbf_fsm.c M src/tbf_fsm.h M src/tbf_ul.cpp M src/tbf_ul_ack_fsm.c M tests/tbf/TbfTest.err 5 files changed, 27 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/tbf_fsm.c b/src/tbf_fsm.c index a8e7886..b236d27 100644 --- a/src/tbf_fsm.c +++ b/src/tbf_fsm.c @@ -25,6 +25,8 @@ #include <encoding.h> #include <bts.h> +#include <bts_pch_timer.h> + #define X(s) (1 << (s)) const struct osmo_tdef_state_timeout tbf_fsm_timeouts[32] = { @@ -42,6 +44,7 @@ { TBF_EV_ASSIGN_ACK_PACCH, "ASSIGN_ACK_PACCH" }, { TBF_EV_ASSIGN_READY_CCCH, "ASSIGN_READY_CCCH" }, { TBF_EV_ASSIGN_PCUIF_CNF, "ASSIGN_PCUIF_CNF" }, + { TBF_EV_FIRST_UL_DATA_RECVD, "FIRST_UL_DATA_RECVD" }, { TBF_EV_DL_ACKNACK_MISS, "DL_ACKNACK_MISS" }, { TBF_EV_LAST_DL_DATA_SENT, "LAST_DL_DATA_SENT" }, { TBF_EV_LAST_UL_DATA_RECVD, "LAST_UL_DATA_RECVD" }, @@ -204,8 +207,17 @@ static void st_flow(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct tbf_fsm_ctx *ctx = (struct tbf_fsm_ctx *)fi->priv; + struct GprsMs *ms = tbf_ms(ctx->tbf); switch (event) { + case TBF_EV_FIRST_UL_DATA_RECVD: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_UL_TBF); + /* TS 44.060 7a.2.1.1: "The contention resolution is completed on + * the network side when the network receives an RLC data block that + * comprises the TLLI value that identifies the mobile station and the + * TFI value associated with the TBF." */ + bts_pch_timer_stop(ms->bts, ms); + break; case TBF_EV_DL_ACKNACK_MISS: OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* DL TBF: we missed a DL ACK/NACK. If we started assignment @@ -455,6 +467,7 @@ }, [TBF_ST_FLOW] = { .in_event_mask = + X(TBF_EV_FIRST_UL_DATA_RECVD) | X(TBF_EV_DL_ACKNACK_MISS) | X(TBF_EV_LAST_DL_DATA_SENT) | X(TBF_EV_LAST_UL_DATA_RECVD) | diff --git a/src/tbf_fsm.h b/src/tbf_fsm.h index 22266e7..903bcd7 100644 --- a/src/tbf_fsm.h +++ b/src/tbf_fsm.h @@ -28,6 +28,7 @@ TBF_EV_ASSIGN_ACK_PACCH, /* We received a CTRL ACK confirming assignment started on PACCH */ TBF_EV_ASSIGN_READY_CCCH, /* TBF Start Time timer triggered */ TBF_EV_ASSIGN_PCUIF_CNF, /* Transmission of IMM.ASS for DL TBF to the MS confirmed by BTS over PCUIF */ + TBF_EV_FIRST_UL_DATA_RECVD, /* UL TBF: Received first UL data from MS. Equals to Contention Resolution completed on the network side */ TBF_EV_DL_ACKNACK_MISS, /* DL TBF: We polled for DL ACK/NACK but we received none (POLL timeout) */ TBF_EV_LAST_DL_DATA_SENT, /* DL TBF sends RLCMAC block containing last DL avilable data buffered */ TBF_EV_LAST_UL_DATA_RECVD, /* UL TBF sends RLCMAC block containing last UL data (cv=0) */ diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 910bfb4..40129ec 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -398,7 +398,7 @@ "Decoded premier TLLI=0x%08x of UL DATA TFI=%d.\n", new_tlli, rlc->tfi); ms_update_announced_tlli(ms(), new_tlli); - bts_pch_timer_stop(bts, ms()); + osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_FIRST_UL_DATA_RECVD, NULL); } else if (new_tlli != GSM_RESERVED_TMSI && new_tlli != tlli()) { LOGPTBFUL(this, LOGL_NOTICE, "Decoded TLLI=%08x mismatch on UL DATA TFI=%d. (Ignoring due to contention resolution)\n", diff --git a/src/tbf_ul_ack_fsm.c b/src/tbf_ul_ack_fsm.c index 8ec2199..b0506d1 100644 --- a/src/tbf_ul_ack_fsm.c +++ b/src/tbf_ul_ack_fsm.c @@ -80,10 +80,15 @@ /* TS 44.060 7a.2.1.1: "The contention resolution is completed on * the network side when the network receives an RLC data block that * comprises the TLLI value that identifies the mobile station and the - * TFI value associated with the TBF." - * However, it's handier for us to mark contention resolution success - * here since according to spec upon rx UL ACK is the time at which MS - * realizes contention resolution succeeds. */ + * TFI value associated with the TBF." (see TBF_EV_FIRST_UL_DATA_RECVD). + * + * However, it's handier for us to mark contention resolution success here + * since upon rx UL ACK is the time at which MS realizes contention resolution + * succeeds: + * TS 44.060 7.1.2.3: "The contention resolution is successfully completed + * on the mobile station side when the mobile station receives a + * PACKET UPLINK ACK/NACK" + */ if (ms_tlli(ms) != GSM_RESERVED_TMSI) ul_tbf_contention_resolution_success(ctx->tbf); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 6a7ca38..27ed39b 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -1832,6 +1832,7 @@ TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) data_length=20, data=f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. Modifying MS object, UL TLLI: 0xffffffff -> 0xf1223344, not yet confirmed +TBF(UL-TFI_0){FLOW}: Received Event FIRST_UL_DATA_RECVD TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Frame 1 starts at offset 4, length=16, is_complete=1 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 @@ -1893,6 +1894,7 @@ TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) data_length=20, data=f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. Modifying MS object, UL TLLI: 0xffffffff -> 0xf1223344, not yet confirmed +TBF(UL-TFI_0){FLOW}: Received Event FIRST_UL_DATA_RECVD TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Frame 1 starts at offset 4, length=16, is_complete=1 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 @@ -2669,6 +2671,7 @@ DL_ASS_TBF(DL-TFI_0){NONE}: Deallocated MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Clearing MS object MS(TLLI=0xffffffff, IMSI=, TA=7, 1/0,) Destroying MS object +TBF(UL-TFI_0){FLOW}: Received Event FIRST_UL_DATA_RECVD TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Frame 1 starts at offset 4, length=16, is_complete=1 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29930 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I5c935914e13db3928c32621ec04eb2760367615d Gerrit-Change-Number: 29930 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: Avoid losing DL-TBF during MS merge
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29931 ) Change subject: Avoid losing DL-TBF during MS merge ...................................................................... Avoid losing DL-TBF during MS merge It is desired to free pending DL-TBF under some scenarios, which somehow are related to those where we call the ms_merge() procedure since it's at time an MS can be identified when coming from packet-idle state. Until now, the freeing of those DL-TBFs happen because the ms_merge() procedure doesn't migrate DL-TBF from "old_ms" to "ms". This was done manually under the cases where it was deemed necessary before calling the ms_merge() procedure 8because old_ms and its tbfs are gone after returning from it). This logic, though convinient for the specific cases at hand, is quite confusing for readers and program execution since one would expect the ms merge to, well, merge everything. Therefore, this patch changes the ms_merge() logic to always merge the DL-TBF, and only under the specific cases where it makes sense to free it, do so explicitly after MS merge, where all the info has been updated and united. 2 code paths are now explicitly freeing the existing DL-TBF when needed: - TBF_EV_FIRST_UL_DATA_RECVD: 1st data (containing TLLI) is received from MS, hence identifyng the MS and potentially having been merged with some old MS which used to have a DL-TBF, most probably in process of being assigned through CCCH (PCH). This event is triggered during MS using 1phase-access, and we should drop the exsitng DL-TBF because MS just came from packet-idle mode (CCCH). - rcv_resource_request(): PktResourceRequest is received at an scheduled SBA, meaning the MS is doing 2phase-access, meaning MS also came from packet-idle mode (CCCH), so previous DL-TBF can be dropped. Related: OS#5700 Change-Id: I29f4ffa904d79d58275c6596cc5ef6790b6e68c6 --- M src/gprs_ms.c M src/pdch.cpp M src/tbf_dl.cpp M src/tbf_fsm.c M tests/tbf/TbfTest.err 5 files changed, 81 insertions(+), 26 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved dexter: Looks good to me, but someone else must approve diff --git a/src/gprs_ms.c b/src/gprs_ms.c index 10d761d..f233967 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -452,6 +452,14 @@ llc_queue_move_and_merge(&ms->llc_queue, &old_ms->llc_queue); + if (!ms_dl_tbf(ms) && ms_dl_tbf(old_ms)) { + struct gprs_rlcmac_dl_tbf *dl_tbf = ms_dl_tbf(old_ms); + LOGPTBFDL(dl_tbf, LOGL_NOTICE, + "Merge MS: Move DL TBF: %s => %s\n", + old_ms_name, ms_name(ms)); + /* Move the DL TBF to the new MS */ + tbf_set_ms(dl_tbf_as_tbf(dl_tbf), ms); + } /* Clean up the old MS object */ /* TODO: Use timer? */ diff --git a/src/pdch.cpp b/src/pdch.cpp index e979cf0..e9b9852 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -657,6 +657,7 @@ if (request->ID.UnionType) { struct gprs_rlcmac_ul_tbf *ul_tbf = NULL; + struct gprs_rlcmac_dl_tbf *dl_tbf = NULL; uint32_t tlli = request->ID.u.TLLI; GprsMs *ms = bts_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI); @@ -693,8 +694,17 @@ tbf_free(ul_tbf); ul_tbf = NULL; } - /* MS seized the PDCH answering on the SBA: */ - bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_UL_TBF_CONTENTION_RESOLUTION_SUCCESS); + /* Similarly, it is for sure not using any DL-TBF. We + * still may have some because we were trying to assign a + * DL-TBF over CCCH when the MS proactively requested for a + * UL-TBF. In that case we'll need to re-assigna new DL-TBF through PACCH when contention resolution is done: */ + if ((dl_tbf = ms_dl_tbf(ms))) { + /* Get rid of previous finished UL TBF before providing a new one */ + LOGPTBFDL(dl_tbf, LOGL_NOTICE, + "Got PACKET RESOURCE REQ while DL-TBF pending, killing it\n"); + tbf_free(dl_tbf); + dl_tbf = NULL; + } break; case PDCH_ULC_NODE_TBF_POLL: if (item->tbf_poll.poll_tbf->direction != GPRS_RLCMAC_UL_TBF) { diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index c63af58..cc809da 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -191,7 +191,6 @@ const uint16_t delay_csec, const uint8_t *data, const uint16_t len) { - struct gprs_rlcmac_dl_tbf *dl_tbf = NULL; int rc; GprsMs *ms, *ms_old; @@ -208,20 +207,8 @@ LOGP(DTBF, LOGL_NOTICE, "There is a new MS object for the same MS: (0x%08x, '%s') -> (0x%08x, '%s')\n", ms_tlli(ms_old), ms_imsi(ms_old), ms_tlli(ms), ms_imsi(ms)); - - ms_ref(ms_old); - - if (!ms_dl_tbf(ms) && ms_dl_tbf(ms_old)) { - LOGP(DTBF, LOGL_NOTICE, - "IMSI %s, old TBF %s: moving DL TBF to new MS object\n", - imsi ? : "unknown", ms_dl_tbf(ms_old)->name()); - dl_tbf = ms_dl_tbf(ms_old); - /* Move the DL TBF to the new MS */ - dl_tbf->set_ms(ms); - } ms_merge_and_clear_ms(ms, ms_old); - - ms_unref(ms_old); + /* old_ms may no longer be available here */ } } diff --git a/src/tbf_fsm.c b/src/tbf_fsm.c index b236d27..9ddbd69 100644 --- a/src/tbf_fsm.c +++ b/src/tbf_fsm.c @@ -208,6 +208,7 @@ { struct tbf_fsm_ctx *ctx = (struct tbf_fsm_ctx *)fi->priv; struct GprsMs *ms = tbf_ms(ctx->tbf); + struct gprs_rlcmac_dl_tbf *dl_tbf = NULL; switch (event) { case TBF_EV_FIRST_UL_DATA_RECVD: @@ -217,6 +218,17 @@ * comprises the TLLI value that identifies the mobile station and the * TFI value associated with the TBF." */ bts_pch_timer_stop(ms->bts, ms); + /* We may still have some DL-TBF waiting for assignment in PCH, + * which clearly won't happen since the MS is on PDCH now. Get rid + * of it, it will be re-assigned on PACCH when contention + * resolution at the MS side is done (1st UL ACK/NACK sent) */ + if ((dl_tbf = ms_dl_tbf(ms))) { + /* Get rid of previous finished UL TBF before providing a new one */ + LOGPTBFDL(dl_tbf, LOGL_NOTICE, + "Got first UL data while DL-TBF pending, killing it\n"); + tbf_free(dl_tbf_as_tbf(dl_tbf)); + dl_tbf = NULL; + } break; case TBF_EV_DL_ACKNACK_MISS: OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 27ed39b..1124462 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -2314,10 +2314,10 @@ TBF(TFI=1 TLLI=0xf5667788 DIR=UL STATE=FLOW) No gaps in received block, last block: BSN=0 CV=15 Old MS: TLLI = 0xf1223344, TA = 7, IMSI = 0011223344, LLC = 0 There is a new MS object for the same MS: (0xf1223344, '0011223344') -> (0xf5667788, '') -IMSI 0011223344, old TBF TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED): moving DL TBF to new MS object +MS(TLLI=0xf5667788, IMSI=, TA=7, 1/0, UL) Merge MS: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL DL) +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED) Merge MS: Move DL TBF: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL DL) => MS(TLLI=0xf5667788, IMSI=0011223344, TA=7, 1/0, UL) MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED) -MS(TLLI=0xf5667788, IMSI=, TA=7, 1/0, UL) Attaching DL TBF: TBF(TFI=0 TLLI=0xf5667788 DIR=DL STATE=FINISHED) -MS(TLLI=0xf5667788, IMSI=, TA=7, 1/0, UL DL) Merge MS: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) +MS(TLLI=0xf5667788, IMSI=0011223344, TA=7, 1/0, UL) Attaching DL TBF: TBF(TFI=0 TLLI=0xf5667788 DIR=DL STATE=FINISHED) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) free PDCH(bts=0,trx=0,ts=7) Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW), 2 TBFs, USFs = 03, TFIs = 00000003. MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) @@ -2454,8 +2454,16 @@ PDCH(bts=0,trx=0,ts=7) FN=2654327 +++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++ PDCH(bts=0,trx=0,ts=7) FN=2654327 ------------------------- RX : Uplink Control Block ------------------------- PDCH(bts=0,trx=0,ts=7) FN=2654327 PKT RESOURCE REQ: MS requests UL TBF throguh SBA -MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, DL) ********** UL-TBF starts here ********** -MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, DL) Allocating UL TBF +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Got PACKET RESOURCE REQ while DL-TBF pending, killing it +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) free +PDCH(bts=0,trx=0,ts=7) Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN), 1 TBFs, USFs = 00, TFIs = 00000001. +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) +********** DL-TBF ends here ********** +TBF(DL-TFI_0){ASSIGN}: Deallocated +UL_ASS_TBF(DL-TFI_0){NONE}: Deallocated +DL_ASS_TBF(DL-TFI_0){NONE}: Deallocated +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) ********** UL-TBF starts here ********** +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Allocating UL TBF TBF{NEW}: Allocated UL_ASS_TBF{NONE}: Allocated DL_ASS_TBF{NONE}: Allocated @@ -2472,7 +2480,7 @@ PDCH(bts=0,trx=0,ts=7) Attaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=NEW), 1 TBFs, USFs = 01, TFIs = 00000001. TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=NEW) Setting Control TS 7 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=NEW) Allocated: trx = 0, ul_slots = 80, dl_slots = 00 -MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, DL) Attaching UL TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=NEW) +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Attaching UL TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=NEW) TBF(UL-TFI_0){NEW}: Received Event ASSIGN_ADD_PACCH TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=NEW) set ass. type PACCH [prev CCCH:0, PACCH:0] TBF(UL-TFI_0){NEW}: state_chg to ASSIGN @@ -2497,6 +2505,32 @@ UL_ASS_TBF(UL-TFI_0){WAIT_ACK}: state_chg to NONE TBF(UL-TFI_0){ASSIGN}: Received Event ASSIGN_ACK_PACCH TBF(UL-TFI_0){ASSIGN}: state_chg to FLOW +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) ********** DL-TBF starts here ********** +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) Allocating DL TBF +TBF{NEW}: Allocated +UL_ASS_TBF{NONE}: Allocated +DL_ASS_TBF{NONE}: Allocated +[DL] algo A <multi> (suggested TRX: 0): Alloc start +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +[DL] Assign downlink TS=7 TFI=0 +PDCH(bts=0,trx=0,ts=7) Attaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW), 1 TBFs, USFs = 01, TFIs = 00000001. +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW) Setting Control TS 7 +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW) Allocated: trx = 0, ul_slots = 80, dl_slots = 80 +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) Attaching DL TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW) +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW) [DOWNLINK] START (PACCH) +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW) Send downlink assignment on PACCH, because TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) exists +DL_ASS_TBF(UL-TFI_0){NONE}: Received Event SCHED_ASS +DL_ASS_TBF(UL-TFI_0){NONE}: state_chg to SEND_ASS +TBF(DL-TFI_0){NEW}: Received Event ASSIGN_ADD_PACCH +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NEW) set ass. type PACCH [prev CCCH:0, PACCH:0] +TBF(DL-TFI_0){NEW}: state_chg to ASSIGN +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Starting timer X2001 [assignment (PACCH)] with 2 sec. 0 microsec Detected FN jump! 2654340 -> 2654331 (expected 2654344) PDCH(bts=0,trx=0,ts=7) Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 PDCH(bts=0,trx=0,ts=7) FN=2654331 Rx UL DATA from unexpected TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) @@ -2662,16 +2696,20 @@ Modifying MS object, UL TLLI: 0xffffffff -> 0xf1223344, not yet confirmed MS(TLLI=0xf1223344, IMSI=, TA=7, 0/0, UL) Merge MS: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, DL) Modifying MS object, TLLI = 0xf1223344, MS class 0 -> 1 +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Merge MS: Move DL TBF: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, DL) => MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) Attaching DL TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Clearing MS object +MS(TLLI=0xffffffff, IMSI=, TA=7, 1/0,) Destroying MS object +TBF(UL-TFI_0){FLOW}: Received Event FIRST_UL_DATA_RECVD +TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Got first UL data while DL-TBF pending, killing it TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) free PDCH(bts=0,trx=0,ts=7) Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN), 1 TBFs, USFs = 01, TFIs = 00000001. -MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) +MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) ********** DL-TBF ends here ********** TBF(DL-TFI_0){ASSIGN}: Deallocated UL_ASS_TBF(DL-TFI_0){NONE}: Deallocated DL_ASS_TBF(DL-TFI_0){NONE}: Deallocated -MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Clearing MS object -MS(TLLI=0xffffffff, IMSI=, TA=7, 1/0,) Destroying MS object -TBF(UL-TFI_0){FLOW}: Received Event FIRST_UL_DATA_RECVD TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Frame 1 starts at offset 4, length=16, is_complete=1 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29931 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I29f4ffa904d79d58275c6596cc5ef6790b6e68c6 Gerrit-Change-Number: 29931 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: Rename tbf_alloc_ul_tbf -> ul_tbf_alloc
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29928 ) Change subject: Rename tbf_alloc_ul_tbf -> ul_tbf_alloc ...................................................................... Rename tbf_alloc_ul_tbf -> ul_tbf_alloc Use proper prefix according to the type being allocated. Change-Id: Ic98c3c852c96c3f52f1c8f531b8d0fd28ce5aef5 --- M src/gprs_ms.c M src/tbf_ul.cpp M src/tbf_ul.h M tests/alloc/AllocTest.cpp M tests/tbf/TbfTest.cpp M tests/types/TypesTest.cpp 6 files changed, 13 insertions(+), 13 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/gprs_ms.c b/src/gprs_ms.c index 5bf929e..57d8a19 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -1068,7 +1068,7 @@ const bool single_slot = false; struct gprs_rlcmac_ul_tbf *ul_tbf; - ul_tbf = tbf_alloc_ul_tbf(ms->bts, ms, use_trx, single_slot); + ul_tbf = ul_tbf_alloc(ms->bts, ms, use_trx, single_slot); if (!ul_tbf) { LOGPMS(ms, DTBF, LOGL_NOTICE, "No PDCH resource\n"); /* Caller will most probably send a Imm Ass Reject after return */ @@ -1087,7 +1087,7 @@ const bool single_slot = true; struct gprs_rlcmac_ul_tbf *ul_tbf; - ul_tbf = tbf_alloc_ul_tbf(ms->bts, ms, trx_no, single_slot); + ul_tbf = ul_tbf_alloc(ms->bts, ms, trx_no, single_slot); if (!ul_tbf) { LOGP(DTBF, LOGL_NOTICE, "No PDCH resource for Uplink TBF\n"); /* Caller will most probably send a Imm Ass Reject after return */ diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 6edf8be..07f562a 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -104,7 +104,7 @@ } /* Generic function to alloc a UL TBF, later configured to be assigned either over CCCH or PACCH */ -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, int8_t use_trx, bool single_slot) +struct gprs_rlcmac_ul_tbf *ul_tbf_alloc(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, int8_t use_trx, bool single_slot) { struct gprs_rlcmac_ul_tbf *tbf; int rc; diff --git a/src/tbf_ul.h b/src/tbf_ul.h index 0812b9d..014b167 100644 --- a/src/tbf_ul.h +++ b/src/tbf_ul.h @@ -132,7 +132,7 @@ #ifdef __cplusplus extern "C" { #endif -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, int8_t use_trx, bool single_slot); +struct gprs_rlcmac_ul_tbf *ul_tbf_alloc(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, int8_t use_trx, bool single_slot); void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta); void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta); struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf(struct gprs_rlcmac_tbf *tbf); diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 3426f23..e124b64 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -46,7 +46,7 @@ OSMO_ASSERT(ms != NULL); if (dir == GPRS_RLCMAC_UL_TBF) - return tbf_alloc_ul_tbf(bts, ms, use_trx, single_slot); + return ul_tbf_alloc(bts, ms, use_trx, single_slot); else return dl_tbf_alloc(bts, ms, use_trx, single_slot); } @@ -221,7 +221,7 @@ ms = bts_alloc_ms(bts, ms_class, 0); /* Avoid delaying free to avoid tons of to-be-freed ms objects queuing */ ms_set_timeout(ms, 0); - ul_tbf = tbf_alloc_ul_tbf(bts, ms, -1, true); + ul_tbf = ul_tbf_alloc(bts, ms, -1, true); if (!ul_tbf) return false; @@ -275,7 +275,7 @@ dump_assignment(dl_tbf, "DL", verbose); - ul_tbf = tbf_alloc_ul_tbf(bts, ms, ms_current_trx(ms)->trx_no, false); + ul_tbf = ul_tbf_alloc(bts, ms, ms_current_trx(ms)->trx_no, false); if (!ul_tbf) return false; @@ -318,7 +318,7 @@ ms = bts_alloc_ms(bts, ms_class, 0); /* Avoid delaying free to avoid tons of to-be-freed ms objects queuing */ ms_set_timeout(ms, 0); - ul_tbf = tbf_alloc_ul_tbf(bts, ms, -1, false); + ul_tbf = ul_tbf_alloc(bts, ms, -1, false); if (!ul_tbf) return false; @@ -475,7 +475,7 @@ case TEST_MODE_UL_AND_DL: if (ms_ul_tbf(old_ms)) tbf_free(ms_ul_tbf(old_ms)); - tbf = tbf_alloc_ul_tbf(bts, old_ms, trx_no, false); + tbf = ul_tbf_alloc(bts, old_ms, trx_no, false); if (tbf == NULL) { OSMO_ASSERT(trx_no != -1 || bts_all_pdch_allocated(bts)); ms_unref(old_ms); diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 91d1f07..96fede7 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -131,7 +131,7 @@ OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf); OSMO_ASSERT(dl_tbf->ms() == ms); - gprs_rlcmac_tbf *ul_tbf = tbf_alloc_ul_tbf(bts, + gprs_rlcmac_tbf *ul_tbf = ul_tbf_alloc(bts, ms, 0, false); OSMO_ASSERT(ul_tbf != NULL); ul_tbf->update_ms(0x2342, GPRS_RLCMAC_UL_TBF); diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp index 6b36d6d..1e714e1 100644 --- a/tests/types/TypesTest.cpp +++ b/tests/types/TypesTest.cpp @@ -687,7 +687,7 @@ bts->trx[0].pdch[4].enable(); GprsMs *ms = bts_alloc_ms(bts, 1, 1); - struct gprs_rlcmac_ul_tbf *tbf = tbf_alloc_ul_tbf(bts, ms, 0, true); + struct gprs_rlcmac_ul_tbf *tbf = ul_tbf_alloc(bts, ms, 0, true); struct crbb_test crbb_test = {0}; bitvec *rbb = NULL; unsigned int rbb_size; @@ -804,7 +804,7 @@ bts->trx[0].pdch[5].enable(); GprsMs *ms = bts_alloc_ms(bts, 1, 0); - struct gprs_rlcmac_tbf *tbf = tbf_alloc_ul_tbf(bts, ms, 0, false); + struct gprs_rlcmac_tbf *tbf = ul_tbf_alloc(bts, ms, 0, false); static uint8_t res[] = { 0x06, 0x3f, /* Immediate Assignment Message Type (GSM48_MT_RR_IMM_ASS) */ 0x10, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */ @@ -846,7 +846,7 @@ bts->trx[0].pdch[2].enable(); GprsMs *ms = bts_alloc_ms(bts, 1, 1); - struct gprs_rlcmac_tbf *tbf = tbf_alloc_ul_tbf(bts, ms, 0, false); + struct gprs_rlcmac_tbf *tbf = ul_tbf_alloc(bts, ms, 0, false); static uint8_t res[] = { 0x06, 0x3f, /* Immediate Assignment Message Type (GSM48_MT_RR_IMM_ASS) */ 0x10, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */ 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29928 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ic98c3c852c96c3f52f1c8f531b8d0fd28ce5aef5 Gerrit-Change-Number: 29928 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: Rework tbf::update_ms()
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29846 ) Change subject: Rework tbf::update_ms() ...................................................................... Rework tbf::update_ms() That function was pretty confusing since it used a "enum gprs_rlcmac_tbf_direction dir" param (whose type is expected to describe the data direction of a TBF) to describe the direction of the the packet which triggered its call. The parameter was actually always called with "GPRS_RLCMAC_UL_TBF" which in this case meant "uplink direction" which meant "TLLI was updated from the MS, not the SGSN". The DL direction was only used in unit tests, which can hence be simply replaced by ms_confirm_tlli(), which this commit does. So this update_ms() function was actually used in practice in osmo-pcu to trigger update of TLLI and find duplicates only when an RLCMAC block (control or data) was received from the MS. Therefore, this function is renamed in this patch and moved to the gprs_ms class, since it really does nothing with the TBF. Related: OS#5700 Change-Id: I1b7c0fde15b9bb8a973068994dbe972285ad0aff --- M src/gprs_ms.c M src/gprs_ms.h M src/gprs_ms_storage.cpp M src/gprs_ms_storage.h M src/pdch.cpp M src/tbf.cpp M src/tbf.h M src/tbf_ul.cpp M tests/alloc/AllocTest.cpp M tests/tbf/TbfTest.cpp 10 files changed, 63 insertions(+), 44 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/src/gprs_ms.c b/src/gprs_ms.c index 57d8a19..10d761d 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -24,6 +24,7 @@ #include "pcu_utils.h" #include "nacc_fsm.h" #include "tbf_ul_ack_fsm.h" +#include "gprs_ms_storage.h" #include <time.h> @@ -402,6 +403,32 @@ ms->imsi[0] = '\0'; } +/* This function should be called on the MS object of a TBF each time an RLCMAC + * block is received for it with TLLI information. + * Besides updating the TLLI field on the MS object, it also seeks for other MS + * objects in the store and merges them into the current MS object. The MS + * duplication happened because we don't learn the TLLI of the created TBF until + * a later point. */ +void ms_update_announced_tlli(struct GprsMs *ms, uint32_t tlli) +{ + struct GprsMs *old_ms = NULL; + + if (tlli == GSM_RESERVED_TMSI) + return; + + /* When the TLLI does not match the ms, check if there is another + * MS object that belongs to that TLLI and if yes make sure one of them + * gets deleted. */ + if (!ms_check_tlli(ms, tlli)) + old_ms = ms_store_get_ms(bts_ms_store(ms->bts), tlli, GSM_RESERVED_TMSI, NULL); + + ms_set_tlli(ms, tlli); + + if (old_ms) + ms_merge_and_clear_ms(ms, old_ms); + /* old_ms may no longer be available here */ +} + /* Merge 'old_ms' object into 'ms' object. * 'old_ms' may be freed during the call to this function, don't use the pointer to it afterwards */ void ms_merge_and_clear_ms(struct GprsMs *ms, struct GprsMs *old_ms) diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 53b0cd6..41ef2ad 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -119,6 +119,7 @@ void ms_update_error_rate(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, int error_rate); uint8_t ms_current_pacch_slots(const struct GprsMs *ms); +void ms_update_announced_tlli(struct GprsMs *ms, uint32_t tlli); void ms_merge_and_clear_ms(struct GprsMs *ms, struct GprsMs *old_ms); void ms_attach_tbf(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf); diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp index c9a41c9..e49474f 100644 --- a/src/gprs_ms_storage.cpp +++ b/src/gprs_ms_storage.cpp @@ -109,3 +109,8 @@ return ms; } + +struct GprsMs *ms_store_get_ms(struct GprsMsStorage *ms_store, uint32_t tlli, uint32_t old_tlli, const char *imsi) +{ + return ms_store->get_ms(tlli, old_tlli, imsi); +} diff --git a/src/gprs_ms_storage.h b/src/gprs_ms_storage.h index ef808d0..45238cf 100644 --- a/src/gprs_ms_storage.h +++ b/src/gprs_ms_storage.h @@ -23,6 +23,17 @@ struct gprs_rlcmac_bts; +#ifdef __cplusplus +extern "C" { +#endif +struct GprsMsStorage; +struct GprsMs *ms_store_get_ms(struct GprsMsStorage *ms_store, uint32_t tlli, uint32_t old_tlli, const char *imsi); +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus + struct GprsMsStorage { public: GprsMsStorage(struct gprs_rlcmac_bts *bts); @@ -38,3 +49,5 @@ struct gprs_rlcmac_bts *m_bts; struct llist_head m_list; /* list of struct GprsMs */ }; + +#endif diff --git a/src/pdch.cpp b/src/pdch.cpp index 8dd7597..e979cf0 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -367,8 +367,8 @@ /* Reset N3101 counter: */ tbf->n_reset(N3101); - tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF); - /* Gather MS from TBF, since it may be NULL or may have been merged during update_ms */ + ms_update_announced_tlli(tbf->ms(), tlli); + /* Gather MS from TBF again, since it may be NULL or may have been merged during ms_update_announced_tlli */ ms = tbf->ms(); LOGPTBF(tbf, LOGL_DEBUG, "FN=%" PRIu32 " Rx Packet Control Ack (reason=%s)\n", diff --git a/src/tbf.cpp b/src/tbf.cpp index dfed320..0ba0438 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -213,30 +213,6 @@ ms_attach_tbf(m_ms, this); } -void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir) -{ - GprsMs *old_ms = NULL; - - if (tlli == GSM_RESERVED_TMSI) - return; - - /* TODO: When the TLLI does not match the ms, check if there is another - * MS object that belongs to that TLLI and if yes make sure one of them - * gets deleted. This is the same problem that can arise with - * IMSI in dl_tbf_handle() so there should be a unified solution */ - if (!ms_check_tlli(ms(), tlli)) - old_ms = bts_ms_store(bts)->get_ms(tlli, GSM_RESERVED_TMSI, NULL); - - if (dir == GPRS_RLCMAC_UL_TBF) - ms_set_tlli(ms(), tlli); - else - ms_confirm_tlli(ms(), tlli); - - if (old_ms) - ms_merge_and_clear_ms(ms(), old_ms); - /* old_ms may no longer be available here */ -} - static void tbf_unlink_pdch(struct gprs_rlcmac_tbf *tbf) { int ts; diff --git a/src/tbf.h b/src/tbf.h index 616c3e0..3146ee0 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -200,9 +200,6 @@ uint32_t tlli() const; bool is_tlli_valid() const; - /** MS updating */ - void update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction); - uint8_t tfi() const; bool is_tfi_assigned() const; diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 07f562a..910bfb4 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -397,7 +397,7 @@ LOGPTBFUL(this, LOGL_INFO, "Decoded premier TLLI=0x%08x of UL DATA TFI=%d.\n", new_tlli, rlc->tfi); - update_ms(new_tlli, GPRS_RLCMAC_UL_TBF); + ms_update_announced_tlli(ms(), new_tlli); bts_pch_timer_stop(bts, ms()); } else if (new_tlli != GSM_RESERVED_TMSI && new_tlli != tlli()) { LOGPTBFUL(this, LOGL_NOTICE, diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index e124b64..379e69a 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -269,7 +269,7 @@ if (!dl_tbf) return false; - dl_tbf->update_ms(0x23, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(ms, 0x23); OSMO_ASSERT(dl_tbf->ms() == ms); OSMO_ASSERT(ms_current_trx(dl_tbf->ms())); @@ -279,7 +279,7 @@ if (!ul_tbf) return false; - ul_tbf->update_ms(0x23, GPRS_RLCMAC_UL_TBF); + ms_update_announced_tlli(ms, 0x23); ul_tbf->m_contention_resolution_done = true; dump_assignment(ul_tbf, "UL", verbose); diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 96fede7..60e242c 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -126,7 +126,7 @@ gprs_rlcmac_tbf *dl_tbf = dl_tbf_alloc(bts, ms, 0, false); OSMO_ASSERT(dl_tbf != NULL); - dl_tbf->update_ms(0x2342, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(ms, 0x2342); dl_tbf->set_ta(4); OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf); OSMO_ASSERT(dl_tbf->ms() == ms); @@ -134,7 +134,7 @@ gprs_rlcmac_tbf *ul_tbf = ul_tbf_alloc(bts, ms, 0, false); OSMO_ASSERT(ul_tbf != NULL); - ul_tbf->update_ms(0x2342, GPRS_RLCMAC_UL_TBF); + ms_update_announced_tlli(ms, 0x2342); OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf); OSMO_ASSERT(ul_tbf->ms() == ms); @@ -144,7 +144,7 @@ * Now check.. that DL changes and that the timing advance * has changed. */ - dl_tbf->update_ms(0x4232, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), 0x4232); /* It is still there, since the new TLLI has not been used for UL yet */ ms_new = bts_ms_by_tlli(bts, 0x2342, GSM_RESERVED_TMSI); @@ -156,7 +156,7 @@ OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf); /* Now use the new TLLI for UL */ - ul_tbf->update_ms(0x4232, GPRS_RLCMAC_UL_TBF); + ms_update_announced_tlli(ms, 0x4232); ms_new = bts_ms_by_tlli(bts, 0x2342, GSM_RESERVED_TMSI); OSMO_ASSERT(ms_new == NULL); @@ -305,7 +305,7 @@ setup_bts(bts, ts_no); dl_tbf = create_dl_tbf(bts, ms_class, 0, &trx_no); - dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), tlli); ms = dl_tbf->ms(); for (i = 0; i < sizeof(llc_data); i++) @@ -381,7 +381,7 @@ OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0); dl_tbf = create_dl_tbf(bts, ms_class, 0, &trx_no); - dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), tlli); for (i = 0; i < sizeof(llc_data); i++) llc_data[i] = i%256; @@ -446,8 +446,8 @@ dl_tbf[0] = create_dl_tbf(bts, ms_class, 0, &trx_no); dl_tbf[1] = create_dl_tbf(bts, ms_class, 0, &trx_no); - dl_tbf[0]->update_ms(0xf1000001, GPRS_RLCMAC_DL_TBF); - dl_tbf[1]->update_ms(0xf1000002, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf[0]->ms(), 0xf1000001); + ms_confirm_tlli(dl_tbf[1]->ms(), 0xf1000002); ms_set_imsi(dl_tbf[0]->ms(), "001001000000001"); ms1 = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, "001001000000001"); @@ -2634,7 +2634,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; dl_tbf = create_dl_tbf(bts, ms_class, egprs_ms_class, &trx_no); - dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), tlli); prlcdlwindow = static_cast<gprs_rlc_dl_window *>(dl_tbf->window()); prlcmvb = &prlcdlwindow->m_v_b; prlcdlwindow->m_v_s = 1288; @@ -2767,7 +2767,7 @@ bts->initial_mcs_dl = mcs; dl_tbf = create_dl_tbf(bts, ms_class, egprs_ms_class, &trx_no); - dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), tlli); for (i = 0; i < sizeof(llc_data); i++) llc_data[i] = i%256; @@ -2824,7 +2824,7 @@ bts->initial_mcs_dl = mcs; dl_tbf = create_dl_tbf(bts, ms_class, egprs_ms_class, &trx_no); - dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), tlli); for (i = 0; i < sizeof(test_data); i++) test_data[i] = i%256; @@ -3344,7 +3344,7 @@ setup_bts(bts, 4); static gprs_rlcmac_dl_tbf *dl_tbf = tbf_init(bts, 1); - dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + ms_confirm_tlli(dl_tbf->ms(), tlli); osmo_fsm_inst_dispatch(dl_tbf->ul_ass_fsm.fi, TBF_UL_ASS_EV_SCHED_ASS_REJ, NULL); struct msgb *msg = tbf_ul_ass_create_rlcmac_msg((const struct gprs_rlcmac_tbf*)dl_tbf, 0, 0); -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29846 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I1b7c0fde15b9bb8a973068994dbe972285ad0aff Gerrit-Change-Number: 29846 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: Join ms_merge_and_clear_ms() and ms_merge_old_ms()
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29926 ) Change subject: Join ms_merge_and_clear_ms() and ms_merge_old_ms() ...................................................................... Join ms_merge_and_clear_ms() and ms_merge_old_ms() While at it, improve logging of the merge action Change-Id: I39d9eac159448fc3c3a4db9e1b9c5364e906a78f --- M src/gprs_ms.c M tests/tbf/TbfTest.err 2 files changed, 14 insertions(+), 11 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve diff --git a/src/gprs_ms.c b/src/gprs_ms.c index bf4d08a..f1b0c6a 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -402,9 +402,17 @@ ms->imsi[0] = '\0'; } -static void ms_merge_old_ms(struct GprsMs *ms, struct GprsMs *old_ms) +/* Merge 'old_ms' object into 'ms' object. + * 'old_ms' may be freed during the call to this function, don't use the pointer to it afterwards */ +void ms_merge_and_clear_ms(struct GprsMs *ms, struct GprsMs *old_ms) { + char old_ms_name[128]; OSMO_ASSERT(old_ms != ms); + ms_ref(old_ms); + + ms_name_buf(old_ms, old_ms_name, sizeof(old_ms_name)); + + LOGPMS(ms, DRLCMAC, LOGL_INFO, "Merge MS: %s\n", old_ms_name); if (strlen(ms_imsi(ms)) == 0 && strlen(ms_imsi(old_ms)) != 0) osmo_strlcpy(ms->imsi, ms_imsi(old_ms), sizeof(ms->imsi)); @@ -417,14 +425,6 @@ llc_queue_move_and_merge(&ms->llc_queue, &old_ms->llc_queue); - ms_reset(old_ms); -} - -void ms_merge_and_clear_ms(struct GprsMs *ms, struct GprsMs *old_ms) -{ - OSMO_ASSERT(old_ms != ms); - - ms_ref(old_ms); /* Clean up the old MS object */ /* TODO: Use timer? */ @@ -433,7 +433,7 @@ if (ms_dl_tbf(old_ms) && !tbf_timers_pending((struct gprs_rlcmac_tbf *)ms_dl_tbf(old_ms), T_MAX)) tbf_free((struct gprs_rlcmac_tbf *)ms_dl_tbf(old_ms)); - ms_merge_old_ms(ms, old_ms); + ms_reset(old_ms); ms_unref(old_ms); } diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index fe7b628..6a7ca38 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -617,6 +617,7 @@ Modifying MS object, TLLI = 0xf1000001, IMSI '001001000000001' -> '001001000000002' Modifying MS object, TLLI = 0xf1000002, IMSI '' -> '001001000000002' MS(TLLI=0xf1000002, IMSI=, TA=0, 45/0, DL) IMSI '001001000000002' was already assigned to another MS object: TLLI = 0xf1000001, that IMSI will be removed +MS(TLLI=0xf1000002, IMSI=, TA=0, 45/0, DL) Merge MS: MS(TLLI=0xf1000001, IMSI=001001000000002, TA=0, 45/0, DL) TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW) free PDCH(bts=0,trx=0,ts=4) Detaching TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW), 2 TBFs, USFs = 00, TFIs = 00000003. MS(TLLI=0xf1000001, IMSI=001001000000002, TA=0, 45/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW) @@ -2314,6 +2315,7 @@ IMSI 0011223344, old TBF TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED): moving DL TBF to new MS object MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED) MS(TLLI=0xf5667788, IMSI=, TA=7, 1/0, UL) Attaching DL TBF: TBF(TFI=0 TLLI=0xf5667788 DIR=DL STATE=FINISHED) +MS(TLLI=0xf5667788, IMSI=, TA=7, 1/0, UL DL) Merge MS: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, UL) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) free PDCH(bts=0,trx=0,ts=7) Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW), 2 TBFs, USFs = 03, TFIs = 00000003. MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) @@ -2656,6 +2658,8 @@ TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) data_length=20, data=f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. Modifying MS object, UL TLLI: 0xffffffff -> 0xf1223344, not yet confirmed +MS(TLLI=0xf1223344, IMSI=, TA=7, 0/0, UL) Merge MS: MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0, DL) +Modifying MS object, TLLI = 0xf1223344, MS class 0 -> 1 TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) free PDCH(bts=0,trx=0,ts=7) Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN), 1 TBFs, USFs = 01, TFIs = 00000001. MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) @@ -2663,7 +2667,6 @@ TBF(DL-TFI_0){ASSIGN}: Deallocated UL_ASS_TBF(DL-TFI_0){NONE}: Deallocated DL_ASS_TBF(DL-TFI_0){NONE}: Deallocated -Modifying MS object, TLLI = 0xf1223344, MS class 0 -> 1 MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Clearing MS object MS(TLLI=0xffffffff, IMSI=, TA=7, 1/0,) Destroying MS object TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29926 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I39d9eac159448fc3c3a4db9e1b9c5364e906a78f Gerrit-Change-Number: 29926 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: gprs_ms: Add comment warning the user that a ptr may be freed after c...
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29927 ) Change subject: gprs_ms: Add comment warning the user that a ptr may be freed after call to func ...................................................................... gprs_ms: Add comment warning the user that a ptr may be freed after call to func Change-Id: Ifa3d6b38fca89500ef02c9b972f514ceaf8fe83b --- M src/gprs_ms.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved laforge: Looks good to me, approved diff --git a/src/gprs_ms.c b/src/gprs_ms.c index f1b0c6a..5bf929e 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -527,6 +527,7 @@ imsi, ms_tlli(old_ms)); ms_merge_and_clear_ms(ms, old_ms); + /* old_ms may no longer be available here */ } 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29927 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ifa3d6b38fca89500ef02c9b972f514ceaf8fe83b Gerrit-Change-Number: 29927 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: Move UL allocation&assign functions to gprs_ms.c
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29924 ) Change subject: Move UL allocation&assign functions to gprs_ms.c ...................................................................... Move UL allocation&assign functions to gprs_ms.c Similar structure as what we have with DL-TBF. Change-Id: I256aeede2a2678c9738539fb6ec4db9766fa85e4 --- M src/bts.cpp M src/gprs_ms.c M src/gprs_ms.h M src/pdch.cpp M src/tbf.cpp M src/tbf.h M src/tbf_fsm.c M src/tbf_ul.cpp M src/tbf_ul.h 9 files changed, 69 insertions(+), 54 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/src/bts.cpp b/src/bts.cpp index 2389987..31c2b0a 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -981,7 +981,7 @@ bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_UL_TBF_TWO_PHASE); } else { GprsMs *ms = bts_alloc_ms(bts, 0, chan_req.egprs_mslot_class); - tbf = tbf_alloc_ul_ccch(bts, ms); + tbf = ms_new_ul_tbf_assigned_agch(ms); if (!tbf) { /* Send RR Immediate Assignment Reject */ rc = -EBUSY; diff --git a/src/gprs_ms.c b/src/gprs_ms.c index 90e8289..bf4d08a 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -1056,6 +1056,46 @@ } +/* Alloc a UL TBF to be assigned over PACCH. Called when an MS requests to + * create a new UL TBF during the end of life of a previous UL TBF (or an SBA). + * In summary, this TBF is allocated as a consequence of receiving a "Pkt + * Resource Req" or "Pkt Ctrl Ack" from the MS. + * See TS 44.060 9.3.2.4.2 "Non-extended uplink TBF mode". + */ +struct gprs_rlcmac_ul_tbf *ms_new_ul_tbf_assigned_pacch(struct GprsMs *ms, int8_t use_trx) +{ + const bool single_slot = false; + struct gprs_rlcmac_ul_tbf *ul_tbf; + + ul_tbf = tbf_alloc_ul_tbf(ms->bts, ms, use_trx, single_slot); + if (!ul_tbf) { + LOGPMS(ms, DTBF, LOGL_NOTICE, "No PDCH resource\n"); + /* Caller will most probably send a Imm Ass Reject after return */ + return NULL; + } + osmo_fsm_inst_dispatch(tbf_state_fi(ul_tbf_as_tbf(ul_tbf)), TBF_EV_ASSIGN_ADD_PACCH, NULL); + /* Contention resolution is considered to be done since TLLI is known in MS */ + return ul_tbf; +} + +/* Alloc a UL TBF to be assigned over AGCH. Used by request of a "One phase + * packet access", where MS requested only 1 PDCH TS (TS 44.018 Table 9.1.8.1). */ +struct gprs_rlcmac_ul_tbf *ms_new_ul_tbf_assigned_agch(struct GprsMs *ms) +{ + const int8_t trx_no = -1; + const bool single_slot = true; + struct gprs_rlcmac_ul_tbf *ul_tbf; + + ul_tbf = tbf_alloc_ul_tbf(ms->bts, ms, trx_no, single_slot); + if (!ul_tbf) { + LOGP(DTBF, LOGL_NOTICE, "No PDCH resource for Uplink TBF\n"); + /* Caller will most probably send a Imm Ass Reject after return */ + return NULL; + } + osmo_fsm_inst_dispatch(tbf_state_fi(ul_tbf_as_tbf(ul_tbf)), TBF_EV_ASSIGN_ADD_CCCH, NULL); + return ul_tbf; +} + /* A new DL-TBF is allocated and assigned through PACCH using "tbf". * "tbf" may be either a UL-TBF or a DL-TBF. * Note: This should be called only when MS is reachable, see ms_is_reachable_for_dl_ass(). @@ -1088,7 +1128,6 @@ struct gprs_rlcmac_dl_tbf *dl_tbf; dl_tbf = dl_tbf_alloc(ms->bts, ms, trx_no, single_slot); - if (!dl_tbf) { LOGPMS(ms, DTBF, LOGL_NOTICE, "No PDCH resource\n"); return -EBUSY; diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 8014f26..53b0cd6 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -144,6 +144,8 @@ bool ms_nacc_rts(const struct GprsMs *ms); struct msgb *ms_nacc_create_rlcmac_msg(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t ts); +struct gprs_rlcmac_ul_tbf *ms_new_ul_tbf_assigned_pacch(struct GprsMs *ms, int8_t use_trx); +struct gprs_rlcmac_ul_tbf *ms_new_ul_tbf_assigned_agch(struct GprsMs *ms); int ms_new_dl_tbf_assigned_on_pacch(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf); int ms_new_dl_tbf_assigned_on_pch(struct GprsMs *ms); int ms_append_llc_dl_data(struct GprsMs *ms, uint16_t pdu_delay_csec, const uint8_t *data, uint16_t len); diff --git a/src/pdch.cpp b/src/pdch.cpp index ad521e3..8dd7597 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -119,7 +119,7 @@ bts_do_rate_ctr_inc(bts, CTR_CHANNEL_REQUEST_DESCRIPTION); /* This call will register the new TBF with the MS on success */ - gprs_rlcmac_ul_tbf *ul_tbf = tbf_alloc_ul_pacch(bts, tbf->ms(), tbf->trx->trx_no); + gprs_rlcmac_ul_tbf *ul_tbf = ms_new_ul_tbf_assigned_pacch(tbf->ms(), tbf->trx->trx_no); /* schedule uplink assignment or reject */ if (ul_tbf) { @@ -757,7 +757,7 @@ get_meas(meas, request); ms_update_l1_meas(ms, meas); - ul_tbf = tbf_alloc_ul_pacch(bts, ms, trx_no()); + ul_tbf = ms_new_ul_tbf_assigned_pacch(ms, trx_no()); if (!ul_tbf) { handle_tbf_reject(bts, ms, trx_no(), ts_no); goto return_unref; diff --git a/src/tbf.cpp b/src/tbf.cpp index d855083..58695d2 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -801,6 +801,11 @@ return (enum tbf_fsm_states)tbf->state_fsm.fi->state; } +struct osmo_fsm_inst *tbf_state_fi(const struct gprs_rlcmac_tbf *tbf) +{ + return tbf->state_fsm.fi; +} + struct osmo_fsm_inst *tbf_ul_ass_fi(const struct gprs_rlcmac_tbf *tbf) { return tbf->ul_ass_fsm.fi; diff --git a/src/tbf.h b/src/tbf.h index 65b131e..616c3e0 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -125,6 +125,7 @@ enum tbf_fsm_states tbf_state(const struct gprs_rlcmac_tbf *tbf); struct osmo_fsm_inst *tbf_ul_ass_fi(const struct gprs_rlcmac_tbf *tbf); struct osmo_fsm_inst *tbf_dl_ass_fi(const struct gprs_rlcmac_tbf *tbf); +struct osmo_fsm_inst *tbf_state_fi(const struct gprs_rlcmac_tbf *tbf); enum gprs_rlcmac_tbf_direction tbf_direction(const struct gprs_rlcmac_tbf *tbf); void tbf_set_ms(struct gprs_rlcmac_tbf *tbf, struct GprsMs *ms); struct llist_head *tbf_ms_list(struct gprs_rlcmac_tbf *tbf); diff --git a/src/tbf_fsm.c b/src/tbf_fsm.c index 9118fd7..a8e7886 100644 --- a/src/tbf_fsm.c +++ b/src/tbf_fsm.c @@ -99,8 +99,13 @@ switch (event) { case TBF_EV_ASSIGN_ADD_CCCH: mod_ass_type(ctx, GPRS_RLCMAC_FLAG_CCCH, true); - tbf_fsm_state_chg(fi, tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF ? - TBF_ST_ASSIGN : TBF_ST_FLOW); + if (tbf_direction(ctx->tbf) == GPRS_RLCMAC_UL_TBF) { + struct gprs_rlcmac_ul_tbf *ul_tbf = tbf_as_ul_tbf(ctx->tbf); + tbf_fsm_state_chg(fi, TBF_ST_FLOW); + ul_tbf_contention_resolution_start(ul_tbf); + } else { + tbf_fsm_state_chg(fi, TBF_ST_ASSIGN); + } break; case TBF_EV_ASSIGN_ADD_PACCH: mod_ass_type(ctx, GPRS_RLCMAC_FLAG_PACCH, true); diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 7189b6f..6edf8be 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -104,7 +104,7 @@ } /* Generic function to alloc a UL TBF, later configured to be assigned either over CCCH or PACCH */ -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot) +struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, int8_t use_trx, bool single_slot) { struct gprs_rlcmac_ul_tbf *tbf; int rc; @@ -147,48 +147,6 @@ return tbf; } -/* Alloc a UL TBF to be assigned over PACCH. Called when an MS requests to - * create a new UL TBF during the end of life of a previous UL TBF (or an SBA). - * In summary, this TBF is allocated as a consequence of receiving a "Pkt - * Resource Req" or "Pkt Ctrl Ack" from the MS. - * See TS 44.060 9.3.2.4.2 "Non-extended uplink TBF mode". - */ -gprs_rlcmac_ul_tbf *tbf_alloc_ul_pacch(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx) -{ - struct gprs_rlcmac_ul_tbf *tbf; - - tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, false); - if (!tbf) { - LOGPMS(ms, DTBF, LOGL_NOTICE, "No PDCH resource\n"); - /* Caller will most probably send a Imm Ass Reject after return */ - return NULL; - } - /* Contention resolution is considered to be done since TLLI is known in MS: */ - tbf->m_contention_resolution_done = true; - osmo_fsm_inst_dispatch(tbf->state_fsm.fi, TBF_EV_ASSIGN_ADD_PACCH, NULL); - - return tbf; -} - -/* Alloc a UL TBF to be assigned over CCCH. Used by request of a "One phase - * packet access", where MS requested only 1 PDCH TS (TS 44.018 Table 9.1.8.1). */ -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_ccch(struct gprs_rlcmac_bts *bts, struct GprsMs *ms) -{ - struct gprs_rlcmac_ul_tbf *tbf; - - tbf = tbf_alloc_ul_tbf(bts, ms, -1, true); - if (!tbf) { - LOGP(DTBF, LOGL_NOTICE, "No PDCH resource for Uplink TBF\n"); - /* Caller will most probably send a Imm Ass Reject after return */ - return NULL; - } - osmo_fsm_inst_dispatch(tbf->state_fsm.fi, TBF_EV_ASSIGN_ADD_CCCH, NULL); - tbf->contention_resolution_start(); - OSMO_ASSERT(tbf->ms()); - - return tbf; -} - /* Create a temporary dummy TBF to Tx a ImmAssReject if allocating a new one during * packet resource Request failed. This is similar as tbf_alloc_ul() but without * calling tbf->setup() (in charge of TFI/USF allocation), and reusing resources @@ -237,7 +195,7 @@ gprs_rlcmac_ul_tbf::gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms) : gprs_rlcmac_tbf(bts_, ms, GPRS_RLCMAC_UL_TBF), m_rx_counter(0), - m_contention_resolution_done(false), + m_contention_resolution_done(true), m_ul_gprs_ctrs(NULL), m_ul_egprs_ctrs(NULL) { @@ -311,6 +269,7 @@ * timeout only for one-phase packet access, since two-phase is handled * through SBA structs, which are freed by the PDCH UL Controller if the * single allocated block is lost. */ + m_contention_resolution_done = false; T_START(this, T3141, 3141, "Contention resolution (UL-TBF, CCCH)", true); } void gprs_rlcmac_ul_tbf::contention_resolution_success() @@ -782,6 +741,11 @@ return tbf->ul_ack_fsm.fi; } +void ul_tbf_contention_resolution_start(struct gprs_rlcmac_ul_tbf *tbf) +{ + tbf->contention_resolution_start(); +} + void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf) { return tbf->contention_resolution_success(); diff --git a/src/tbf_ul.h b/src/tbf_ul.h index 59e5d66..0812b9d 100644 --- a/src/tbf_ul.h +++ b/src/tbf_ul.h @@ -121,9 +121,6 @@ return m_window.ws(); } -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot); -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_pacch(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx); -struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_ccch(struct gprs_rlcmac_bts *bts, struct GprsMs *ms); struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts, GprsMs *ms, uint8_t trx_no, uint8_t ts_no); @@ -135,13 +132,15 @@ #ifdef __cplusplus extern "C" { #endif +struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, int8_t use_trx, bool single_slot); void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta); void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta); struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf(struct gprs_rlcmac_tbf *tbf); void tbf_usf_timeout(struct gprs_rlcmac_ul_tbf *tbf); +void ul_tbf_contention_resolution_start(struct gprs_rlcmac_ul_tbf *tbf); +void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf); bool ul_tbf_contention_resolution_done(const struct gprs_rlcmac_ul_tbf *tbf); struct osmo_fsm_inst *tbf_ul_ack_fi(const struct gprs_rlcmac_ul_tbf *tbf); -void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf); static inline struct gprs_rlcmac_tbf *ul_tbf_as_tbf(struct gprs_rlcmac_ul_tbf *ul_tbf) { -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29924 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I256aeede2a2678c9738539fb6ec4db9766fa85e4 Gerrit-Change-Number: 29924 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-pcu[master]: update_ms(): Set TLLI of new MS object before merge with old MS
by pespin 03 Nov '22

03 Nov '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29925 ) Change subject: update_ms(): Set TLLI of new MS object before merge with old MS ...................................................................... update_ms(): Set TLLI of new MS object before merge with old MS This way it becomes clearer in logs that we are merging MS which contains the same TLLI. Change-Id: Ifd232daa4219e1726c30449d647312a3a226a61d --- M src/tbf.cpp M tests/tbf/TbfTest.err 2 files changed, 9 insertions(+), 8 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve diff --git a/src/tbf.cpp b/src/tbf.cpp index 58695d2..dfed320 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -215,6 +215,8 @@ void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir) { + GprsMs *old_ms = NULL; + if (tlli == GSM_RESERVED_TMSI) return; @@ -222,18 +224,17 @@ * MS object that belongs to that TLLI and if yes make sure one of them * gets deleted. This is the same problem that can arise with * IMSI in dl_tbf_handle() so there should be a unified solution */ - if (!ms_check_tlli(ms(), tlli)) { - GprsMs *old_ms; - + if (!ms_check_tlli(ms(), tlli)) old_ms = bts_ms_store(bts)->get_ms(tlli, GSM_RESERVED_TMSI, NULL); - if (old_ms) - ms_merge_and_clear_ms(ms(), old_ms); - } if (dir == GPRS_RLCMAC_UL_TBF) ms_set_tlli(ms(), tlli); else ms_confirm_tlli(ms(), tlli); + + if (old_ms) + ms_merge_and_clear_ms(ms(), old_ms); + /* old_ms may no longer be available here */ } static void tbf_unlink_pdch(struct gprs_rlcmac_tbf *tbf) diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index bde7940..fe7b628 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -2655,6 +2655,7 @@ TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) BSN 0 storing in window (0..63) TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) data_length=20, data=f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 TBF(TFI=0 TLLI=0xffffffff DIR=UL STATE=FLOW) Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. +Modifying MS object, UL TLLI: 0xffffffff -> 0xf1223344, not yet confirmed TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) free PDCH(bts=0,trx=0,ts=7) Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN), 1 TBFs, USFs = 01, TFIs = 00000001. MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Detaching TBF: TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) @@ -2662,10 +2663,9 @@ TBF(DL-TFI_0){ASSIGN}: Deallocated UL_ASS_TBF(DL-TFI_0){NONE}: Deallocated DL_ASS_TBF(DL-TFI_0){NONE}: Deallocated -Modifying MS object, TLLI = 0xffffffff, MS class 0 -> 1 +Modifying MS object, TLLI = 0xf1223344, MS class 0 -> 1 MS(TLLI=0xf1223344, IMSI=0011223344, TA=7, 1/0,) Clearing MS object MS(TLLI=0xffffffff, IMSI=, TA=7, 1/0,) Destroying MS object -Modifying MS object, UL TLLI: 0xffffffff -> 0xf1223344, not yet confirmed TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Frame 1 starts at offset 4, length=16, is_complete=1 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29925 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ifd232daa4219e1726c30449d647312a3a226a61d Gerrit-Change-Number: 29925 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • ...
  • 251
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.