Attention is currently required from: fixeria.
pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39394?usp=email )
Change subject: erab_fsm: add more logging to clarify timeout events
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39394?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Iad64ce88e747951c0699074d95d504ccf9f61603
Gerrit-Change-Number: 39394
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 22 Jan 2025 12:30:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria.
pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39393?usp=email )
Change subject: erab_fsm: fix copy-paste in a log message
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39393?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I50f78ac99ddb82244107ff9847acec64d2e9fce1
Gerrit-Change-Number: 39393
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 22 Jan 2025 12:29:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/39395?usp=email )
Change subject: ipa: Split msgb generation into its own helper function
......................................................................
ipa: Split msgb generation into its own helper function
This allows having a clearer picture when comparing against other
protocol stacks like M3UA and SUA, since both have a sua_to_msg() and
m3ua_to_msg() functions (which in turn call xua_to_msg()).
This way ipa_tx_xua_as() also becomes much more similar to
m3ua_tx_xua_as() and sua_tx_xua_as().
Change-Id: Ic0a405ab4d1811efea137167dcb08c9308a4d7e7
---
M src/ipa.c
1 file changed, 23 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/95/39395/1
diff --git a/src/ipa.c b/src/ipa.c
index d62d710..59dfa68 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -52,12 +52,7 @@
#include "ss7_internal.h"
#include "xua_asp_fsm.h"
-
-/*! \brief Send a given xUA message via a given IPA "Application Server"
- * \param[in] as Application Server through which to send \a xua
- * \param[in] xua xUA message to be sent
- * \return 0 on success; negative on error */
-int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
+static struct msgb *ipa_to_msg(struct xua_msg *xua)
{
struct xua_msg_part *data_ie;
struct m3ua_data_hdr *data_hdr;
@@ -66,18 +61,16 @@
const uint8_t *src;
uint8_t *dst;
- OSMO_ASSERT(as->cfg.proto == OSMO_SS7_ASP_PROT_IPA);
-
/* we're actually only interested in the data part */
data_ie = xua_msg_find_tag(xua, M3UA_IEI_PROT_DATA);
if (!data_ie || data_ie->len < sizeof(struct m3ua_data_hdr))
- return -1;
+ return NULL;
data_hdr = (struct m3ua_data_hdr *) data_ie->dat;
if (data_hdr->si != MTP_SI_SCCP) {
- LOGPAS(as, DLSS7, LOGL_ERROR, "Cannot transmit non-SCCP SI (%u) to IPA peer\n",
- data_hdr->si);
- return -1;
+ LOGP(DLSS7, LOGL_ERROR, "Cannot transmit non-SCCP SI (%u) to IPA peer\n",
+ data_hdr->si);
+ return NULL;
}
/* and even the data part still has the header prepended */
@@ -87,7 +80,7 @@
/* sufficient headroom for osmo_ipa_msg_push_header() */
msg = ipa_msg_alloc(16);
if (!msg)
- return -1;
+ return NULL;
dst = msgb_put(msg, src_len);
memcpy(dst, src, src_len);
@@ -95,6 +88,23 @@
/* TODO: if we ever need something beyond SCCP, we can use the
* M3UA SIO to determine the protocol */
osmo_ipa_msg_push_header(msg, IPAC_PROTO_SCCP);
+ return msg;
+}
+
+/*! \brief Send a given xUA message via a given IPA "Application Server"
+ * \param[in] as Application Server through which to send \a xua
+ * \param[in] xua xUA message to be sent
+ * \return 0 on success; negative on error */
+int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
+{
+ struct msgb *msg = ipa_to_msg(xua);
+
+ OSMO_ASSERT(as->cfg.proto == OSMO_SS7_ASP_PROT_IPA);
+
+ if (!msg) {
+ LOGPAS(as, DLSS7, LOGL_ERROR, "Error encoding IPA Msg\n");
+ return -1;
+ }
return xua_as_transmit_msg(as, msg);
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/39395?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ic0a405ab4d1811efea137167dcb08c9308a4d7e7
Gerrit-Change-Number: 39395
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/39392?usp=email )
Change subject: trx_toolkit/clck_gen: Fix clock generator to emit ticks with exactly GSM frame period
......................................................................
trx_toolkit/clck_gen: Fix clock generator to emit ticks with exactly GSM frame period
Since fake_trx beginning in 3187c8e6 (target/fake_trx: initial release
of virtual transceiver) CLCKGen was tuned to emitting ticks with sleep
period being time of 1 GSM frame _decreased_ a bit by "Average loop back
delay". The idea for this decrease probably was to compensate the time
spent in each tick handler, so that combined sleep + tick work would
occupy time of 1 GSM frame more or less.
The idea of using hardcoded compensation turned out to be not very good,
because for the overall tick period to be exactly as defined the
compensation should be dynamic and take into account time spent in each
tick handler. For example on one machine "loopback delay" is one value,
while on another it will be another value. And if we attach more work to
tick handler, like it already happened with adding tx queue, the
compensation needs to take all that into account as well.
abc63d8d (trx_toolkit/clck_gen.py: Fix clock generator not to accumulate
timing error) explains the problem in detail and adds dynamic
compensation so that the tick period stays as defined instead of
drifting. But it missed to adjust CLCKgen to stop decreasing desired
tick period a bit by "average loop back delay".
So after that patch, because CLCKgen now follows desired period without
drifting, its period was 4.615ms - 0.09ms instead of exact 4.615ms,
which resulted in e.g. fake_trx and bts-trx clocks to become constantly
dissynchronized with the following emitted by bts-trx non-stop:
20250122135431420 <0006> scheduler_trx.c:576 GSM clock skew: old fn=0, new fn=102
20250122135431882 <0006> scheduler_trx.c:604 We were 3 FN slower than TRX, compensated
20250122135432344 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135432805 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135433267 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135433728 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135434190 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135434651 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135435113 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135435575 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135436036 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135436498 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135436959 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
20250122135437421 <0006> scheduler_trx.c:604 We were 2 FN slower than TRX, compensated
...
What happens here is that there are ~ 216 GSM frames every second, and
since fake_trx drifts by 0.09ms every frame, it results in drifting by ~
20ms every second. Which results in "2 FN slower than TRX" emitted
approximately twice per second as above log excerpt confirms.
-> Fix this by adjusting CLCKgen to emit ticks with exactly GSM frame
period by default.
Change-Id: Ie12fbe8138bac1398805fa270b869e7a333fcba0
---
M src/target/trx_toolkit/clck_gen.py
M src/target/trx_toolkit/test_clck_gen.py
2 files changed, 6 insertions(+), 4 deletions(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/src/target/trx_toolkit/clck_gen.py b/src/target/trx_toolkit/clck_gen.py
index bf56f64..c6da8f6 100755
--- a/src/target/trx_toolkit/clck_gen.py
+++ b/src/target/trx_toolkit/clck_gen.py
@@ -34,9 +34,6 @@
SEC_DELAY_US = 1000 * 1000
GSM_FRAME_US = 4615.0
- # Average loop back delay
- LO_DELAY_US = 90.0
-
def __init__(self, clck_links, clck_start = 0, ind_period = 102):
# This event is needed to control the thread
self._breaker = threading.Event()
@@ -47,7 +44,7 @@
self.clck_start = clck_start
# Calculate counter time
- self.ctr_interval = self.GSM_FRAME_US - self.LO_DELAY_US
+ self.ctr_interval = self.GSM_FRAME_US
self.ctr_interval /= self.SEC_DELAY_US
# (Optional) clock consumer
diff --git a/src/target/trx_toolkit/test_clck_gen.py b/src/target/trx_toolkit/test_clck_gen.py
index a920ce1..92e5e55 100644
--- a/src/target/trx_toolkit/test_clck_gen.py
+++ b/src/target/trx_toolkit/test_clck_gen.py
@@ -63,6 +63,11 @@
finally:
clck.stop()
+ # verify that default tick interval is 1 TDMA frame exactly
+ def test_period_is_gsm_frame(self):
+ clck = clck_gen.CLCKGen([])
+ self.assertEqual(clck.ctr_interval, 4.615e-3)
+
if __name__ == '__main__':
unittest.main()
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/39392?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie12fbe8138bac1398805fa270b869e7a333fcba0
Gerrit-Change-Number: 39392
Gerrit-PatchSet: 1
Gerrit-Owner: kirr <kirr(a)nexedi.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: osmith <osmith(a)sysmocom.de>