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 -----
  • 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

April 2023

  • 1 participants
  • 2252 discussions
[S] Change in osmo-ci[master]: jobs/osmocom-obs: drop obs.osmocom.org suffix
by osmith 05 Apr '23

05 Apr '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/32231 ) Change subject: jobs/osmocom-obs: drop obs.osmocom.org suffix ...................................................................... jobs/osmocom-obs: drop obs.osmocom.org suffix Having the OBS URL at the end of the jenkins job was useful when we were uploading to obs.osmocom.org and build.opensuse.org at the same time during the transitional phase. Remove the URL from the job name as this isn't the case anymore, and so the jobs look consistent with new Osmocom_OBS jobs. Change-Id: I460f9e6a508421773e300eee6c5c5654e5760cdb --- M jobs/master-builds.yml M jobs/osmocom-obs.yml 2 files changed, 20 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/31/32231/1 diff --git a/jobs/master-builds.yml b/jobs/master-builds.yml index 01e5ac0..828bf52 100644 --- a/jobs/master-builds.yml +++ b/jobs/master-builds.yml @@ -581,7 +581,7 @@ - trigger: project: '{obj:trigger}' - trigger: - project: 'Osmocom_OBS_master_obs.osmocom.org' + project: 'Osmocom_OBS_master' - email: recipients: '{obj:email}' send-to-individuals: true diff --git a/jobs/osmocom-obs.yml b/jobs/osmocom-obs.yml index b0e0e62..4870066 100644 --- a/jobs/osmocom-obs.yml +++ b/jobs/osmocom-obs.yml @@ -2,7 +2,7 @@ - project: name: Osmocom_OBS jobs: - - Osmocom_OBS_{type}_{server} + - Osmocom_OBS_{type} type: - master: conflict_version: "" @@ -12,12 +12,9 @@ conflict_version: "$(date +%Y%m%d%H%M)" - latest: conflict_version: "" - server: - - obs.osmocom.org: - proj: "osmocom" - job-template: - name: 'Osmocom_OBS_{type}_{server}' + name: 'Osmocom_OBS_{type}' project-type: freestyle concurrent: false defaults: global @@ -39,12 +36,12 @@ export PYTHONUNBUFFERED=1 ./scripts/obs/update_obs_project.py \ - --apiurl {server} \ + --apiurl https://obs.osmocom.org \ --conflict-version {conflict_version} \ --docker \ --feed {type} \ --meta \ - {proj}:{type} + osmocom:{type} scm: - git: branches: -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/32231 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I460f9e6a508421773e300eee6c5c5654e5760cdb Gerrit-Change-Number: 32231 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-ci[master]: jobs/osmocom-obs-rhizomatica: add new jobs
by osmith 05 Apr '23

05 Apr '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/32230 ) Change subject: jobs/osmocom-obs-rhizomatica: add new jobs ...................................................................... jobs/osmocom-obs-rhizomatica: add new jobs Related: OS#5981 Change-Id: I9d59f517eb4ecfd721ef1dba4519a874590f756e --- A jobs/osmocom-obs-rhizomatica.yml 1 file changed, 83 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/30/32230/1 diff --git a/jobs/osmocom-obs-rhizomatica.yml b/jobs/osmocom-obs-rhizomatica.yml new file mode 100644 index 0000000..92ab465 --- /dev/null +++ b/jobs/osmocom-obs-rhizomatica.yml @@ -0,0 +1,73 @@ +--- +- project: + name: Osmocom_OBS_rhizomatica + jobs: + - Osmocom_OBS_rhizomatica_{branch_suffix} + branch_suffix: + - testing + - production + +- job-template: + name: 'Osmocom_OBS_rhizomatica_{branch_suffix}' + project-type: freestyle + concurrent: false + defaults: global + description: | + Iterate over Osmocom projects, and update projects from the + "rhizomatica/{branch_suffix}" branch in OBS. If a package exists in OBS + for a project, but it doesn't have the git branch anymore then delete the + package from OBS (<a href="https://osmocom.org/issues/5981">OS#5981</a>). + properties: + - build-discarder: + days-to-keep: 30 + num-to-keep: 30 + node: obs + parameters: + - string: + name: CI_BRANCH + description: osmo-ci.git branch + default: 'master' + builders: + - shell: | + export PYTHONUNBUFFERED=1 + BRANCH="rhizomatica/{branch_suffix}" + PROJ="rhizomatica:{branch_suffix}" + VERSION_APPEND="~rhizomatica.{branch_suffix}" + PACKAGE="$GERRIT_PROJECT" + + # When manually triggered, run on all Osmocom packages + if [ -z "$PACKAGE" ]; then + PACKAGE="ALL_OSMOCOM_PACKAGES" + fi + + ./scripts/obs/update_obs_project.py \ + --apiurl https://obs.osmocom.org \ + --conflict-pkgname "osmocom-latest" \ + --delete \ + --docker \ + --feed "master" \ + --git-branch "$BRANCH" \ + --version-append "$VERSION_APPEND" \ + "$PROJ" \ + "$PACKAGE" + scm: + - git: + branches: + - '$CI_BRANCH' + url: https://gerrit.osmocom.org/osmo-ci + git-config-name: 'Jenkins Builder' + git-config-email: 'jenkins(a)osmocom.org' + triggers: + - gerrit: + trigger-on: + - ref-updated-event + projects: + - project-compare-type: 'ANT' + project-pattern: '**' + branches: + - branch-pattern: 'rhizomatica/{branch_suffix}' + server-name: gerrit.osmocom.org + publishers: + - email: + notify-every-unstable-build: true + recipients: 'jenkins-notifications(a)lists.osmocom.org' -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/32230 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I9d59f517eb4ecfd721ef1dba4519a874590f756e Gerrit-Change-Number: 32230 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-ci[master]: obs: add --conflict-pkgname arg
by osmith 05 Apr '23

05 Apr '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/32227 ) Change subject: obs: add --conflict-pkgname arg ...................................................................... obs: add --conflict-pkgname arg Prepare to create new feeds for the rhizomatica/testing and rhizomatica/production branches, which will be based on osmocom:latest. They will have osmocom-latest as conflict package even though their feed name is not latest. Related: OS#5981 Change-Id: I58e33bb003e2a4af9e9a7b53e5f79a91c3b541eb --- M scripts/obs/lib/__init__.py M scripts/obs/lib/metapkg.py M scripts/obs/lib/srcpkg.py 3 files changed, 20 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/27/32227/1 diff --git a/scripts/obs/lib/__init__.py b/scripts/obs/lib/__init__.py index 9682b19..842dd41 100644 --- a/scripts/obs/lib/__init__.py +++ b/scripts/obs/lib/__init__.py @@ -60,6 +60,9 @@ " 20YYqX packages to ensure they are not mixed" " from different build dates (ABI compatibility" " is only on latest).") + parser.add_argument("-p", "--conflict-pkgname", nargs="?", + help="name of the meta-package to depend on (default:" + " osmocom-$feed)") parser.add_argument("-v", "--verbose", action="store_true", help="always print shell commands and their output," " instead of only printing them on error") diff --git a/scripts/obs/lib/metapkg.py b/scripts/obs/lib/metapkg.py index 847a56b..38ed930 100644 --- a/scripts/obs/lib/metapkg.py +++ b/scripts/obs/lib/metapkg.py @@ -87,7 +87,7 @@ def build(): feed = lib.args.feed - pkgname = f"osmocom-{feed}" + pkgname = lib.args.conflict_pkgname or f"osmocom-{feed}" conflict_version = lib.args.conflict_version version = conflict_version if conflict_version else "1.0.0" print(f"{pkgname}: generating meta package {version}") diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py index a58ae15..2751005 100644 --- a/scripts/obs/lib/srcpkg.py +++ b/scripts/obs/lib/srcpkg.py @@ -157,7 +157,7 @@ write_tarball_version(project, version_epoch) if project in lib.config.projects_osmocom: - metapkg = f"osmocom-{feed}" + metapkg = lib.args.conflict_pkgname or f"osmocom-{feed}" lib.debian.control_add_depend(project, metapkg, conflict_version) if has_rpm_spec: lib.rpm_spec.add_depend(project, metapkg, conflict_version) -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/32227 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I58e33bb003e2a4af9e9a7b53e5f79a91c3b541eb Gerrit-Change-Number: 32227 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-ci[master]: obs: update_obs_project: add --delete arg
by osmith 05 Apr '23

05 Apr '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/32228 ) Change subject: obs: update_obs_project: add --delete arg ...................................................................... obs: update_obs_project: add --delete arg Add a new argument to delete packages from OBS if the git branch does not exist anymore, but the packages still exists in OBS. Related: OS#5981 Change-Id: Ib5ccf93a5a0cf8981fc35976bb9e0d3a29721b8d --- M scripts/obs/lib/git.py M scripts/obs/lib/osc.py M scripts/obs/update_obs_project.py 3 files changed, 56 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/28/32228/1 diff --git a/scripts/obs/lib/git.py b/scripts/obs/lib/git.py index 15cb276..0194f77 100644 --- a/scripts/obs/lib/git.py +++ b/scripts/obs/lib/git.py @@ -90,7 +90,7 @@ return ret.output.rstrip() -def get_head_remote(project, branch): +def get_head_remote(project, branch, branch_missing_ok=True): if not branch: branch = get_default_branch(project) repo_url = get_repo_url(project) @@ -99,7 +99,13 @@ ls_remote = lib.run_cmd(["git", "ls-remote", repo_url, f"heads/{branch}"]) ret = ls_remote.output.split("\t")[0] + + # If the branch is missing from the remote, git ls-remote exits with 0 and + # the output is empty if not ret: + if branch_missing_ok: + print(f"{project}: branch not found: {branch}") + return None lib.exit_error_cmd(ls_remote, "failed to find head commit for" f" {project} in output") diff --git a/scripts/obs/lib/osc.py b/scripts/obs/lib/osc.py index c2f6ad4..c9040ec 100644 --- a/scripts/obs/lib/osc.py +++ b/scripts/obs/lib/osc.py @@ -142,3 +142,9 @@ run_osc(["commit", "-m", f"upgrade to {version}"], cwd=path_temp_osc_pkg) remove_temp_osc() + + +def delete_package(package, commit_msg): + print(f"{package}: removing from OBS ({commit_msg})") + run_osc(["rdelete", "-m", commit_msg, lib.args.obs_project, + os.path.basename(package)]) diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py index da796ad..8c4da5e 100755 --- a/scripts/obs/update_obs_project.py +++ b/scripts/obs/update_obs_project.py @@ -14,6 +14,7 @@ srcpkgs_built = {} # dict of pkgname: version srcpkgs_skipped = [] # list of pkgnames +srcpkgs_deleted = [] # list of pkgnames srcpkgs_failed_build = [] # list of pkgnames srcpkgs_failed_upload = [] # list of pkgnames srcpkgs_updated = [] # list of pkgnames @@ -51,6 +52,14 @@ srcpkgs_failed_build += [package] +def delete_srcpkg(package): + global srcpkgs_deleted + branch = lib.args.git_branch + + lib.osc.delete_package(package, f"branch {branch} does not exist anymore") + srcpkgs_deleted += [package] + + def is_up_to_date(obs_version, git_latest_version): if obs_version == git_latest_version: return True @@ -66,6 +75,7 @@ global srcpkgs_skipped feed = lib.args.feed branch = lib.args.git_branch + delete = lib.args.delete if feed in ["master", "latest"]: """ Check if we can skip this package by comparing the OBS version with @@ -75,12 +85,17 @@ latest_version = conflict_version if conflict_version else "1.0.0" else: if feed == "master": - latest_version = lib.git.get_head_remote(package, branch) + latest_version = lib.git.get_head_remote(package, branch, + branch_missing_ok=delete) else: latest_version = lib.git.get_latest_tag_remote(package) if latest_version is None: - print(f"{package}: skipping (no git tag found)") + if delete and os.path.basename(package) in pkgs_remote: + delete_srcpkg(package) + return + + print(f"{package}: skipping (no git tag/branch found)") srcpkgs_skipped += [package] return @@ -164,6 +179,7 @@ print(f"Skipped: {len(srcpkgs_skipped)}") print(f"Failed (srcpkg build): {len(srcpkgs_failed_build)}") print(f"Failed (srcpkg upload): {len(srcpkgs_failed_upload)}") + print(f"Deleted: {len(srcpkgs_deleted)}") if not srcpkgs_failed_build and not srcpkgs_failed_upload: exit(0) @@ -178,6 +194,14 @@ exit(1) +def validate_args(args): + # Only with feed=master we check the current commit of a branch on a remote + # git repository before trying to update/delete a package from OBS + if args.delete and args.feed != "master": + print("ERROR: --delete can only be used with --feed=master") + exit(1) + + def main(): parser = argparse.ArgumentParser( description="Generate source packages and upload them to OBS.") @@ -188,12 +212,16 @@ dest="skip_up_to_date", action="store_false", help="for latest feed, build and upload packages even" " if the version did not change") + parser.add_argument("--delete", action="store_true", + help="remove packages from OBS if the git branch (-b)" + " does not exist anymore") parser.add_argument("obs_project", help="OBS project, e.g. home:osmith:nightly") parser.add_argument("package", nargs="*", help="package name, e.g. libosmocore or open5gs," " default is all packages") args = parser.parse_args() + validate_args(args) lib.set_args(args) packages = parse_packages(args.package) -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/32228 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: Ib5ccf93a5a0cf8981fc35976bb9e0d3a29721b8d Gerrit-Change-Number: 32228 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-ci[master]: obs: update_obs_project: add ALL_OSMOCOM_PACKAGES
by osmith 05 Apr '23

05 Apr '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/32229 ) Change subject: obs: update_obs_project: add ALL_OSMOCOM_PACKAGES ...................................................................... obs: update_obs_project: add ALL_OSMOCOM_PACKAGES Add this alias to use all Osmocom packages, but no the misc packages that would also be selected if not specifying the packages argument at all (limesuite, neocon, open5gs). This will be used for building packages from the rhizomatica branches, so we don't check the git repositories of these misc projects for the git branches. Related: OS#5981 Change-Id: I4265f43408bc21ac8765449d6766381c75cafe86 --- M scripts/obs/update_obs_project.py 1 file changed, 24 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/29/32229/1 diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py index 8c4da5e..599e5cd 100755 --- a/scripts/obs/update_obs_project.py +++ b/scripts/obs/update_obs_project.py @@ -24,7 +24,10 @@ ret = [] if packages_arg: for package in packages_arg: - ret += [lib.set_proper_package_name(package)] + if package == "ALL_OSMOCOM_PACKAGES": + ret += lib.config.projects_osmocom + else: + ret += [lib.set_proper_package_name(package)] return ret # Default to all @@ -218,8 +221,8 @@ parser.add_argument("obs_project", help="OBS project, e.g. home:osmith:nightly") parser.add_argument("package", nargs="*", - help="package name, e.g. libosmocore or open5gs," - " default is all packages") + help="package name, e.g. libosmocore or open5gs or" + " ALL_OSMOCOM_PACKAGES, default is all packages") args = parser.parse_args() validate_args(args) lib.set_args(args) -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/32229 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I4265f43408bc21ac8765449d6766381c75cafe86 Gerrit-Change-Number: 32229 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-bts[master]: Move NSVC structs to be part of NSE
by pespin 05 Apr '23

05 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32225 ) Change subject: Move NSVC structs to be part of NSE ...................................................................... Move NSVC structs to be part of NSE The NSVCs exist inside an NSE. Rearrange data model to have proper relations. Change-Id: I1cfe9366594836c622673d461ab8b2edd1a2b58a --- M include/osmo-bts/bts.h M src/common/bts.c M src/common/oml.c M src/common/pcu_sock.c M src/common/vty.c 5 files changed, 47 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/25/32225/1 diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index 03a29e4..6a4d23e 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -125,9 +125,10 @@ }; /* GPRS NSVC; ip.access specific NM Object */ -struct gsm_bts_gprs_nsvc { +struct gsm_gprs_nse; +struct gsm_gprs_nsvc { struct gsm_abis_mo mo; - struct gsm_bts *bts; + struct gsm_gprs_nse *nse; /* data read via VTY config file, to configure the BTS * via OML from BSC */ int id; @@ -141,6 +142,7 @@ struct gsm_abis_mo mo; uint16_t nsei; uint8_t timer[7]; + struct gsm_gprs_nsvc nsvc[2]; }; /* GPRS CELL; ip.access specific NM Object */ @@ -241,7 +243,6 @@ struct { struct gsm_gprs_nse nse; struct gsm_gprs_cell cell; - struct gsm_bts_gprs_nsvc nsvc[2]; uint8_t rac; } gprs; diff --git a/src/common/bts.c b/src/common/bts.c index 5845fb2..23e4456 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -232,6 +232,7 @@ struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num) { struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts); + struct gsm_gprs_nse *nse = &bts->gprs.nse; int i; if (!bts) @@ -264,12 +265,11 @@ gsm_mo_init(&bts->mo, bts, NM_OC_BTS, bts->nr, 0xff, 0xff); /* NM GPRS NSE */ - bts->gprs.nse.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_nse_fsm, bts, &bts->gprs.nse, + nse->mo.fi = osmo_fsm_inst_alloc(&nm_gprs_nse_fsm, bts, nse, LOGL_INFO, NULL); - osmo_fsm_inst_update_id_f(bts->gprs.nse.mo.fi, "gprs_nse%d", bts->nr); - gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff); - memcpy(&bts->gprs.nse.timer, bts_nse_timer_default, - sizeof(bts->gprs.nse.timer)); + osmo_fsm_inst_update_id_f(nse->mo.fi, "gprs_nse%d", bts->nr); + gsm_mo_init(&nse->mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff); + memcpy(&nse->timer, bts_nse_timer_default, sizeof(nse->timer)); /* NM GPRS CELL */ bts->gprs.cell.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_cell_fsm, bts, &bts->gprs.cell, @@ -279,11 +279,11 @@ memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default, sizeof(bts->gprs.cell.rlc_cfg)); memcpy(&bts->gprs.cell.timer, bts_cell_timer_default, sizeof(bts->gprs.cell.timer)); - for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { - bts->gprs.nsvc[i].bts = bts; - bts->gprs.nsvc[i].id = i; - gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC, - bts->nr, i, 0xff); + for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) { + struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i]; + nsvc->nse = nse; + nsvc->id = i; + gsm_mo_init(&nsvc->mo, bts, NM_OC_GPRS_NSVC, nse->mo.obj_inst.bts_nr, i, 0xff); } /* create our primary TRX. It will be initialized during bts_init() */ @@ -384,8 +384,8 @@ oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED); /* set BTS attr to dependency */ - oml_mo_state_init(&bts->gprs.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY); - oml_mo_state_init(&bts->gprs.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY); + oml_mo_state_init(&bts->gprs.nse.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY); + oml_mo_state_init(&bts->gprs.nse.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY); /* allocate a talloc pool for ORTP to ensure it doesn't have to go back * to the libc malloc all the time */ @@ -460,8 +460,8 @@ osmo_fsm_inst_dispatch(bts->gprs.nse.mo.fi, NM_EV_SW_ACT, NULL); /* those should all be in DEPENDENCY */ - oml_tx_state_changed(&bts->gprs.nsvc[0].mo); - oml_tx_state_changed(&bts->gprs.nsvc[1].mo); + oml_tx_state_changed(&bts->gprs.nse.nsvc[0].mo); + oml_tx_state_changed(&bts->gprs.nse.nsvc[1].mo); /* All other objects start off-line until the BTS Model code says otherwise */ for (i = 0; i < bts->num_trx; i++) { diff --git a/src/common/oml.c b/src/common/oml.c index e23a087..fd8c22c 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -1373,7 +1373,7 @@ return 0; } -static int oml_ipa_mo_set_attr_nsvc(struct gsm_bts_gprs_nsvc *nsvc, +static int oml_ipa_mo_set_attr_nsvc(struct gsm_gprs_nsvc *nsvc, const struct tlv_parsed *tp) { if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_NSVCI, 2)) @@ -1746,9 +1746,9 @@ mo = &bts->gprs.cell.mo; break; case NM_OC_GPRS_NSVC: - if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc)) + if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nse.nsvc)) return NULL; - mo = &bts->gprs.nsvc[obj_inst->trx_nr].mo; + mo = &bts->gprs.nse.nsvc[obj_inst->trx_nr].mo; break; } return mo; @@ -1813,9 +1813,9 @@ obj = &bts->gprs.cell; break; case NM_OC_GPRS_NSVC: - if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc)) + if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nse.nsvc)) return NULL; - obj = &bts->gprs.nsvc[obj_inst->trx_nr]; + obj = &bts->gprs.nse.nsvc[obj_inst->trx_nr]; break; } return obj; diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 5e4b06b..bce067a 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -239,11 +239,13 @@ struct gprs_rlc_cfg *rlcc; struct gsm_bts_trx *trx; int i; + struct gsm_gprs_nse *nse; LOGP(DPCU, LOGL_INFO, "Sending info\n"); /* FIXME: allow multiple BTS */ bts = llist_entry(net->bts_list.next, struct gsm_bts, list); + nse = &bts->gprs.nse; rlcc = &bts->gprs.cell.rlc_cfg; msg = pcu_msgb_alloc(PCU_IF_MSG_INFO_IND, bts->nr); @@ -271,8 +273,8 @@ info_ind->rac = bts->gprs.rac; /* NSE */ - info_ind->nsei = bts->gprs.nse.nsei; - memcpy(info_ind->nse_timer, bts->gprs.nse.timer, 7); + info_ind->nsei = nse->nsei; + memcpy(info_ind->nse_timer, nse->timer, 7); memcpy(info_ind->cell_timer, bts->gprs.cell.timer, 11); /* cell attributes */ @@ -323,8 +325,8 @@ info_ind->initial_mcs = rlcc->initial_mcs; /* NSVC */ - for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { - const struct gsm_bts_gprs_nsvc *nsvc = &bts->gprs.nsvc[i]; + for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) { + const struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i]; info_ind->nsvci[i] = nsvc->nsvci; /* PCUIF beauty: the NSVC addresses are sent in the network byte order, * while the port numbers need to be send in the host order. Sigh. */ @@ -363,7 +365,7 @@ void *hdlr_data, void *signal_data) { struct gsm_network *net = &bts_gsmnet; - struct gsm_bts_gprs_nsvc *nsvc; + struct gsm_gprs_nsvc *nsvc; struct gsm_bts *bts; struct gsm48_system_information_type_3 *si3; int id; diff --git a/src/common/vty.c b/src/common/vty.c index 1ef79f0..bc2afb6 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1361,21 +1361,22 @@ static void gprs_dump_vty(struct vty *vty, const struct gsm_bts *bts) { unsigned int i; + const struct gsm_gprs_nse *nse = &bts->gprs.nse; /* GPRS parameters received from the BSC */ vty_out(vty, "BTS %u, RAC %u, NSEI %u, BVCI %u%s", bts->nr, bts->gprs.rac, - bts->gprs.nse.nsei, + nse->nsei, bts->gprs.cell.bvci, VTY_NEWLINE); vty_out(vty, " Cell NM state: "); net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state); vty_out(vty, " NSE NM state: "); - net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state); + net_dump_nmstate(vty, &nse->mo.nm_state); - for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { - const struct gsm_bts_gprs_nsvc *nsvc = &bts->gprs.nsvc[i]; + for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) { + const struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i]; vty_out(vty, " NSVC%u (NSVCI %u) NM state: ", i, nsvc->nsvci); net_dump_nmstate(vty, &nsvc->mo.nm_state); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32225 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I1cfe9366594836c622673d461ab8b2edd1a2b58a Gerrit-Change-Number: 32225 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bts[master]: Rearrange declaration of struct gsm_bts_gprs_nsvc
by pespin 05 Apr '23

05 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32224 ) Change subject: Rearrange declaration of struct gsm_bts_gprs_nsvc ...................................................................... Rearrange declaration of struct gsm_bts_gprs_nsvc Move it together with the other similar objects like gprs_nse and gprs_cell. Move the "mo" field to the start of the struct, similar to the other types. Change-Id: I5dc020a6bab8c94ab831b6ca506bc5cb681d07a3 --- M include/osmo-bts/bts.h 1 file changed, 26 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/24/32224/1 diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index c5a0709..03a29e4 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -72,18 +72,6 @@ #define bts_internal_flag_set(bts, flag) \ bts->flags |= (typeof(bts->flags)) flag -struct gsm_bts_gprs_nsvc { - struct gsm_bts *bts; - /* data read via VTY config file, to configure the BTS - * via OML from BSC */ - int id; - uint16_t nsvci; - struct osmo_sockaddr local; /* on the BTS */ - struct osmo_sockaddr remote; /* on the SGSN */ - - struct gsm_abis_mo mo; -}; - struct gprs_rlc_cfg { uint16_t parameter[_NUM_RLC_PAR]; struct { @@ -136,6 +124,18 @@ struct gsm_abis_mo mo; }; +/* GPRS NSVC; ip.access specific NM Object */ +struct gsm_bts_gprs_nsvc { + struct gsm_abis_mo mo; + struct gsm_bts *bts; + /* data read via VTY config file, to configure the BTS + * via OML from BSC */ + int id; + uint16_t nsvci; + struct osmo_sockaddr local; /* on the BTS */ + struct osmo_sockaddr remote; /* on the SGSN */ +}; + /* GPRS NSE; ip.access specific NM Object */ struct gsm_gprs_nse { struct gsm_abis_mo mo; -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32224 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I5dc020a6bab8c94ab831b6ca506bc5cb681d07a3 Gerrit-Change-Number: 32224 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmo-bts[master]: Introduce NM FSM for GPRS NSVC object
by pespin 05 Apr '23

05 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32226 ) Change subject: Introduce NM FSM for GPRS NSVC object ...................................................................... Introduce NM FSM for GPRS NSVC object Change-Id: I684482064136a461d01cace3cd37afc8b68458cc Related: OS#5994 --- M include/osmo-bts/nm_common_fsm.h M src/common/Makefile.am M src/common/bts.c M src/common/nm_gprs_nse_fsm.c A src/common/nm_gprs_nsvc_fsm.c M src/common/oml.c M src/osmo-bts-lc15/oml.c M src/osmo-bts-oc2g/oml.c M src/osmo-bts-octphy/l1_oml.c M src/osmo-bts-omldummy/bts_model.c M src/osmo-bts-sysmo/oml.c M src/osmo-bts-trx/l1_if.c M src/osmo-bts-virtual/bts_model.c 13 files changed, 318 insertions(+), 54 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/26/32226/1 diff --git a/include/osmo-bts/nm_common_fsm.h b/include/osmo-bts/nm_common_fsm.h index c599a21..85db0de 100644 --- a/include/osmo-bts/nm_common_fsm.h +++ b/include/osmo-bts/nm_common_fsm.h @@ -104,6 +104,15 @@ }; extern struct osmo_fsm nm_gprs_nse_fsm; +/* GPRS NSVC */ +enum nm_gprs_nsvc_op_fsm_states { + NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED, + NM_GPRS_NSVC_ST_OP_DISABLED_DEPENDENCY, + NM_GPRS_NSVC_ST_OP_DISABLED_OFFLINE, + NM_GPRS_NSVC_ST_OP_ENABLED, +}; +extern struct osmo_fsm nm_gprs_nsvc_fsm; + /* GPRS CELL */ enum nm_gprs_cell_op_fsm_states { NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED, diff --git a/src/common/Makefile.am b/src/common/Makefile.am index d904ab1..f082543 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -63,6 +63,7 @@ nm_channel_fsm.c \ nm_gprs_cell_fsm.c \ nm_gprs_nse_fsm.c \ + nm_gprs_nsvc_fsm.c \ nm_radio_carrier_fsm.c \ probes.d \ $(NULL) diff --git a/src/common/bts.c b/src/common/bts.c index 23e4456..34fcf36 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -279,10 +279,15 @@ memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default, sizeof(bts->gprs.cell.rlc_cfg)); memcpy(&bts->gprs.cell.timer, bts_cell_timer_default, sizeof(bts->gprs.cell.timer)); + /* NM GPRS NSVCs */ for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) { struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i]; nsvc->nse = nse; nsvc->id = i; + nsvc->mo.fi = osmo_fsm_inst_alloc(&nm_gprs_nsvc_fsm, bts, nsvc, + LOGL_INFO, NULL); + osmo_fsm_inst_update_id_f(nsvc->mo.fi, "gprs_nsvc%d-%d", + nse->mo.obj_inst.bts_nr, i); gsm_mo_init(&nsvc->mo, bts, NM_OC_GPRS_NSVC, nse->mo.obj_inst.bts_nr, i, 0xff); } @@ -382,10 +387,10 @@ oml_mo_state_init(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED); oml_mo_state_init(&bts->gprs.nse.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED); oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED); - - /* set BTS attr to dependency */ - oml_mo_state_init(&bts->gprs.nse.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY); - oml_mo_state_init(&bts->gprs.nse.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY); + for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.nsvc); i++) { + struct gsm_gprs_nsvc *nsvc = &bts->gprs.nse.nsvc[i]; + oml_mo_state_init(&nsvc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED); + } /* allocate a talloc pool for ORTP to ensure it doesn't have to go back * to the libc malloc all the time */ @@ -454,14 +459,14 @@ LOGP(DOML, LOGL_INFO, "Main link established, sending NM Status.\n"); - /* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS, NSE is DEPENDENCY */ + /* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS, NSE, etc. is DEPENDENCY */ osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SW_ACT, NULL); osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_SW_ACT, NULL); osmo_fsm_inst_dispatch(bts->gprs.nse.mo.fi, NM_EV_SW_ACT, NULL); - - /* those should all be in DEPENDENCY */ - oml_tx_state_changed(&bts->gprs.nse.nsvc[0].mo); - oml_tx_state_changed(&bts->gprs.nse.nsvc[1].mo); + for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.nsvc); i++) { + struct gsm_gprs_nsvc *nsvc = &bts->gprs.nse.nsvc[i]; + osmo_fsm_inst_dispatch(nsvc->mo.fi, NM_EV_SW_ACT, NULL); + } /* All other objects start off-line until the BTS Model code says otherwise */ for (i = 0; i < bts->num_trx; i++) { diff --git a/src/common/nm_gprs_nse_fsm.c b/src/common/nm_gprs_nse_fsm.c index ba956fd..806ebb7 100644 --- a/src/common/nm_gprs_nse_fsm.c +++ b/src/common/nm_gprs_nse_fsm.c @@ -44,15 +44,14 @@ static void ev_dispatch_children(struct gsm_gprs_nse *nse, uint32_t event) { + unsigned int i; struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse); + osmo_fsm_inst_dispatch(bts->gprs.cell.mo.fi, event, NULL); - /* TODO: once we have FSMs for GPRS Cell and GPRS NSVC: */ -#if 0 - if (bts->gprs.nsvc[0].fi) - osmo_fsm_inst_dispatch(bts->gprs.nsvc[0].fi, event, NULL); - if (bts->gprs.nsvc[1].fi) - osmo_fsm_inst_dispatch(bts->gprs.nsvc[1].fi, event, NULL); -#endif + for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) { + struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i]; + osmo_fsm_inst_dispatch(nsvc->mo.fi, NM_EV_SW_ACT, NULL); + } } /* Can the NSE be enabled (OPSTARTed)? aka should it stay in "Disabled Dependency" state? */ diff --git a/src/common/nm_gprs_nsvc_fsm.c b/src/common/nm_gprs_nsvc_fsm.c new file mode 100644 index 0000000..2f8241a --- /dev/null +++ b/src/common/nm_gprs_nsvc_fsm.c @@ -0,0 +1,258 @@ +/* NM GPRS NSVC FSM */ + +/* (C) 2023 by sysmocom - s.m.f.c. GmbH <info(a)sysmocom.de> + * Author: Pau Espin Pedrol <pespin(a)sysmocom.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public Licensvc as published by + * the Free Software Foundation; either version 3 of the Licensvc, 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 General Public Licensvc for more details. + * + * You should have received a copy of the GNU Affero General Public Licensvc + * along with this program. If not, see <http://www.gnu.org/licensvcs/>. + * + */ + +#include <errno.h> +#include <unistd.h> +#include <inttypes.h> + +#include <osmocom/core/fsm.h> +#include <osmocom/core/tdef.h> +#include <osmocom/gsm/protocol/gsm_12_21.h> + +#include <osmo-bts/logging.h> +#include <osmo-bts/gsm_data.h> +#include <osmo-bts/bts_model.h> +#include <osmo-bts/bts.h> +#include <osmo-bts/rsl.h> +#include <osmo-bts/nm_common_fsm.h> + +#define X(s) (1 << (s)) + +#define nm_gprs_nsvc_fsm_state_chg(fi, NEXT_STATE) \ + osmo_fsm_inst_state_chg(fi, NEXT_STATE, 0, 0) + +/* Can the GPRS Cell be enabled (OPSTARTed)? aka should it stay in "Disabled Dependency" state? */ +static bool gprs_nsvc_can_be_enabled(struct gsm_gprs_nsvc *nsvc) +{ + struct gsm_bts *bts = gsm_gprs_nse_get_bts(nsvc->nse); + return bts->gprs.nse.mo.nm_state.operational == NM_OPSTATE_ENABLED; +} + + +////////////////////////// +// FSM STATE ACTIONS +////////////////////////// + +static void st_op_disabled_notinstalled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + /* Reset state here: */ + + nsvc->mo.setattr_success = false; + nsvc->mo.opstart_success = false; + oml_mo_state_chg(&nsvc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED); +} + +static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + + switch (event) { + case NM_EV_SW_ACT: + oml_mo_tx_sw_act_rep(&nsvc->mo); + if (gprs_nsvc_can_be_enabled(nsvc)) + nm_gprs_nsvc_fsm_state_chg(fi, NM_GPRS_NSVC_ST_OP_DISABLED_OFFLINE); + else + nm_gprs_nsvc_fsm_state_chg(fi, NM_GPRS_NSVC_ST_OP_DISABLED_DEPENDENCY); + return; + default: + OSMO_ASSERT(0); + } +} + +static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + nsvc->mo.setattr_success = false; + nsvc->mo.opstart_success = false; + oml_mo_state_chg(&nsvc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY, -1); +} + +static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + struct gsm_bts *bts = gsm_gprs_nse_get_bts(nsvc->nse); + struct nm_fsm_ev_setattr_data *setattr_data; + int rc; + + switch (event) { + case NM_EV_RX_SETATTR: + setattr_data = (struct nm_fsm_ev_setattr_data *)data; + rc = bts_model_apply_oml(bts, setattr_data->msg, + &nsvc->mo, nsvc); + nsvc->mo.setattr_success = rc == 0; + oml_fom_ack_nack_copy_msg(setattr_data->msg, rc); + break; + case NM_EV_RX_OPSTART: + if (!nsvc->mo.setattr_success) { + oml_mo_opstart_nack(&nsvc->mo, NM_NACK_CANT_PERFORM); + return; + } + bts_model_opstart(bts, &nsvc->mo, nsvc); + break; + case NM_EV_OPSTART_ACK: + nsvc->mo.opstart_success = true; + oml_mo_opstart_ack(&nsvc->mo); + nm_gprs_nsvc_fsm_state_chg(fi, NM_CHAN_ST_OP_ENABLED); + return; + case NM_EV_OPSTART_NACK: + nsvc->mo.opstart_success = false; + oml_mo_opstart_nack(&nsvc->mo, (int)(intptr_t)data); + return; + default: + OSMO_ASSERT(0); + } +} + +static void st_op_disabled_offline_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + nsvc->mo.opstart_success = false; + oml_mo_state_chg(&nsvc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1); +} + +static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + struct gsm_bts *bts = gsm_gprs_nse_get_bts(nsvc->nse); + struct nm_fsm_ev_setattr_data *setattr_data; + int rc; + + switch (event) { + case NM_EV_RX_SETATTR: + setattr_data = (struct nm_fsm_ev_setattr_data *)data; + rc = bts_model_apply_oml(bts, setattr_data->msg, &nsvc->mo, bts); + nsvc->mo.setattr_success = rc == 0; + oml_fom_ack_nack_copy_msg(setattr_data->msg, rc); + break; + case NM_EV_RX_OPSTART: + if (!nsvc->mo.setattr_success) { + oml_mo_opstart_nack(&nsvc->mo, NM_NACK_CANT_PERFORM); + return; + } + bts_model_opstart(bts, &nsvc->mo, bts); + break; + case NM_EV_OPSTART_ACK: + nsvc->mo.opstart_success = true; + oml_mo_opstart_ack(&nsvc->mo); + nm_gprs_nsvc_fsm_state_chg(fi, NM_GPRS_NSVC_ST_OP_ENABLED); + break; /* check statechg below */ + case NM_EV_OPSTART_NACK: + nsvc->mo.opstart_success = false; + oml_mo_opstart_nack(&nsvc->mo, (int)(intptr_t)data); + return; + default: + OSMO_ASSERT(0); + } +} + +static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + oml_mo_state_chg(&nsvc->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); +} + +static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ +} + +static void nm_gprs_nsvc_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct gsm_gprs_nsvc *nsvc = (struct gsm_gprs_nsvc *)fi->priv; + + switch (event) { + case NM_EV_SHUTDOWN_START: + /* Announce we start shutting down */ + oml_mo_state_chg(&nsvc->mo, -1, -1, NM_STATE_SHUTDOWN); + break; + case NM_EV_SHUTDOWN_FINISH: + nm_gprs_nsvc_fsm_state_chg(fi, NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED); + break; + default: + OSMO_ASSERT(false); + } +} + +static struct osmo_fsm_state nm_gprs_nsvc_fsm_states[] = { + [NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED] = { + .in_event_mask = + X(NM_EV_SW_ACT), + .out_state_mask = + X(NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED) | + X(NM_GPRS_NSVC_ST_OP_DISABLED_DEPENDENCY) | + X(NM_GPRS_NSVC_ST_OP_DISABLED_OFFLINE), + .name = "DISABLED_NOTINSTALLED", + .onenter = st_op_disabled_notinstalled_on_enter, + .action = st_op_disabled_notinstalled, + }, + [NM_GPRS_NSVC_ST_OP_DISABLED_DEPENDENCY] = { + .in_event_mask = + X(NM_EV_RX_SETATTR) | + X(NM_EV_RX_OPSTART) | /* backward compatibility, buggy BSC */ + X(NM_EV_OPSTART_ACK) | /* backward compatibility, buggy BSC */ + X(NM_EV_OPSTART_NACK), /* backward compatibility, buggy BSC */ + .out_state_mask = + X(NM_CHAN_ST_OP_DISABLED_NOTINSTALLED) | + X(NM_CHAN_ST_OP_DISABLED_OFFLINE) | + X(NM_CHAN_ST_OP_ENABLED), /* backward compatibility, buggy BSC */ + .name = "DISABLED_DEPENDENCY", + .onenter = st_op_disabled_dependency_on_enter, + .action = st_op_disabled_dependency, + }, + [NM_GPRS_NSVC_ST_OP_DISABLED_OFFLINE] = { + .in_event_mask = + X(NM_EV_RX_SETATTR) | + X(NM_EV_RX_OPSTART) | + X(NM_EV_OPSTART_ACK) | + X(NM_EV_OPSTART_NACK), + .out_state_mask = + X(NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED) | + X(NM_GPRS_NSVC_ST_OP_ENABLED), + .name = "DISABLED_OFFLINE", + .onenter = st_op_disabled_offline_on_enter, + .action = st_op_disabled_offline, + }, + [NM_GPRS_NSVC_ST_OP_ENABLED] = { + .in_event_mask = 0, + .out_state_mask = + X(NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED), + .name = "ENABLED", + .onenter = st_op_enabled_on_enter, + .action = st_op_enabled, + }, +}; + +struct osmo_fsm nm_gprs_nsvc_fsm = { + .name = "NM_GPRS_NSVC_OP", + .states = nm_gprs_nsvc_fsm_states, + .num_states = ARRAY_SIZE(nm_gprs_nsvc_fsm_states), + .event_names = nm_fsm_event_names, + .allstate_action = nm_gprs_nsvc_allstate, + .allstate_event_mask = X(NM_EV_SHUTDOWN_START) | + X(NM_EV_SHUTDOWN_FINISH), + .log_subsys = DOML, +}; + +static __attribute__((constructor)) void nm_gprs_nsvc_fsm_init(void) +{ + OSMO_ASSERT(osmo_fsm_register(&nm_gprs_nsvc_fsm) == 0); +} diff --git a/src/common/oml.c b/src/common/oml.c index fd8c22c..7a237f1 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -1094,12 +1094,8 @@ return oml_mo_opstart_ack(mo); } - if (!mo->fi) { - /* Some NM objets still don't have FSMs implemented, such as - * NM_OC_GPRS_NSVC. For those, don't go through FSM: - */ - return bts_model_opstart(bts, mo, obj); - } + /* Make sure all NM objects already have an FSM implemented: */ + OSMO_ASSERT(mo->fi); rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_RX_OPSTART, NULL); if (rc < 0) @@ -1374,8 +1370,12 @@ } static int oml_ipa_mo_set_attr_nsvc(struct gsm_gprs_nsvc *nsvc, + const struct msgb *msg, const struct tlv_parsed *tp) { + struct nm_fsm_ev_setattr_data ev_data; + int rc; + if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_NSVCI, 2)) nsvc->nsvci = ntohs(tlvp_val16_unal(tp, NM_ATT_IPACC_NSVCI)); @@ -1437,6 +1437,12 @@ } } + ev_data = (struct nm_fsm_ev_setattr_data){ + .msg = msg, + }; + rc = osmo_fsm_inst_dispatch(nsvc->mo.fi, NM_EV_RX_SETATTR, &ev_data); + if (rc < 0) + return NM_NACK_CANT_PERFORM; osmo_signal_dispatch(SS_GLOBAL, S_NEW_NSVC_ATTR, nsvc); @@ -1478,7 +1484,7 @@ rc = oml_ipa_mo_set_attr_cell(obj, msg, &tp); break; case NM_OC_GPRS_NSVC: - rc = oml_ipa_mo_set_attr_nsvc(obj, &tp); + rc = oml_ipa_mo_set_attr_nsvc(obj, msg, &tp); break; default: rc = NM_NACK_OBJINST_UNKN; @@ -1495,9 +1501,6 @@ talloc_free(mo->nm_attr); mo->nm_attr = tp_merged; - /* These are not yet handled through NM FSM: */ - if (mo->obj_class == NM_OC_GPRS_NSVC) - return oml_fom_ack_nack(msg, rc); return rc; } diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c index 34f107d..18e7fe8 100644 --- a/src/osmo-bts-lc15/oml.c +++ b/src/osmo-bts-lc15/oml.c @@ -1873,6 +1873,7 @@ case NM_OC_BASEB_TRANSC: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: + case NM_OC_GPRS_NSVC: rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: @@ -1883,10 +1884,6 @@ ts = (struct gsm_bts_trx_ts*) obj; rc = ts_opstart(ts); break; - case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); - rc = oml_mo_opstart_ack(mo); - break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); } diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c index 3625f72..f9fa683 100644 --- a/src/osmo-bts-oc2g/oml.c +++ b/src/osmo-bts-oc2g/oml.c @@ -1878,6 +1878,7 @@ case NM_OC_BASEB_TRANSC: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: + case NM_OC_GPRS_NSVC: rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: @@ -1888,10 +1889,6 @@ ts = (struct gsm_bts_trx_ts*) obj; rc = ts_opstart(ts); break; - case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); - rc = oml_mo_opstart_ack(mo); - break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); } diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index 543fef0..c5f9db5 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -1777,6 +1777,7 @@ case NM_OC_BASEB_TRANSC: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: + case NM_OC_GPRS_NSVC: rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: @@ -1787,10 +1788,6 @@ ts = (struct gsm_bts_trx_ts*) obj; rc = ts_connect_as(ts, ts->pchan, pchan_act_compl_cb, NULL); break; - case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1); - rc = oml_mo_opstart_ack(mo); - break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); } diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c index d85d9cd..eea771d 100644 --- a/src/osmo-bts-omldummy/bts_model.c +++ b/src/osmo-bts-omldummy/bts_model.c @@ -130,11 +130,8 @@ case NM_OC_CHANNEL: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: - rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); - break; case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); - rc = oml_mo_opstart_ack(mo); + rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index bcd70b5..01b1f97 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -1753,6 +1753,7 @@ case NM_OC_BASEB_TRANSC: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: + case NM_OC_GPRS_NSVC: rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: @@ -1763,10 +1764,6 @@ ts = (struct gsm_bts_trx_ts*) obj; rc = ts_opstart(ts); break; - case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); - rc = oml_mo_opstart_ack(mo); - break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); } diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index af7d034..b39c51f 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -586,6 +586,7 @@ case NM_OC_CHANNEL: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: + case NM_OC_GPRS_NSVC: rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: @@ -593,10 +594,6 @@ trx = (struct gsm_bts_trx *) obj; rc = trx_init(trx); break; - case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); - rc = oml_mo_opstart_ack(mo); - break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); } diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c index d758a82..eb71138 100644 --- a/src/osmo-bts-virtual/bts_model.c +++ b/src/osmo-bts-virtual/bts_model.c @@ -165,11 +165,8 @@ case NM_OC_CHANNEL: case NM_OC_GPRS_NSE: case NM_OC_GPRS_CELL: - rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); - break; case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1); - rc = oml_mo_opstart_ack(mo); + rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32226 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I684482064136a461d01cace3cd37afc8b68458cc Gerrit-Change-Number: 32226 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmo-bts[master]: Introduce NM FSM for GPRS Cell object
by pespin 05 Apr '23

05 Apr '23
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-bts/+/32222 to look at the new patch set (#2). Change subject: Introduce NM FSM for GPRS Cell object ...................................................................... Introduce NM FSM for GPRS Cell object Change-Id: I5fd1d17da09a5f0eee3d69fcb4788c106a240e21 Related: OS#5994 --- M include/osmo-bts/bts.h M include/osmo-bts/nm_common_fsm.h M src/common/Makefile.am M src/common/bts.c A src/common/nm_gprs_cell_fsm.c M src/common/nm_gprs_nse_fsm.c M src/common/oml.c M src/osmo-bts-lc15/oml.c M src/osmo-bts-oc2g/oml.c M src/osmo-bts-octphy/l1_oml.c M src/osmo-bts-omldummy/bts_model.c M src/osmo-bts-sysmo/oml.c M src/osmo-bts-trx/l1_if.c M src/osmo-bts-virtual/bts_model.c 14 files changed, 330 insertions(+), 32 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/22/32222/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32222 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I5fd1d17da09a5f0eee3d69fcb4788c106a240e21 Gerrit-Change-Number: 32222 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in libosmocore[master]: logging: add 'logging timezone (localtime|utc)'
by pespin 05 Apr '23

05 Apr '23
Attention is currently required from: neels, laforge, fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32043 ) Change subject: logging: add 'logging timezone (localtime|utc)' ...................................................................... Patch Set 2: (1 comment) File src/core/logging.c: https://gerrit.osmocom.org/c/libosmocore/+/32043/comment/54e4c407_f9b070fa PS1, Line 874: target->timezone = timezone; > The bool vs enum aspect doesn't really affect the aspect raised by pespin, does it? […] I don't really understand why you are even thinking about asserting or removing timestamps during logging when you can simply have a VTY command fail to set a given timestamp format when you try to set it, as per what I proposed. I see nothing wrong with having a function returning a "rc" while others don't, specially when there's an existing case which shows that the function may fail (because system may not support it). -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32043 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I7f868b47bf8f8dfcf85e735f490ae69b18111af4 Gerrit-Change-Number: 32043 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Wed, 05 Apr 2023 14:42:31 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de> Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • ...
  • 226
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.