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

September 2026

  • 1 participants
  • 1894 discussions
[M] Change in osmo-ci[master]: OBS: fix wrong .tarball-version after release
by osmith 21 Sep '26

21 Sep '26
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/43678?usp=email ) Change subject: OBS: fix wrong .tarball-version after release ...................................................................... OBS: fix wrong .tarball-version after release Fix that projects can have a wrong .tarball-version in this scenario: * "Bump version" commit is merged to master. * Osmocom_OBS_master job runs before the tag is pushed. I have already added logic that ensures debian/changelog stays on the bumped version even if the tag is missing. But the tarball-version would still be wrong in this case (e.g. 1.8.0.6-2b92 instead of 1.9.0), which then leads to wrong pkg-config versions. Packages depending on the one with the wrong version can then fail to build: Package dependency requirement 'libosmo-ranap >= 1.8.1' could not be satisfied. Package 'libosmo-ranap' has version '1.8.0.6-2b92', required version is '>= 1.8.1' Fix this by calculating the proper version once beforehand, based on the debian/changelog and git-based versions, and then using it to write the .tarball-version and writing back to debian/changelog if necessary. Related: OS#6173 Change-Id: I2ae46fa77818bdee0287694cc5de6f9277cd0c91 --- M scripts/obs/lib/debian.py M scripts/obs/lib/srcpkg.py A tests/test_obs_srcpkg.py 3 files changed, 132 insertions(+), 51 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/scripts/obs/lib/debian.py b/scripts/obs/lib/debian.py index b9e6779..f3b18ec 100644 --- a/scripts/obs/lib/debian.py +++ b/scripts/obs/lib/debian.py @@ -1,20 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# Copyright 2022 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> +# Copyright 2026 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> import datetime import os import shlex import lib import lib.git -# Imports that may not be available during startup, ignore it here and rely on -# lib.check_required_programs() checking this later on (possibly after the -# script executed itself in docker if using --docker). -try: - import packaging.version -except ImportError: - pass - def control_add_depend(project, pkgname, version): """:param pkgname: of the meta-package to depend on (e.g. osmocom-nightly) @@ -108,27 +100,11 @@ the given version.""" version_changelog = get_last_version_from_changelog(project) - # Don't use a lower number (OS#6173) - try: - if packaging.version.parse(version_changelog.split("-")[0]) > packaging.version.parse(version.split("-")[0]): - print( - f"{project}: WARNING: version from changelog ({version_changelog}) is higher than version based on git tag ({version})" - ) - if lib.args.version_append: - print(f"{project}: WARNING: assuming commit from last git tag was amended, ignoring...") - else: - print(f"{project}: WARNING: using version from changelog (git tag not pushed yet?)") - return - except packaging.version.InvalidVersion: - # packaging.version.parse can parse the version numbers used in Osmocom - # projects (where we need the above check), but not e.g. some versions - # from wireshark. Don't abort here if that is the case. - pass - # Debian versions must start with a digit version = transform_version(version) if version_changelog == version: + print(f"{project}: adding debian/changelog entry is unnecessary") return print(f"{project}: adding debian/changelog entry ({version_changelog} => {version})") diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py index 40c1883..8743939 100644 --- a/scripts/obs/lib/srcpkg.py +++ b/scripts/obs/lib/srcpkg.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# Copyright 2022 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> +# Copyright 2026 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> import glob import os import pathlib @@ -8,6 +8,14 @@ import lib.debian import lib.rpm_spec +# Imports that may not be available during startup, ignore it here and rely on +# lib.check_required_programs() checking this later on (possibly after the +# script executed itself in docker if using --docker). +try: + import packaging.version +except ImportError: + pass + def checkout_for_feed(project): """checkout a commit, either latest tag or master or 20YY branch""" @@ -97,14 +105,8 @@ return ret[1:] if ret.startswith("v") else ret ret = get_git_version(project) - - # Try to get the last version from the debian/changelog if we can't get - # it with git-version-gen, like it was done in the previous OBS scripts if ret == "UNKNOWN": - ret = lib.debian.get_last_version_from_changelog(project) - # cut off epoch, we retrieve it separately in get_epoch() below - if ":" in ret: - ret = ret.split(":")[1] + return None # Caller will use version from debian/changelog instead # Nightly: add a ".0" after the version if the current commit is on a # version tag, so the next version is higher (OS#6981) @@ -121,21 +123,57 @@ return ret -def get_epoch(project): - """The osmo-gbproxy used to have the same package version as osmo-sgsn - until 2021 where it was split into its own git repository. From then on, - osmo-gbproxy has a 0.*.* package version, which is smaller than the - previous 1.*.* from osmo-sgsn. We had to set the epoch to 1 for - osmo-gbproxy so package managers know these 0.*.* versions are higher than - the previous 1.*.* ones that are still found in e.g. debian 11. The epoch - is set in debian/changelog, retrieve it from there. - :returns: the epoch number if set, e.g. "1" or an empty string""" +def get_version_epoch(project): + version_append = lib.args.version_append + version = None + epoch = None + + # Start with version and epoch from debian/changelog version_epoch = lib.debian.get_last_version_from_changelog(project) - if ":" in version_epoch: - return version_epoch.split(":")[0] + epoch, version = version_epoch.split(":", 1) + else: + version = version_epoch - return "" + # Use git-based version if it is higher + version_git = get_version_for_feed(project) + use_git_version = False + if version_git: + use_git_version = True + try: + if packaging.version.parse(version) > packaging.version.parse(version_git.split("-")[0]): + print( + f"{project}: WARNING: version from changelog ({version}) is higher than version based on git tag ({version_git})" + ) + if version_append: + print(f"{project}: WARNING: assuming commit from last git tag was amended, ignoring...") + else: + print(f"{project}: WARNING: using version from changelog (git tag not pushed yet?)") + use_git_version = False + except packaging.version.InvalidVersion: + # packaging.version.parse can parse the version numbers used in + # Osmocom projects (where we need the above check), but not e.g. + # some versions from wireshark. Don't abort here in that case. + print(f"{project}: WARNING: couldn't parse versions (dch: {version}, git: {version_git})") + + else: + print(f"{project}: WARNING: couldn't generate a git-based version") + + if use_git_version: + version = version_git + + if version_append: + version += version_append + + if use_git_version: + print(f"{project}: using git-based version ({version})") + else: + print(f"{project}: using version based on debian/changelog ({version})") + + if epoch: + print(f"{project}: retrieved epoch ({epoch}) from debian/changelog") + + return (version, epoch) def prepare_project_open5gs(): @@ -179,6 +217,7 @@ def write_tarball_version(project, version): repo_path = lib.git.get_repo_path(project) + print(f"{project}: writing .tarball-version: {version}") with open(f"{repo_path}/.tarball-version", "w") as f: f.write(f"{version}\n") @@ -222,7 +261,6 @@ def build(project, gerrit_id=0): conflict_version = lib.args.conflict_version feed = lib.args.feed - version_append = lib.args.version_append lib.git.clone(project) lib.git.clean(project) @@ -231,10 +269,7 @@ else: checkout_for_feed(project) - version = get_version_for_feed(project) - if version_append: - version += version_append - epoch = get_epoch(project) + version, epoch = get_version_epoch(project) version_epoch = f"{epoch}:{version}" if epoch else version has_rpm_spec = lib.rpm_spec.get_spec_in_path(project) is not None diff --git a/tests/test_obs_srcpkg.py b/tests/test_obs_srcpkg.py new file mode 100644 index 0000000..a1bf357 --- /dev/null +++ b/tests/test_obs_srcpkg.py @@ -0,0 +1,70 @@ +import argparse +import os +import sys + +sys.path.append(os.path.realpath(os.path.dirname(__file__) + "/../scripts/obs")) + +import lib.srcpkg + + +def test_obs_srcpkg_get_version_epoch(monkeypatch): + # Mock args + parser = argparse.ArgumentParser() + parser.add_argument("--version-append") + monkeypatch.setattr(sys, "argv", ["test"]) + monkeypatch.setattr(lib, "args", parser.parse_args()) + + # Mock functions for getting version from debian changelog / git + version_changelog = None + version_for_feed = None + + def get_last_version_from_changelog(project): + return version_changelog + + def get_version_for_feed(project): + return version_for_feed + + monkeypatch.setattr(lib.debian, "get_last_version_from_changelog", get_last_version_from_changelog) + monkeypatch.setattr(lib.srcpkg, "get_version_for_feed", get_version_for_feed) + + # + # Run get_version_epoch() (prints are for "pytest -s") + # + + print("\n*** changelog > git version") + func = lib.srcpkg.get_version_epoch + project = "osmo-iuh" + version_changelog = "1.8.1" + version_for_feed = "1.8.0.6-2b92" + assert ("1.8.1", None) == func(project) + + print("\n*** changelog > git version + epoch in changelog") + project = "osmo-gbproxy" + version_changelog = "1:0.5.2" + version_for_feed = "0.5.1.1-422ff" + assert ("0.5.2", "1") == func(project) + + print("\n*** changelog < git version") + project = "osmo-iuh" + version_changelog = "1.8.0" + version_for_feed = "1.8.0.6-2b92" + assert ("1.8.0.6-2b92", None) == func(project) + + print("\n*** unknown git version") + project = "test" + version_changelog = "1.8.0" + version_for_feed = None + assert ("1.8.0", None) == func(project) + + print("\n*** invalid changelog version") + project = "test" + version_changelog = "some-invalid-version" + version_for_feed = "1.8.0" + assert ("1.8.0", None) == func(project) + + print("\n*** changelog < git version + version append") + project = "test" + version_changelog = "1.0.0" + version_for_feed = "1.0.0.1-c0ff33" + monkeypatch.setattr(lib.args, "version_append", "~test") + assert ("1.0.0.1-c0ff33~test", None) == func(project) -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43678?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I2ae46fa77818bdee0287694cc5de6f9277cd0c91 Gerrit-Change-Number: 43678 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(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>
1 0
0 0
[XS] Change in libosmocore[master]: vty: cpu-sched: enlarge RR priority range
by pespin 20 Sep '26

20 Sep '26
Attention is currently required from: fixeria. pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/libosmocore/+/43683?usp=email ) Change subject: vty: cpu-sched: enlarge RR priority range ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43683?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ie362d69287096382738aa46a4a8c69509c20cea2 Gerrit-Change-Number: 43683 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: Sun, 20 Sep 2026 20:32:22 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: smf: Encode NG-NAS PDU Session Establishment Request
by pespin 20 Sep '26

20 Sep '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43663?usp=email ) Change subject: smf: Encode NG-NAS PDU Session Establishment Request ...................................................................... smf: Encode NG-NAS PDU Session Establishment Request Until now, the NAS message was hardcoded. Let's generate it ourselves instead, so we can pass the same PDU Session Id, etc. Change-Id: If04c97c80e87f851ad0fb24ce089ccc0ff477fb0 --- M smf/SMF_Session_CT.ttcn M smf/SMF_Session_CT_5G.ttcn M smf/gen_links.sh M smf/regen_makefile.sh 4 files changed, 90 insertions(+), 7 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn index 11e9f3a..197717f 100644 --- a/smf/SMF_Session_CT.ttcn +++ b/smf/SMF_Session_CT.ttcn @@ -152,6 +152,10 @@ return valueof(pfcp_pars); } +type record SessionPars_NGNAS { + OCT1 pti +}; + /* configuration data for a given Session */ type record SessionPars { hexstring imsi, @@ -179,7 +183,9 @@ SessionParsGy gy, - PfcpParameters pfcp_pars + PfcpParameters pfcp_pars, + + SessionPars_NGNAS nas } template (value) SessionPars @@ -210,7 +216,10 @@ validity_time := 0, cca_res_code := DIAMETER_SUCCESS }, - pfcp_pars := pfcp_pars + pfcp_pars := pfcp_pars, + nas := { + pti := '00'O + } } diff --git a/smf/SMF_Session_CT_5G.ttcn b/smf/SMF_Session_CT_5G.ttcn index 01c7a9f..425675e 100644 --- a/smf/SMF_Session_CT_5G.ttcn +++ b/smf/SMF_Session_CT_5G.ttcn @@ -24,6 +24,12 @@ import from NGAP_IEs all; import from NGAP_Types all; +import from NAS_CommonTypeDefs all; +import from NG_NAS_MsgContainers all; +import from NG_NAS_Osmo_Types all; +import from NG_NAS_Osmo_Templates all; +import from NG_NAS_Functions all; + import from PFCP_Emulation all; import from Mutex all; @@ -96,16 +102,18 @@ var template (value) HTTP2_pseudo_headers pseudo_hdr; var template (value) HTTP2_header_list hdr_li; var template (value) HTTP2_header_block hb; + var template (value) NG_NAS_UL_Message_Type nas_ul_msg; + var ProcedureTransactionIdentifier pti := f_next_pti(); var template (value) octetstring body; var template (value) TS29502_Nsmf_PDUSession.PlmnId plmn_id := TS29502_Nsmf_PDUSession_Templates.ts_PlmnId("001", "001"); var template (value) TS29502_Nsmf_PDUSession.PlmnIdNid plmn_id_nid := TS29502_Nsmf_PDUSession_Templates.ts_PlmnIdNid(plmn_id.mcc, plmn_id.mnc); - var integer pduSessionId := 1; + var integer pdu_sess_id := 1; var template (value) SmContextCreateData sm_contexts; var octetstring sm_contexts_enc; sm_contexts := ts_SmContextCreateData(supi := "imsi-" & g_pars.imsi_str, pei := "imeisv-0790219824011594", - pduSessionId := pduSessionId, + pduSessionId := pdu_sess_id, dnn := "internet", sNssai := TS29502_Nsmf_PDUSession_Templates.ts_Snssai(1), servingNfId := "foobar", @@ -117,11 +125,17 @@ ratType := ts_RatType(NR), ueLocation := ts_UserLocation(nrLocation := ts_NrLocation(tai := ts_Tai(plmn_id, "000001"), ncgi := ts_Ncgi(plmn_id, "000000000"))), - smContextStatusUri := f_amf_callback_uri(g_pars.imsi_str, "sm-context-status", pduSessionId)); + smContextStatusUri := f_amf_callback_uri(g_pars.imsi_str, "sm-context-status", pdu_sess_id)); sm_contexts_enc := f_enc_SmContextCreateData(valueof(sm_contexts)); var charstring boundary := "=-0EVVjxcWWFYNd1JXh1OQEg==" - var octetstring nas_enc := '2e0101c1ffff91a1'O; + + nas_ul_msg := cs_NG_PDU_SESSION_ESTABLISHMENT_REQUEST(cs_NG_PDU_SessionIdV(int2oct(pdu_sess_id, 1)), pti, + p_IntegrityProtMaxDataRate := cs_IntegrityProtMaxDataRateV('FF'O, 'FF'O), + p_PDU_SessionType := cs_PDU_SessionTypeTV(c_PDU_SessionType_IPv4), + p_SSC_Mode := cs_SSC_ModeTV('001'B)); + var octetstring nas_enc := enc_NG_NAS_UL_Message_Type(valueof(nas_ul_msg)); + body := f_http2_encode_body_multipart_json_5gnas(sm_contexts_enc, nas_enc, boundary); pseudo_hdr := ts_HTTP2_pseudo_headers("POST", @@ -446,4 +460,21 @@ } } + +/************ +* NG NAS +**************/ + +private function f_next_pti() runs on SMF_Session_CT return ProcedureTransactionIdentifier +{ + var integer i := oct2int(g_pars.nas.pti); + if (i >= 254) { + g_pars.nas.pti := '01'O; + } else { + g_pars.nas.pti := int2oct(i + 1, 1); + } + return g_pars.nas.pti; +} + + } diff --git a/smf/gen_links.sh b/smf/gen_links.sh index 29d860a..352f4a9 100755 --- a/smf/gen_links.sh +++ b/smf/gen_links.sh @@ -70,6 +70,45 @@ FILES="TS29571_CommonData.ttcn TS29502_Nsmf_PDUSession.ttcn TS29503_Nudm_SDM.ttcn TS29512_Npcf_SMPolicyControl.ttcn TS29518_Namf_Communication.ttcn " gen_links $DIR $FILES + +#################### +# NG_NAS start +#################### +DIR=$BASEDIR/nas/ccsrc/Externals +FILES="common_ext.cc " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/Common +FILES="CommonDefs.ttcn " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/PicsPixit +FILES="EUTRA_NR_Parameters.ttcn NAS_5GC_Parameters.ttcn Parameters.ttcn " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/CommonIP +FILES="CommonIP.ttcn LoopbackIP_PacketFilterTest.ttcn LoopbackIP.ttcn " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/EPS_NAS +FILES="EPS_NAS_LoopBack_TypeDefs.ttcn EPS_NAS_TypeDefs.ttcn " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/Common4G5G +FILES="Common4G5G_LoopBack.ttcn Common4G5G.ttcn EUTRA_NR_SecurityFunctions.ttcn " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/NAS +FILES="NAS_AuthenticationCommon.ttcn NAS_AuxiliaryDefsAndFunctions.ttcn NAS_CommonTemplates.ttcn NAS_CommonTypeDefs.ttcn SMS_Templates.ttcn SMS_TypeDefs.ttcn " +gen_links $DIR $FILES + +DIR=$BASEDIR/nas/ttcn/Lib3GPP/NG_NAS +FILES="EAP_TypeDefs.ttcn NG_NAS_Common.ttcn NG_NAS_MsgContainers.ttcn NG_NAS_Templates.ttcn NG_NAS_TypeDefs.ttcn NG_V2X_MsgContainers.ttcn NG_V2X_TypeDefs.ttcn " +gen_links $DIR $FILES +#################### +# NG_NAS end +#################### + DIR=../library/ngap FILES="NGAP_CommonDataTypes.asn NGAP_Constants.asn NGAP_Containers.asn NGAP_IEs.asn NGAP_PDU_Contents.asn NGAP_PDU_Descriptions.asn " FILES+="NGAP_EncDec.cc NGAP_Types.ttcn NGAP_Pixits.ttcn NGAP_Templates.ttcn " @@ -88,7 +127,8 @@ FILES+="NTP_Functions.ttcn PFCP_Templates.ttcn PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn " FILES+="Mutex.ttcn " FILES+="HTTP2_CodecPort.ttcn HTTP2_CodecPort_CtrlFunct.ttcn HTTP2_CodecPort_CtrlFunctDef.cc HTTP2_Templates.ttcn HTTP2_Functions.ttcn HTTP2_Adapter.ttcn HTTP2_Server_Emulation.ttcn " -FILES+="TS29503_Nudm_SDM_Templates.ttcn TS29502_Nsmf_PDUSession_Templates.ttcn TS29512_Npcf_SMPolicyControl_Templates.ttcn TS29518_Namf_Communication_Templates.ttcn" +FILES+="TS29503_Nudm_SDM_Templates.ttcn TS29502_Nsmf_PDUSession_Templates.ttcn TS29512_Npcf_SMPolicyControl_Templates.ttcn TS29518_Namf_Communication_Templates.ttcn " +FILES+="NG_NAS_Osmo_Types.ttcn NG_NAS_Osmo_Templates.ttcn NG_NAS_Functions.ttcn " gen_links $DIR $FILES gen_links_finish diff --git a/smf/regen_makefile.sh b/smf/regen_makefile.sh index b8c5a9a..a648078 100755 --- a/smf/regen_makefile.sh +++ b/smf/regen_makefile.sh @@ -6,6 +6,7 @@ *.ttcn *.ttcnpp BSSGP_EncDec.cc + common_ext.cc DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_EncDec.cc GTPC_EncDec.cc @@ -33,3 +34,5 @@ CPPFLAGS_TTCN3="" . ../_buildsystem/regen_makefile.inc.sh + +sed -i -e 's/^LINUX_LIBS = -lxml2 -lsctp/LINUX_LIBS = -lxml2 -lsctp -lgnutls/' Makefile -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43663?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: If04c97c80e87f851ad0fb24ce089ccc0ff477fb0 Gerrit-Change-Number: 43663 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>
1 0
0 0
[L] Change in osmo-trx[master]: proxy: detect TSC of bursts relayed from TRXDv0/v1
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43629?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: detect TSC of bursts relayed from TRXDv0/v1 ...................................................................... proxy: detect TSC of bursts relayed from TRXDv0/v1 A BURST.req sourced from TRXDv0/v1 carries no MTS field at all, so the proxy has no way to know the true modulation/TSC of a burst it forwards onward as a TRXDv1/TRXDv2 BURST.ind (whose MTS field is mandatory). Add burst_synch: detect the training/synch. sequence of a burst by comparing known positions within it against the GMSK and 8-PSK Normal Burst TSC sets (3GPP TS 45.002 tables 5.2.3a-d, 5.2.3f-g), Access Burst (table 5.2.7-3) and Synchronization Burst (table 5.2.5-3) sequences, mirroring fake_trx.py's TrainingSeqGMSK.pick(). burst_fwd.c calls this whenever the source BURST.req did not already carry real TSC info, filling in mod/tsc_set/tsc (and OSMO_TRXD_F_ACCESS_BURST for a detected Access Burst) before the burst is relayed onward. Change-Id: I686451bb80a0ebd7f522f58c910f2d0410305b7d Related: OS#6672 --- M proxy/Makefile.am A proxy/include/osmocom/proxy/burst_synch.h M proxy/src/Makefile.am M proxy/src/burst_fwd.c A proxy/src/burst_synch.c 5 files changed, 356 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 909c698..d0eb6cf 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -3,6 +3,7 @@ $(NULL) noinst_HEADERS = \ + include/osmocom/proxy/burst_synch.h \ include/osmocom/proxy/clck_gen.h \ include/osmocom/proxy/logging.h \ include/osmocom/proxy/path_sim.h \ diff --git a/proxy/include/osmocom/proxy/burst_synch.h b/proxy/include/osmocom/proxy/burst_synch.h new file mode 100644 index 0000000..4af221a --- /dev/null +++ b/proxy/include/osmocom/proxy/burst_synch.h @@ -0,0 +1,7 @@ +#pragma once + +struct osmo_trxd_burst_ind; +struct osmo_trxd_burst_req; + +void burst_synch_detect(struct osmo_trxd_burst_ind *bi, + const struct osmo_trxd_burst_req *br); diff --git a/proxy/src/Makefile.am b/proxy/src/Makefile.am index 4c3678e..ddd27b5 100644 --- a/proxy/src/Makefile.am +++ b/proxy/src/Makefile.am @@ -21,6 +21,7 @@ clck_gen.c \ ctrl_cmd.c \ burst_fwd.c \ + burst_synch.c \ path_sim.c \ logging.c \ $(NULL) diff --git a/proxy/src/burst_fwd.c b/proxy/src/burst_fwd.c index de057b6..cc64743 100644 --- a/proxy/src/burst_fwd.c +++ b/proxy/src/burst_fwd.c @@ -33,6 +33,7 @@ #include <osmocom/proxy/proxy.h> #include <osmocom/proxy/trx.h> #include <osmocom/proxy/path_sim.h> +#include <osmocom/proxy/burst_synch.h> #include <osmocom/proxy/logging.h> #define OSMO_TRXD_F_COMMON_MASK ( \ @@ -57,6 +58,12 @@ .trx_num = br->trx_num, }; + /* TRXDv0/v1 BURST.req PDUs carry no MTS field at all, so the true + * modulation/TSC of the burst is unknown here: detect it instead of + * asserting a fixed, possibly wrong TSC downstream. */ + if (~br->flags & OSMO_TRXD_F_TS_INFO) + burst_synch_detect(&bi, br); + osmo_ubit2sbit(bi.burst, br->burst, br->burst_len); path_sim_apply(&bi, &dst->chans[dst_chan], br, &src->chans[src_chan], diff --git a/proxy/src/burst_synch.c b/proxy/src/burst_synch.c new file mode 100644 index 0000000..5ff67e0 --- /dev/null +++ b/proxy/src/burst_synch.c @@ -0,0 +1,340 @@ +/*! \file src/burst_synch.c + * osmo-trx-proxy: detect the training/synch. sequence of a burst. */ + +/* + * (C) 2026 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de> + * + * All Rights Reserved + * + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdint.h> +#include <string.h> + +#include <osmocom/core/bits.h> +#include <osmocom/gsm/gsm0502.h> +#include <osmocom/trx/trxd.h> + +#include <osmocom/proxy/burst_synch.h> + +/* A BURST.req sourced from TRXDv0/v1 carries no MTS field at all, so the + * proxy has no way to know the true modulation/TSC of a burst it forwards + * onward as a TRXDv1/TRXDv2 BURST.ind (whose MTS field is mandatory). + * Rather than asserting a fixed, possibly wrong TSC, detect it by + * comparing known positions within the burst against the following + * training/synch. sequences defined in 3GPP TS 45.002: + * + * - Access Burst (RACH), table 5.2.7-3: TS0, TS1, TS2, TS4. + * Table 5.2.7-4 (EC operation variants) is not covered, as EC + * operation is not implemented by Osmocom. + * - Synchronization Burst (SCH), table 5.2.5-3: TS0..TS3. + * - Normal Burst (GMSK), tables 5.2.3a-d: all four TSC sets, TSC 0..7 each. + * - Normal Burst (8-PSK), tables 5.2.3f-g: both TSC sets, TSC 0..7 each. + */ + +#define AB_SEQ_NUM 4 + +/* 3GPP TS 45.002, section 5.2.5, gives the Sync. Burst layout as + * tail(3) + encrypted(39) + train_seq(64) + encrypted(39) + tail(3). */ +#define SB_OFFSET (GSM_NBITS_SB_GMSK_TAIL + GSM_NBITS_SB_GMSK_PAYLOAD / 2) +#define SB_SEQ_NUM 4 + +/* 3GPP TS 45.002, section 5.2.3, gives the Normal Burst (GMSK) layout as + * tail(3) + encrypted(58) + train_seq(26) + encrypted(58) + tail(3). */ +#define NB_OFFSET (GSM_NBITS_NB_GMSK_TAIL + GSM_NBITS_NB_GMSK_PAYLOAD / 2) +#define NB_TSC_SET_NUM 4 +#define NB_TSC_NUM 8 + +/* 3GPP TS 45.002, section 5.2.3.3, gives the Normal Burst (8-PSK) layout as + * tail(9) + encrypted(174) + train_seq(78) + encrypted(174) + tail(9). */ +#define NB8_OFFSET (GSM_NBITS_NB_8PSK_TAIL + GSM_NBITS_NB_8PSK_PAYLOAD / 2) +#define NB8_TSC_SET_NUM 2 +#define NB8_TSC_NUM 8 + +/* 3GPP TS 45.002, table 5.2.7-3: Access Burst synch. sequence bits. + * Indexed by TSC (0, 1, 2, 4 -- 3, 5, 6, 7 are EC-only, see table 5.2.7-4). */ +static const ubit_t ab_seq[AB_SEQ_NUM][GSM_NBITS_AB_GMSK_SYNCH_SEQ] = { + { /* TSC 0 */ + 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, + 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, + }, + { /* TSC 1 */ + 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, + 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, + }, + { /* TSC 2 */ + 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, + 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, + }, + { /* TSC 4 */ + 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, + }, +}; +static const uint8_t ab_seq_tsc[AB_SEQ_NUM] = { 0, 1, 2, 4 }; + +/* 3GPP TS 45.002, table 5.2.5-3: Synchronization Burst extended training + * sequence bits. Indexed by TSC (0..3). */ +static const ubit_t sb_seq[SB_SEQ_NUM][GSM_NBITS_SB_GMSK_ETRAIN_SEQ] = { + { /* TSC 0 */ + 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, + 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, + 1, 0, 1, 1, + }, + { /* TSC 1 */ + 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, + 0, 1, 0, 1, + }, + { /* TSC 2 */ + 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, + 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, + 1, 1, 1, 0, + }, + { /* TSC 3 */ + 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, + 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, + 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 0, + }, +}; + +/* 3GPP TS 45.002, tables 5.2.3a-d: Normal Burst training sequence bits. + * Indexed by [TSC set 0..3][TSC 0..7]. */ +static const ubit_t nb_seq[NB_TSC_SET_NUM][NB_TSC_NUM][GSM_NBITS_NB_GMSK_TRAIN_SEQ] = { + { /* TSC set 1 */ + { 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1 }, /* TSC 0 */ + { 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1 }, /* TSC 1 */ + { 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0 }, /* TSC 2 */ + { 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0 }, /* TSC 3 */ + { 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1 }, /* TSC 4 */ + { 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0 }, /* TSC 5 */ + { 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1 }, /* TSC 6 */ + { 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0 }, /* TSC 7 */ + }, + { /* TSC set 2 */ + { 0, 1, 1,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0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0 }, /* TSC 6 */ + { 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0 }, /* TSC 7 */ + }, +}; + +/* 3GPP TS 45.002, tables 5.2.3f-g: Normal Burst (8-PSK) training sequence + * bits. Indexed by [TSC set 0..1][TSC 0..7]. */ +static const ubit_t nb8_seq[NB8_TSC_SET_NUM][NB8_TSC_NUM][GSM_NBITS_NB_8PSK_TRAIN_SEQ] = { + { /* TSC set 1 */ + { /* TSC 0 */ + 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, + 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, + }, + { /* TSC 1 */ + 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, + 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, + 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, + }, + { /* TSC 2 */ + 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, + 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0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0, 1, + 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, + }, + { /* TSC 7 */ + 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, + 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, + }, + }, +}; + +static void burst_synch_detect_gmsk(struct osmo_trxd_burst_ind *bi, + const struct osmo_trxd_burst_req *br) +{ + /* Normal Bursts are by far the most common: check them first */ + for (unsigned int j = 0; j < NB_TSC_SET_NUM; j++) { + for (unsigned int k = 0; k < NB_TSC_NUM; k++) { + if (memcmp(&br->burst[NB_OFFSET], nb_seq[j][k], + GSM_NBITS_NB_GMSK_TRAIN_SEQ) != 0) + continue; + bi->flags |= OSMO_TRXD_F_TS_INFO; + bi->tsc_set = j; + bi->tsc = k; + return; + } + } + + for (unsigned int i = 0; i < AB_SEQ_NUM; i++) { + if (memcmp(&br->burst[GSM_NBITS_AB_GMSK_ETAIL], ab_seq[i], + GSM_NBITS_AB_GMSK_SYNCH_SEQ) != 0) + continue; + bi->flags |= OSMO_TRXD_F_TS_INFO | OSMO_TRXD_F_ACCESS_BURST; + bi->tsc_set = 0; + bi->tsc = ab_seq_tsc[i]; + return; + } + + /* SCH only ever occurs on TS0 */ + if (br->tn == 0) { + for (unsigned int i = 0; i < SB_SEQ_NUM; i++) { + if (memcmp(&br->burst[SB_OFFSET], sb_seq[i], + GSM_NBITS_SB_GMSK_ETRAIN_SEQ) != 0) + continue; + bi->flags |= OSMO_TRXD_F_TS_INFO; + bi->tsc_set = 0; + bi->tsc = i; + return; + } + } +} + +static void burst_synch_detect_8psk(struct osmo_trxd_burst_ind *bi, + const struct osmo_trxd_burst_req *br) +{ + for (unsigned int j = 0; j < NB8_TSC_SET_NUM; j++) { + for (unsigned int k = 0; k < NB8_TSC_NUM; k++) { + if (memcmp(&br->burst[NB8_OFFSET], nb8_seq[j][k], + GSM_NBITS_NB_8PSK_TRAIN_SEQ) != 0) + continue; + bi->flags |= OSMO_TRXD_F_TS_INFO; + bi->tsc_set = j; + bi->tsc = k; + return; + } + } +} + +/*! Detect the training/synch. sequence used by the hard-bits of br and + * fill in bi->{mod,tsc_set,tsc} fields accordingly. */ +void burst_synch_detect(struct osmo_trxd_burst_ind *bi, + const struct osmo_trxd_burst_req *br) +{ + /* NOPE.req has no burst to correlate */ + if (br->flags & OSMO_TRXD_F_NOPE_REQ) + return; + + /* libosmo-trx's trxd_burst_req_parse_v01() sets br->mod for us */ + if (br->mod == OSMO_TRXD_MOD_T_GMSK) + burst_synch_detect_gmsk(bi, br); + else if (br->mod == OSMO_TRXD_MOD_T_8PSK) + burst_synch_detect_8psk(bi, br); +} -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43629?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I686451bb80a0ebd7f522f58c910f2d0410305b7d Gerrit-Change-Number: 43629 Gerrit-PatchSet: 5 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[M] Change in osmo-trx[master]: proxy: queue BURST.req and dispatch per TDMA frame tick
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43612?usp=email ) ( 5 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: queue BURST.req and dispatch per TDMA frame tick ...................................................................... proxy: queue BURST.req and dispatch per TDMA frame tick Enqueue incoming BURST.req per endpoint instead of forwarding immediately, and drain the queue on each TDMA clock tick: forward entries whose fn is due, drop late ones, keep the rest waiting. Change-Id: Ib147983e97638d2a2e487ccf76184912caf0941d Related: OS#6672 --- M proxy/Makefile.am A proxy/include/osmocom/proxy/burst_fwd.h M proxy/include/osmocom/proxy/path_sim.h M proxy/include/osmocom/proxy/trx.h M proxy/src/burst_fwd.c M proxy/src/clck_gen.c M proxy/src/path_sim.c M proxy/src/trx.c 8 files changed, 198 insertions(+), 11 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/proxy/Makefile.am b/proxy/Makefile.am index d0eb6cf..8fcde9e 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -3,6 +3,7 @@ $(NULL) noinst_HEADERS = \ + include/osmocom/proxy/burst_fwd.h \ include/osmocom/proxy/burst_synch.h \ include/osmocom/proxy/clck_gen.h \ include/osmocom/proxy/logging.h \ diff --git a/proxy/include/osmocom/proxy/burst_fwd.h b/proxy/include/osmocom/proxy/burst_fwd.h new file mode 100644 index 0000000..7ecddba --- /dev/null +++ b/proxy/include/osmocom/proxy/burst_fwd.h @@ -0,0 +1,5 @@ +#pragma once + +#include <stdint.h> + +void burst_fwd_dispatch(uint32_t fn); diff --git a/proxy/include/osmocom/proxy/path_sim.h b/proxy/include/osmocom/proxy/path_sim.h index 58bd9bb..25b68a0 100644 --- a/proxy/include/osmocom/proxy/path_sim.h +++ b/proxy/include/osmocom/proxy/path_sim.h @@ -33,6 +33,7 @@ const struct proxy_trx_chan *src, const struct path_sim_cfg *cfg); int path_sim_measure(uint32_t freq_hz, const struct path_sim_cfg *cfg); +void path_sim_fill_nope(struct osmo_trxd_burst_ind *bi, const struct path_sim_cfg *cfg); struct path_sim_cfg *path_sim_cfg_alloc(void *talloc_ctx); diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h index 633c9fa..e3191d6 100644 --- a/proxy/include/osmocom/proxy/trx.h +++ b/proxy/include/osmocom/proxy/trx.h @@ -7,6 +7,7 @@ #include <osmocom/core/logging.h> #include <osmocom/trx/trxc.h> +#include <osmocom/trx/trxd.h> #include <osmocom/proxy/path_sim.h> @@ -23,6 +24,12 @@ struct proxy_trx_ts { struct osmo_trxc_setslot cfg; bool valid; /*!< has SETSLOT been received for this TS? */ + /*! Scratch: this timeslot's Rx burst indication staged for the + * current TDMA frame tick, so dispatch can send it to L1 without + * regard to the order bursts were forwarded in. Reset to NOPE.ind + * at the start of each tick, then a real forwarded burst overwrites + * it if one lands here. See burst_fwd_dispatch() in burst_fwd.c. */ + struct osmo_trxd_burst_ind bi; }; /*! One Mobile Allocation entry: the Rx/Tx frequency pair for one ARFCN. */ @@ -50,6 +57,10 @@ struct path_sim_state path_sim; /*!< RF path simulation state (path_sim.c) */ struct proxy_trx_ts ts[PROXY_TRX_NUM_TS]; /*!< per-timeslot config (SETSLOT) */ struct proxy_trx_fh *fh; /*!< frequency hopping config (SETFH), NULL if disabled */ + /*! Queue of struct msgb, each wrapping a copy of one BURST.req + * (struct osmo_trxd_burst_req) awaiting its TDMA frame tick, sorted + * by fn (ascending). See burst_fwd.c. */ + struct llist_head tx_burst_queue; }; /*! One virtual transceiver endpoint */ diff --git a/proxy/src/burst_fwd.c b/proxy/src/burst_fwd.c index cc64743..f56f316 100644 --- a/proxy/src/burst_fwd.c +++ b/proxy/src/burst_fwd.c @@ -26,7 +26,11 @@ #include <string.h> #include <osmocom/core/bits.h> +#include <osmocom/core/talloc.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/core/msgb.h> + +#include <osmocom/gsm/gsm0502.h> #include <osmocom/trx/ep.h> @@ -34,6 +38,7 @@ #include <osmocom/proxy/trx.h> #include <osmocom/proxy/path_sim.h> #include <osmocom/proxy/burst_synch.h> +#include <osmocom/proxy/burst_fwd.h> #include <osmocom/proxy/logging.h> #define OSMO_TRXD_F_COMMON_MASK ( \ @@ -43,6 +48,13 @@ OSMO_TRXD_F_TRX_NUM \ ) +/*! The BURST.req copy wrapped in a queued struct msgb + * (see struct proxy_trx_chan::tx_burst_queue). */ +static inline struct osmo_trxd_burst_req *msgb_burst_req(const struct msgb *msg) +{ + return (struct osmo_trxd_burst_req *)msgb_data(msg); +} + static void burst_fwd_to_chan(struct proxy_trx *src, unsigned int src_chan, struct proxy_trx *dst, unsigned int dst_chan, const struct osmo_trxd_burst_req *br) @@ -69,25 +81,22 @@ br, &src->chans[src_chan], g_proxy_ctx->path_sim); - osmo_trx_ep_send_burst_ind(dst->ep, dst_chan, &bi); + /* Stage the burst rather than sending it right away: dispatch sends + * every dst channel's Rx indications in ascending tn order once all + * sources have been processed for this TDMA frame tick (see + * burst_fwd_dispatch()). */ + dst->chans[dst_chan].ts[br->tn].bi = bi; } /*! Forward a Tx burst request to every powered-on endpoint/channel * whose Rx frequency matches the source channel's Tx frequency (resolved * per TDMA frame number if frequency hopping (SETFH) is configured). */ -void osmo_trx_ep_rx_burst_req(struct osmo_trx_ep *ep, unsigned int chan, - const struct osmo_trxd_burst_req *br) +static void burst_fwd_burst_req(struct proxy_trx *src, unsigned int chan, + const struct osmo_trxd_burst_req *br) { - struct proxy_trx *src = osmo_trx_ep_get_priv(ep); struct proxy_trx *dst = NULL; uint32_t tx_freq; - if (!src->powered) { - LOGP_TRXCH(src, chan, DTRXD, LOGL_NOTICE, - "Rx BURST.req while not powered on, dropping\n"); - return; - } - if (src->chans[chan].fh != NULL) proxy_trx_fh_resolve(src->chans[chan].fh, br->fn, NULL, &tx_freq); else @@ -114,3 +123,147 @@ } } } + +/*! Enqueue a Tx burst request for later dispatch by the TDMA clock + * generator: real transceivers typically receive bursts a few frames ahead + * of their actual air time, so forwarding must happen at the matching TDMA + * frame tick, not immediately upon receipt (see burst_fwd_dispatch()). */ +void osmo_trx_ep_rx_burst_req(struct osmo_trx_ep *ep, unsigned int chan, + const struct osmo_trxd_burst_req *br) +{ + struct proxy_trx *src = osmo_trx_ep_get_priv(ep); + struct proxy_trx_chan *c = &src->chans[chan]; + struct msgb *msg, *cur; + + if (!src->powered) { + LOGP_TRXCH(src, chan, DTRXD, LOGL_NOTICE, + "Rx BURST.req while not powered on, dropping\n"); + return; + } + + msg = msgb_alloc_c(src, sizeof(*br), "trxd_burst_req"); + OSMO_ASSERT(msg != NULL); + memcpy(msgb_put(msg, sizeof(*br)), br, sizeof(*br)); + + /* The queue is kept sorted by TDMA FN (ascending) so that dispatch, + * which is timing critical, only ever needs to look at the head of + * the queue instead of scanning it in full on every TDMA frame tick. + * Bursts normally arrive already in ascending FN order (a few frames + * ahead of their air time), so a new entry almost always belongs at + * the tail: scan backwards from there so the common case is O(1). */ + llist_for_each_entry_reverse(cur, &c->tx_burst_queue, list) { + if (gsm0502_fncmp(msgb_burst_req(cur)->fn, br->fn) <= 0) { + llist_add(&msg->list, &cur->list); + return; + } + } + llist_add(&msg->list, &c->tx_burst_queue); +} + +/*! Reset every powered channel's per-tn staging area to NOPE.ind for the + * given TDMA frame number, so real forwarded bursts only need to overwrite + * the entries they land on (see burst_fwd_to_chan()). */ +static void burst_fwd_reset_bi(uint32_t fn) +{ + struct proxy_trx *trx; + + llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) { + if (!trx->powered) + continue; + + for (unsigned int chan = 0; chan < trx->num_chans; chan++) { + struct proxy_trx_chan *c = &trx->chans[chan]; + + for (unsigned int tn = 0; tn < PROXY_TRX_NUM_TS; tn++) { + c->ts[tn].bi = (struct osmo_trxd_burst_ind){ .fn = fn, .tn = tn }; + path_sim_fill_nope(&c->ts[tn].bi, g_proxy_ctx->path_sim); + } + } + } +} + +/*! Send every powered channel's staged Rx indications (see + * burst_fwd_reset_bi(), burst_fwd_to_chan()) for this TDMA frame tick, + * in ascending tn order. */ +static void burst_fwd_send_bi(void) +{ + struct proxy_trx *trx; + + llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) { + if (!trx->powered) + continue; + + for (unsigned int chan = 0; chan < trx->num_chans; chan++) { + struct proxy_trx_chan *c = &trx->chans[chan]; + + for (unsigned int tn = 0; tn < PROXY_TRX_NUM_TS; tn++) { + struct proxy_trx_ts *ts = &c->ts[tn]; + struct osmo_trxd_burst_ind *bi = &ts->bi; + + /* unconfigured (no SETSLOT) timeslot: send nothing at all */ + if (!ts->valid) + continue; + + /* TRXDv0 has no MTS field to carry the NOPE.ind flag in */ + if ((bi->flags & OSMO_TRXD_F_NOPE_IND) && + osmo_trx_ep_get_pdu_ver(trx->ep, chan) < 1) + continue; + + osmo_trx_ep_send_burst_ind(trx->ep, chan, bi); + } + + /* flush batched PDUs (no-op below TRXDv2) */ + osmo_trx_ep_send_burst_fin(trx->ep, chan); + } + } +} + +/*! Dispatch every queued BURST.req whose TDMA frame number is due: + * forward those with fn == fn, drop those with fn < fn (arrived too late), + * and leave the rest queued. */ +void burst_fwd_dispatch(uint32_t fn) +{ + struct proxy_trx *trx; + + /* Three passes over this TDMA frame tick: + * 1. pre-fill every dst channel's Rx staging area with NOPE.ind; */ + burst_fwd_reset_bi(fn); + + /* 2. dispatch the per-channel Tx queues, overwriting the staged + * NOPE.ind of whatever real bursts land; */ + llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) { + if (!trx->powered) + continue; + + for (unsigned int chan = 0; chan < trx->num_chans; chan++) { + struct proxy_trx_chan *c = &trx->chans[chan]; + struct msgb *msg, *msg2; + + /* tx_burst_queue is sorted by fn (ascending), so it's + * enough to consume its head and stop at the first + * entry that is not yet due. */ + llist_for_each_entry_safe(msg, msg2, &c->tx_burst_queue, list) { + struct osmo_trxd_burst_req *br = msgb_burst_req(msg); + int rc = gsm0502_fncmp(br->fn, fn); + + if (rc > 0) /* br->fn is still ahead of fn */ + break; + + llist_del(&msg->list); + + if (OSMO_UNLIKELY(rc < 0)) { /* br->fn is behind fn */ + LOGP_TRXCH(trx, chan, DTRXD, LOGL_ERROR, + "Rx BURST.req for fn=%u too late (now fn=%u), " + "dropping\n", br->fn, fn); + } else { + burst_fwd_burst_req(trx, chan, br); + } + + msgb_free(msg); + } + } + } + + /* 3. send every staged Rx indication out to L1. */ + burst_fwd_send_bi(); +} diff --git a/proxy/src/clck_gen.c b/proxy/src/clck_gen.c index 813530c..ff6c64c 100644 --- a/proxy/src/clck_gen.c +++ b/proxy/src/clck_gen.c @@ -37,6 +37,7 @@ #include <osmocom/proxy/proxy.h> #include <osmocom/proxy/trx.h> #include <osmocom/proxy/clck_gen.h> +#include <osmocom/proxy/burst_fwd.h> #include <osmocom/proxy/logging.h> /*! Default "IND CLOCK" period, in frames */ @@ -78,7 +79,7 @@ } } - /* TODO: drive per-frame burst forwarding (burst_queue/burst_fwd) */ + burst_fwd_dispatch(gen->fn); GSM_TDMA_FN_INC(gen->fn); } diff --git a/proxy/src/path_sim.c b/proxy/src/path_sim.c index 260cce2..1b069ed 100644 --- a/proxy/src/path_sim.c +++ b/proxy/src/path_sim.c @@ -190,6 +190,20 @@ bi->flags |= OSMO_TRXD_F_CI_CB; } +/*! Fill in a NOPE.ind for a timeslot where no BURST.req was received at all + * this TDMA frame tick (as opposed to path_sim_apply(), which reports on an + * actually forwarded burst that got dropped/muted along the way). Reports + * the configured noise floor, same as path_sim_measure() would for an idle + * frequency. */ +void path_sim_fill_nope(struct osmo_trxd_burst_ind *bi, const struct path_sim_cfg *cfg) +{ + bi->flags |= OSMO_TRXD_F_NOPE_IND | OSMO_TRXD_F_CI_CB; + bi->burst_len = 0; + bi->toa256 = PATH_SIM_TOA256_NOISE_DEFAULT; + bi->rssi = cfg->noise_dbm; + bi->ci_cb = PATH_SIM_CI_NOISE_DEFAULT; +} + static int path_sim_measure_rssi(const struct proxy_trx_chan *tx, const struct path_sim_cfg *cfg) { if (tx->path_sim.flags & PATH_SIM_F_FAKE_RSSI) diff --git a/proxy/src/trx.c b/proxy/src/trx.c index da315d1..96bfb48 100644 --- a/proxy/src/trx.c +++ b/proxy/src/trx.c @@ -135,6 +135,7 @@ path_sim_state_reset(&trx->chans[i].path_sim, trx->tx_power, path_sim_cfg_get_nom_toa256(g_proxy_ctx->path_sim), path_sim_cfg_get_nom_ci_cb(g_proxy_ctx->path_sim)); + INIT_LLIST_HEAD(&trx->chans[i].tx_burst_queue); } } -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43612?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ib147983e97638d2a2e487ccf76184912caf0941d Gerrit-Change-Number: 43612 Gerrit-PatchSet: 6 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[S] Change in osmo-trx[master]: proxy: reset all per-chan parameters on POWEROFF
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43630?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: reset all per-chan parameters on POWEROFF ...................................................................... proxy: reset all per-chan parameters on POWEROFF Change-Id: Ife14ed20614d39c385531ba0fe4fd728cebc6675 Related: OS#6672 --- M proxy/src/trx.c 1 file changed, 24 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/proxy/src/trx.c b/proxy/src/trx.c index 96bfb48..1d0cb9c 100644 --- a/proxy/src/trx.c +++ b/proxy/src/trx.c @@ -29,6 +29,7 @@ #include <osmocom/core/utils.h> #include <osmocom/core/talloc.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/core/msgb.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/gsm0502.h> @@ -101,6 +102,22 @@ talloc_free(trx); } +static void proxy_trx_chan_reset_params(struct proxy_trx *trx, unsigned int chan) +{ + struct proxy_trx_chan *c = &trx->chans[chan]; + + c->rx_freq = 0; + c->tx_freq = 0; + c->rf_muted = false; + talloc_free(c->fh); + c->fh = NULL; + path_sim_state_reset(&c->path_sim, trx->tx_power, + path_sim_cfg_get_nom_toa256(g_proxy_ctx->path_sim), + path_sim_cfg_get_nom_ci_cb(g_proxy_ctx->path_sim)); + memset(c->ts, 0, sizeof(c->ts)); + msgb_queue_free(&c->tx_burst_queue); +} + /*! Update the endpoint's power state; * (de)registers it with the TDMA clock generator as appropriate. */ void proxy_trx_set_power(struct proxy_trx *trx, bool on) @@ -111,7 +128,14 @@ LOGP_TRX(trx, DTRXC, LOGL_INFO, "Power %s\n", on ? "on" : "off"); + /* reset all per-chan parameters on POWEROFF */ + if (!on) { + for (unsigned int chan = 0; chan < trx->num_chans; chan++) + proxy_trx_chan_reset_params(trx, chan); + } + trx->powered = on; + clck_gen_trx_list_updated(); } -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43630?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ife14ed20614d39c385531ba0fe4fd728cebc6675 Gerrit-Change-Number: 43630 Gerrit-PatchSet: 5 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[S] Change in osmo-trx[master]: proxy: make max TRXD PDU version VTY-configurable
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43631?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: make max TRXD PDU version VTY-configurable ...................................................................... proxy: make max TRXD PDU version VTY-configurable Change-Id: Ibd384ee57a728b709b1e43726b46c8c3840b5535 Related: OS#6672 --- M proxy/include/osmocom/proxy/trx.h M proxy/src/ctrl_cmd.c M proxy/src/trx.c M proxy/src/vty.c 4 files changed, 21 insertions(+), 2 deletions(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h index e3191d6..f7b07ce 100644 --- a/proxy/include/osmocom/proxy/trx.h +++ b/proxy/include/osmocom/proxy/trx.h @@ -70,6 +70,7 @@ struct osmo_trx_ep *ep; bool powered; /*!< POWERON/POWEROFF applies to all channels at once */ int tx_power; /*!< dBm, nominal Tx power (path_sim_state::tx_power) */ + uint8_t trxd_max_ver; /*!< highest TRXD PDU version SETFORMAT may negotiate */ unsigned int num_chans; /*!< mirrors osmo_trx_ep_get_num_chans(ep) */ struct proxy_trx_chan *chans; /*!< array of num_chans entries, allocated on open */ }; diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c index c6b238a..cad7d78 100644 --- a/proxy/src/ctrl_cmd.c +++ b/proxy/src/ctrl_cmd.c @@ -285,8 +285,8 @@ return; } - if (ver_req > OSMO_TRXD_PDU_VER_MAX) - ver_req = OSMO_TRXD_PDU_VER_MAX; + if (ver_req > trx->trxd_max_ver) + ver_req = trx->trxd_max_ver; osmo_trx_ep_set_pdu_ver(trx->ep, chan, ver_req); rsp->status = ver_req; diff --git a/proxy/src/trx.c b/proxy/src/trx.c index 1d0cb9c..1ee6aea 100644 --- a/proxy/src/trx.c +++ b/proxy/src/trx.c @@ -53,6 +53,7 @@ trx->name = talloc_strdup(trx, name); trx->tx_power = PROXY_TRX_DEFAULT_TX_POWER; + trx->trxd_max_ver = OSMO_TRXD_PDU_VER_MAX; trx->ep = osmo_trx_ep_alloc(trx, num_chans); if (trx->ep == NULL) { talloc_free(trx); diff --git a/proxy/src/vty.c b/proxy/src/vty.c index ab53147..c5fe6b7 100644 --- a/proxy/src/vty.c +++ b/proxy/src/vty.c @@ -292,6 +292,20 @@ return CMD_SUCCESS; } +DEFUN(cfg_ep_trxd_max_version, + cfg_ep_trxd_max_version_cmd, + "trxd-max-version <0-" OSMO_STRINGIFY_VAL(OSMO_TRXD_PDU_VER_MAX) ">", + "Set the highest TRXD PDU version SETFORMAT may negotiate " + "(default: " OSMO_STRINGIFY_VAL(OSMO_TRXD_PDU_VER_MAX) ")\n" + "TRXD PDU version\n") +{ + struct proxy_trx *trx = vty->index; + + trx->trxd_max_ver = atoi(argv[0]); + + return CMD_SUCCESS; +} + DEFUN(cfg_ep_clock_socket, cfg_ep_clock_socket_cmd, "clock-socket", @@ -345,6 +359,8 @@ vty_out(vty, " base-port %u%s", osmo_trx_ep_get_base_port(trx->ep), VTY_NEWLINE); vty_out(vty, " num-chans %u%s", trx->num_chans, VTY_NEWLINE); vty_out(vty, " tx-power %d%s", trx->tx_power, VTY_NEWLINE); + if (trx->trxd_max_ver < OSMO_TRXD_PDU_VER_MAX) + vty_out(vty, " trxd-max-version %u%s", trx->trxd_max_ver, VTY_NEWLINE); if (!osmo_trx_ep_get_clock_socket(trx->ep)) vty_out(vty, " no clock-socket%s", VTY_NEWLINE); @@ -450,6 +466,7 @@ install_element(EP_NODE, &cfg_ep_base_port_cmd); install_element(EP_NODE, &cfg_ep_num_chans_cmd); install_element(EP_NODE, &cfg_ep_tx_power_cmd); + install_element(EP_NODE, &cfg_ep_trxd_max_version_cmd); install_element(EP_NODE, &cfg_ep_clock_socket_cmd); install_element(EP_NODE, &cfg_ep_no_clock_socket_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43631?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ibd384ee57a728b709b1e43726b46c8c3840b5535 Gerrit-Change-Number: 43631 Gerrit-PatchSet: 5 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[S] Change in osmo-trx[master]: proxy: make TRXDv2+ PDU batching VTY-configurable
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43632?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: make TRXDv2+ PDU batching VTY-configurable ...................................................................... proxy: make TRXDv2+ PDU batching VTY-configurable Change-Id: I56c27db81d03bfbe58b4960e031a2f805df6e21b Related: OS#6672 --- M proxy/src/vty.c 1 file changed, 30 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/proxy/src/vty.c b/proxy/src/vty.c index c5fe6b7..83f41da 100644 --- a/proxy/src/vty.c +++ b/proxy/src/vty.c @@ -306,6 +306,32 @@ return CMD_SUCCESS; } +DEFUN(cfg_ep_trxd_pdu_batch, + cfg_ep_trxd_pdu_batch_cmd, + "trxd-pdu-batch", + "Batch all BURST.ind PDUs of a TDMA frame into one datagram " + "(TRXDv2 and higher, default)\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_pdu_batch(trx->ep, true); + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_no_trxd_pdu_batch, + cfg_ep_no_trxd_pdu_batch_cmd, + "no trxd-pdu-batch", + NO_STR "Send one datagram per BURST.ind PDU instead of batching a " + "TDMA frame's worth into one\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_pdu_batch(trx->ep, false); + + return CMD_SUCCESS; +} + DEFUN(cfg_ep_clock_socket, cfg_ep_clock_socket_cmd, "clock-socket", @@ -361,6 +387,8 @@ vty_out(vty, " tx-power %d%s", trx->tx_power, VTY_NEWLINE); if (trx->trxd_max_ver < OSMO_TRXD_PDU_VER_MAX) vty_out(vty, " trxd-max-version %u%s", trx->trxd_max_ver, VTY_NEWLINE); + if (!osmo_trx_ep_get_pdu_batch(trx->ep)) + vty_out(vty, " no trxd-pdu-batch%s", VTY_NEWLINE); if (!osmo_trx_ep_get_clock_socket(trx->ep)) vty_out(vty, " no clock-socket%s", VTY_NEWLINE); @@ -467,6 +495,8 @@ install_element(EP_NODE, &cfg_ep_num_chans_cmd); install_element(EP_NODE, &cfg_ep_tx_power_cmd); install_element(EP_NODE, &cfg_ep_trxd_max_version_cmd); + install_element(EP_NODE, &cfg_ep_trxd_pdu_batch_cmd); + install_element(EP_NODE, &cfg_ep_no_trxd_pdu_batch_cmd); install_element(EP_NODE, &cfg_ep_clock_socket_cmd); install_element(EP_NODE, &cfg_ep_no_clock_socket_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43632?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I56c27db81d03bfbe58b4960e031a2f805df6e21b Gerrit-Change-Number: 43632 Gerrit-PatchSet: 5 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[S] Change in osmo-trx[master]: doc/examples: add a config file for osmo-trx-proxy
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43634?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: doc/examples: add a config file for osmo-trx-proxy ...................................................................... doc/examples: add a config file for osmo-trx-proxy Change-Id: I401753bd1977057c3de481e7bf074d1f92f84499 Related: OS#6672 --- M doc/examples/Makefile.am A doc/examples/osmo-trx-proxy/osmo-trx-proxy.cfg 2 files changed, 39 insertions(+), 0 deletions(-) Approvals: fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index ac87457..e6600da 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -8,6 +8,7 @@ osmo-trx-lms/osmo-trx-limesdr.cfg \ osmo-trx-lms/osmo-trx-lms.cfg \ osmo-trx-ipc/osmo-trx-ipc.cfg \ + osmo-trx-proxy/osmo-trx-proxy.cfg \ $(NULL) OSMOCONF_FILES = @@ -30,6 +31,10 @@ OSMOCONF_FILES += osmo-trx-ipc/osmo-trx-ipc.cfg endif +if ENABLE_PROXY +OSMOCONF_FILES += osmo-trx-proxy/osmo-trx-proxy.cfg +endif + osmoconf_DATA = $(OSMOCONF_FILES) CFG_FILES = find $(srcdir) -type f -name '*.cfg*' | sed -e 's,^$(srcdir),,' diff --git a/doc/examples/osmo-trx-proxy/osmo-trx-proxy.cfg b/doc/examples/osmo-trx-proxy/osmo-trx-proxy.cfg new file mode 100644 index 0000000..afe5e2d --- /dev/null +++ b/doc/examples/osmo-trx-proxy/osmo-trx-proxy.cfg @@ -0,0 +1,34 @@ +log stderr + logging filter all 1 + logging color 1 + logging print category-hex 0 + logging print category 1 + logging print thread-id 0 + logging print extended-timestamp 1 + logging print level 1 + logging print file basename last + logging level set-all notice + logging level proxy info + logging level trxc info + logging level trxd notice + logging level lglobal notice +! +proxy + bind-addr 0.0.0.0 + clck-gen start-fn random + clck-gen ind-period 102 + pm-rssi-noise -110 + path-loss 110 + nominal-toa256 0 + nominal-ci 90 + ep bts + remote-addr 127.0.0.1 + base-port 5700 + num-chans 1 + tx-power 50 + ep ms + remote-addr 127.0.0.1 + base-port 6700 + num-chans 1 + tx-power 50 + no clock-socket -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43634?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I401753bd1977057c3de481e7bf074d1f92f84499 Gerrit-Change-Number: 43634 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[S] Change in osmo-trx[master]: proxy: check for PC clock skew
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43633?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: check for PC clock skew ...................................................................... proxy: check for PC clock skew This replicates the clock skew detection logic that exists in osmo-bts-trx (see trx_fn_timer_cb()). Change-Id: I256ff6a4f4a05ea5507b5d9395a946672ff4e306 Related: OS#6672 --- M proxy/src/clck_gen.c 1 file changed, 37 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/proxy/src/clck_gen.c b/proxy/src/clck_gen.c index ff6c64c..39abc6c 100644 --- a/proxy/src/clck_gen.c +++ b/proxy/src/clck_gen.c @@ -27,9 +27,12 @@ #include <unistd.h> #include <stdint.h> #include <stdlib.h> +#include <time.h> +#include <inttypes.h> #include <osmocom/core/linuxlist.h> #include <osmocom/core/select.h> +#include <osmocom/core/timer_compat.h> #include <osmocom/gsm/gsm0502.h> #include <osmocom/trx/ep.h> @@ -43,27 +46,59 @@ /*! Default "IND CLOCK" period, in frames */ #define CLCK_GEN_IND_PERIOD 102 +/*! Maximum number of 'missed' frame periods we can tolerate before assuming + * the PC clock skewed (e.g. someone changed the system time, or the process + * got stuck/suspended for a while). */ +#define CLCK_GEN_MAX_FN_SKEW 50 + struct clck_gen { struct osmo_fd timerfd; uint32_t fn; bool running; int start_fn; /*!< CLCK_GEN_START_FN_RANDOM, or a fixed FN */ uint32_t ind_period; /*!< send "IND CLOCK" every N frames */ + struct timespec last_tick; /*!< CLOCK_MONOTONIC time of the last timer_cb() */ }; +/*! Number of micro-seconds elapsed between \a last and \a now */ +static int64_t compute_elapsed_us(const struct timespec *last, const struct timespec *now) +{ + struct timespec elapsed; + + timespecsub(now, last, &elapsed); + return (int64_t)(elapsed.tv_sec * 1000000) + (elapsed.tv_nsec / 1000); +} + static struct clck_gen g_clck_gen = { .start_fn = CLCK_GEN_START_FN_RANDOM, .ind_period = CLCK_GEN_IND_PERIOD, }; +static void clck_gen_stop(struct clck_gen *gen); + static int clck_gen_timer_cb(struct osmo_fd *ofd, unsigned int what) { struct clck_gen *gen = ofd->data; + struct timespec tv_now; uint64_t expire_count; + int64_t elapsed_us; if (read(ofd->fd, &expire_count, sizeof(expire_count)) != sizeof(expire_count)) return 0; + /* check for PC clock skew (system time change, process stalled/suspended, ...) */ + clock_gettime(CLOCK_MONOTONIC, &tv_now); + elapsed_us = compute_elapsed_us(&gen->last_tick, &tv_now); + gen->last_tick = tv_now; + if (elapsed_us > GSM_TDMA_FN_DURATION_uS * CLCK_GEN_MAX_FN_SKEW || elapsed_us < 0) { + LOGP(DTRXC, LOGL_FATAL, + "PC clock skew too high (elapsed %" PRId64 " us): " + "stopping the TDMA clock generator\n", + elapsed_us); + clck_gen_stop(gen); + return 0; + } + while (expire_count-- > 0) { const struct proxy_trx *trx; @@ -100,6 +135,8 @@ else gen->fn = (uint32_t)gen->start_fn; + clock_gettime(CLOCK_MONOTONIC, &gen->last_tick); + if (osmo_timerfd_schedule(&gen->timerfd, &first, &interval) < 0) { LOGP(DTRXC, LOGL_ERROR, "Failed to start the TDMA clock generator\n"); return; -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43633?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I256ff6a4f4a05ea5507b5d9395a946672ff4e306 Gerrit-Change-Number: 43633 Gerrit-PatchSet: 5 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • ...
  • 190
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.