Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32358 )
Change subject: ms: Make ms_{attach,detach}_tbf expectancies more robust
......................................................................
Patch Set 3:
(1 comment)
File src/gprs_ms.c:
https://gerrit.osmocom.org/c/osmo-pcu/+/32358/comment/57032609_ce0f64e1
PS2, Line 355: OSMO_ASSERT(ms);
> Not that I wanted to block you here... […]
Yeah but there isn't. Moreover this provides useful information at runtime if some code path is not acting properly.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32358
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia18fe2de1fb3bf72f530157e5f30de64f2b11e12
Gerrit-Change-Number: 32358
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 20 Apr 2023 20:18:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: laforge, pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-sccp/+/32320
to look at the new patch set (#2).
Change subject: sccp_scoc.c: fix infinite loop on conn ID exhaustion
......................................................................
sccp_scoc.c: fix infinite loop on conn ID exhaustion
Looking for an unused SCCP connection ID has no exit condition if all
connection IDs are in use. However unlikely it is that there are
16777215 active connections on one SCCP instance, add an exit condition.
Do so by implementing the ID lookup in a new separate function, which
qualifies for public API (upcoming patch).
So far, use an exit condition closest to previous behavior: iterate the
entire SCCP conn id number space before exiting in failure.
Change-Id: Ib64e0cb1ae0cc8b7bebcb2a352d4068b496b304a
---
M src/sccp_scoc.c
1 file changed, 41 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/20/32320/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32320
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib64e0cb1ae0cc8b7bebcb2a352d4068b496b304a
Gerrit-Change-Number: 32320
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: neels.
Hello Jenkins Builder, laforge, msuraev,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-sccp/+/32321
to look at the new patch set (#2).
Change subject: add public API: osmo_sccp_instance_next_conn_id()
......................................................................
add public API: osmo_sccp_instance_next_conn_id()
In struct osmo_sccp_instance, we have a next_id, to find an unused SCCP
connection ID. This is used for inbound SCCP connections.
At the same time, in each of our SCCP client programs, we have a
separate mechanism to find a connection ID for outbound connections.
See for example bsc_sccp.c: bsc_sccp_inst_next_conn_id()
It makes much more sense for callers to use the same
osmo_sccp_instance->next_id counter:
- Currently the inbound and outbound counters go out of sync: For
example, in osmo-bsc, if we have three MS doing a usual Complete Layer
3, osmo-bsc's counter increments by three. If we then have one
Handover Required coming back from the MSC, i.e. inbound SCCP
connection, the sccp_inst->next_id is behind by three, and will
iterate SCCP connections three times before finding an unused id.
- Each implementation has to take care to properly wrap the ID in its
valid range, e.g. in osmo-bsc:
test_id = (test_id + 1) & 0x00FFFFFF;
if (OSMO_UNLIKELY(test_id == 0x00FFFFFF))
test_id = 0;
Add public API so that callers can benefit from the internal
osmo_sccp_instance->next_id and do not need to duplicate the code for
staying within the proper range.
Change-Id: If59d524fbe1088a59ae1b69908e2d4bf67113439
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_scoc.c
2 files changed, 41 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/21/32321/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32321
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: If59d524fbe1088a59ae1b69908e2d4bf67113439
Gerrit-Change-Number: 32321
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32358 )
Change subject: ms: Make ms_{attach,detach}_tbf expectancies more robust
......................................................................
Patch Set 3:
(2 comments)
File src/gprs_ms.c:
https://gerrit.osmocom.org/c/osmo-pcu/+/32358/comment/5d534d4c_59b4232f
PS2, Line 355: OSMO_ASSERT(ms);
> it's not really the same. […]
Not that I wanted to block you here... But looking at the function signature, I would never assume that any of the pointer arguments are optional and can legally/intentionally be NULL here. I wish there was some kind of notation in C to express that some pointer can/shall never be NULL (or vice versa).
https://gerrit.osmocom.org/c/osmo-pcu/+/32358/comment/391932ff_d6f6550a
PS2, Line 419: OSMO_ASSERT(tbf_ms(tbf) == ms);
> I can add an OSMO_ASSERT(tbf) there if you want, but it's clear here that it is expected to be not N […]
No no no, no more asserts please.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32358
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia18fe2de1fb3bf72f530157e5f30de64f2b11e12
Gerrit-Change-Number: 32358
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 20 Apr 2023 18:57:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32346 )
Change subject: ms: store in bts->ms_list during alloc/destroy of ms object
......................................................................
ms: store in bts->ms_list during alloc/destroy of ms object
With this change the MS no longer is removed from the llist without
potentially skipping free() if not idle in bts_ms_idle_cb().
As a result, some unit tests now can free it during bts tear down
instead of having them leaked.
The tests int MsTest need changes because the tbfs created are fake and
cannot be freed using tbf_free(), and hence cannot be detached from MS
using regular code paths. Instead first call explicit talloc_free(ms)
like other unit tests in the file already do.
Change-Id: Id53f8dfb9963366dd4b19a324615bbc83c4f23e7
---
M src/bts.cpp
M src/gprs_ms.c
M tests/ms/MsTest.cpp
M tests/ms/MsTest.err
M tests/ulc/PdchUlcTest.err
5 files changed, 33 insertions(+), 4 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/src/bts.cpp b/src/bts.cpp
index 84eea08..3b27676 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -244,7 +244,6 @@
while ((ms = llist_first_entry_or_null(&bts->ms_list, struct GprsMs, list))) {
ms_set_callback(ms, NULL);
ms_set_timeout(ms, 0);
- llist_del(&ms->list);
bts_stat_item_dec(bts, STAT_MS_PRESENT);
talloc_free(ms);
}
@@ -1201,7 +1200,6 @@
static void bts_ms_idle_cb(struct GprsMs *ms)
{
- llist_del(&ms->list);
bts_stat_item_dec(ms->bts, STAT_MS_PRESENT);
if (ms_is_idle(ms))
talloc_free(ms);
@@ -1225,7 +1223,6 @@
ms_set_callback(ms, &bts_ms_cb);
ms_set_timeout(ms, osmo_tdef_get(bts->pcu->T_defs, -2030, OSMO_TDEF_S, -1));
- llist_add(&ms->list, &bts->ms_list);
bts_stat_item_inc(bts, STAT_MS_PRESENT);
return ms;
diff --git a/src/gprs_ms.c b/src/gprs_ms.c
index 7ee697e..3e95103 100644
--- a/src/gprs_ms.c
+++ b/src/gprs_ms.c
@@ -110,6 +110,8 @@
talloc_set_destructor(ms, ms_talloc_destructor);
+ llist_add(&ms->list, &bts->ms_list);
+
ms->bts = bts;
ms->cb = gprs_default_cb;
ms->tlli = GSM_RESERVED_TMSI;
@@ -119,7 +121,6 @@
ms->current_cs_ul = UNKNOWN;
ms->current_cs_dl = UNKNOWN;
ms->is_idle = true;
- INIT_LLIST_HEAD(&ms->list);
INIT_LLIST_HEAD(&ms->old_tbfs);
int codel_interval = LLC_CODEL_USE_DEFAULT;
@@ -158,6 +159,8 @@
LOGPMS(ms, DRLCMAC, LOGL_INFO, "Destroying MS object\n");
+ llist_del(&ms->list);
+
ms_set_reserved_slots(ms, NULL, 0, 0);
osmo_timer_del(&ms->timer);
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index 45051d4..84cb52e 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -457,6 +457,7 @@
ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms == NULL);
+ talloc_free(ms);
talloc_free(ul_tbf);
talloc_free(bts);
printf("=== end %s ===\n", __func__);
@@ -548,6 +549,7 @@
OSMO_ASSERT(mcs_chan_code(ms_current_cs_dl(ms, ms_mode(ms))) == 2);
+ talloc_free(ms);
talloc_free(dl_tbf);
talloc_free(bts);
printf("=== end %s ===\n", __func__);
@@ -617,6 +619,8 @@
ms_set_mode(ms2, GPRS);
dump_ms(ms2, "2: after mode set ");
+ talloc_free(ms1);
+ talloc_free(ms2);
talloc_free(dl_tbf);
talloc_free(bts);
printf("=== end %s ===\n", __func__);
diff --git a/tests/ms/MsTest.err b/tests/ms/MsTest.err
index 218ae59..d667740 100644
--- a/tests/ms/MsTest.err
+++ b/tests/ms/MsTest.err
@@ -61,8 +61,13 @@
Creating MS object
The MS object cannot fully confirm an unexpected TLLI: 0xffeeddbb, partly confirmed
MS(TLLI-0xffeeddbb:TA-220:MSCLS-0-0) Attaching DL TBF: TBF(DL:STATE-NEW:GPRS:TLLI-0xffeeddbb)
+MS(TLLI-0xffeeddbb:TA-220:MSCLS-0-0:DL) Destroying MS object
+MS(TLLI-0xffeeddbb:TA-220:MSCLS-0-0) Detaching TBF: TBF(DL:STATE-NEW:GPRS:TLLI-0xffeeddbb)
Creating MS object
The MS object cannot fully confirm an unexpected TLLI: 0xdeadbeef, partly confirmed
Creating MS object
The MS object cannot fully confirm an unexpected TLLI: 0xdeadbef0, partly confirmed
MS(TLLI-0xdeadbef0:TA-220:MSCLS-0-0) Attaching DL TBF: TBF(DL:STATE-NEW:GPRS:TLLI-0xdeadbef0)
+MS(TLLI-0xdeadbeef:TA-220:MSCLS-0-0) Destroying MS object
+MS(TLLI-0xdeadbef0:TA-220:MSCLS-0-0:DL) Destroying MS object
+MS(TLLI-0xdeadbef0:TA-220:MSCLS-0-0) Detaching TBF: TBF(DL:STATE-NEW:GPRS:TLLI-0xdeadbef0)
diff --git a/tests/ulc/PdchUlcTest.err b/tests/ulc/PdchUlcTest.err
index a2ec373..41aa9b4 100644
--- a/tests/ulc/PdchUlcTest.err
+++ b/tests/ulc/PdchUlcTest.err
@@ -72,6 +72,8 @@
PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=34, reason=UL_ASS): TBF(DL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0x12345678)
PDCH(bts=0,trx=0,ts=0) Expiring FN=43 but previous FN=39 is still reserved!
PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=39, reason=UL_ASS): TBF(DL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0x12345678)
+MS(TLLI-0x12345678:TA-220:MSCLS-0-0:DL) Destroying MS object
+MS(TLLI-0x12345678:TA-220:MSCLS-0-0) Detaching TBF: TBF(DL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0x12345678)
PDCH(bts=0,trx=0,ts=0) PDCH state: disabled => enabled
PDCH(bts=0,trx=0,ts=0) Reserving FN 104 for type SBA
PDCH(bts=0,trx=0,ts=0) Reserving FN 117 for type SBA
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32346
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Id53f8dfb9963366dd4b19a324615bbc83c4f23e7
Gerrit-Change-Number: 32346
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged