gerrit-log
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
September 2026
- 1 participants
- 1894 discussions
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43635?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: debian: add packaging for osmo-trx-proxy
......................................................................
debian: add packaging for osmo-trx-proxy
Ship the osmo-trx-proxy binary and its default/example VTY config
(doc/examples/osmo-trx-proxy/osmo-trx-proxy.cfg), following the same
layout as the osmo-trx-ipc package.
Change-Id: I995b44bf9a884cf5ba6db8333e6f08c9604a58a5
Related: OS#6672
---
M debian/control
A debian/osmo-trx-proxy.install
2 files changed, 12 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/debian/control b/debian/control
index 25b3041..bb93b1c 100644
--- a/debian/control
+++ b/debian/control
@@ -189,6 +189,15 @@
between different telecommunication associations for developing new
generations of mobile phone networks. (post-2G/GSM)
+Package: osmo-trx-proxy
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Virtual TRX endpoint proxy for testing without SDR hardware
+ osmo-trx-proxy speaks the TRXC/TRXD protocol on one or more virtual TRX
+ endpoints, simulating an RF path (path loss, ToA, C/I) between them instead
+ of driving actual SDR hardware. It allows testing L1 software (e.g.
+ OsmoBTS) or MS-side stacks (e.g. osmocom-bb/trxcon) without a radio.
+
Package: osmo-trx-doc
Architecture: all
Section: doc
diff --git a/debian/osmo-trx-proxy.install b/debian/osmo-trx-proxy.install
new file mode 100644
index 0000000..d0309eb
--- /dev/null
+++ b/debian/osmo-trx-proxy.install
@@ -0,0 +1,3 @@
+etc/osmocom/osmo-trx-proxy.cfg
+usr/bin/osmo-trx-proxy
+usr/share/doc/osmo-trx/examples/osmo-trx-proxy/osmo-trx-proxy.cfg /usr/share/doc/osmo-trx/examples/osmo-trx-proxy/
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43635?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: I995b44bf9a884cf5ba6db8333e6f08c9604a58a5
Gerrit-Change-Number: 43635
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
[M] Change in osmo-trx[master]: contrib/systemd: add a service file for osmo-trx-proxy
by fixeria 19 Sep '26
by fixeria 19 Sep '26
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43636?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: contrib/systemd: add a service file for osmo-trx-proxy
......................................................................
contrib/systemd: add a service file for osmo-trx-proxy
Add osmo-trx-proxy.service, and package it in osmo-trx-proxy along
with the postinst logic to create the 'osmocom' system user/group
it runs as, matching the other osmo-trx-* backends.
Change-Id: I8c5bc092dc5bf6bf07d6e80f64ac7fc06f0cfb96
Related: OS#6672
---
M contrib/systemd/Makefile.am
A contrib/systemd/osmo-trx-proxy.service
M debian/osmo-trx-proxy.install
A debian/osmo-trx-proxy.postinst
4 files changed, 52 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
index 6566b97..b8cd7eb 100644
--- a/contrib/systemd/Makefile.am
+++ b/contrib/systemd/Makefile.am
@@ -2,7 +2,8 @@
osmo-trx-lms.service \
osmo-trx-uhd.service \
osmo-trx-usrp1.service \
- osmo-trx-ipc.service
+ osmo-trx-ipc.service \
+ osmo-trx-proxy.service
if HAVE_SYSTEMD
SYSTEMD_SERVICES =
@@ -23,5 +24,9 @@
SYSTEMD_SERVICES += osmo-trx-ipc.service
endif
+if ENABLE_PROXY
+SYSTEMD_SERVICES += osmo-trx-proxy.service
+endif
+
systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
endif # HAVE_SYSTEMD
diff --git a/contrib/systemd/osmo-trx-proxy.service b/contrib/systemd/osmo-trx-proxy.service
new file mode 100644
index 0000000..8d79933
--- /dev/null
+++ b/contrib/systemd/osmo-trx-proxy.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Osmocom Virtual TRX Endpoint Proxy
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+Restart=always
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
+User=osmocom
+Group=osmocom
+ExecStart=/usr/bin/osmo-trx-proxy -c /etc/osmocom/osmo-trx-proxy.cfg
+RestartSec=2
+AmbientCapabilities=CAP_SYS_NICE
+# CPU scheduling policy:
+CPUSchedulingPolicy=rr
+# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
+CPUSchedulingPriority=21
+# See sched(7) for further details on real-time policies and priorities
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/osmo-trx-proxy.install b/debian/osmo-trx-proxy.install
index d0309eb..0a3cb05 100644
--- a/debian/osmo-trx-proxy.install
+++ b/debian/osmo-trx-proxy.install
@@ -1,3 +1,4 @@
etc/osmocom/osmo-trx-proxy.cfg
+lib/systemd/system/osmo-trx-proxy.service
usr/bin/osmo-trx-proxy
usr/share/doc/osmo-trx/examples/osmo-trx-proxy/osmo-trx-proxy.cfg /usr/share/doc/osmo-trx/examples/osmo-trx-proxy/
diff --git a/debian/osmo-trx-proxy.postinst b/debian/osmo-trx-proxy.postinst
new file mode 100755
index 0000000..d4857a2
--- /dev/null
+++ b/debian/osmo-trx-proxy.postinst
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+case "$1" in
+ configure)
+ # Create the osmocom group and user (if it doesn't exist yet)
+ if ! getent group osmocom >/dev/null; then
+ groupadd --system osmocom
+ fi
+ if ! getent passwd osmocom >/dev/null; then
+ useradd \
+ --system \
+ --gid osmocom \
+ --home-dir /var/lib/osmocom \
+ --shell /sbin/nologin \
+ --comment "Open Source Mobile Communications" \
+ osmocom
+ fi
+ ;;
+esac
+
+# dh_installdeb(1) will replace this with shell code automatically
+# generated by other debhelper scripts.
+#DEBHELPER#
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43636?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: I8c5bc092dc5bf6bf07d6e80f64ac7fc06f0cfb96
Gerrit-Change-Number: 43636
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
[M] Change in osmo-trx[master]: proxy/vty: add 'show ep [NAME]', rename 'show proxy' to 'show ep-list'
by fixeria 19 Sep '26
by fixeria 19 Sep '26
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43639?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: proxy/vty: add 'show ep [NAME]', rename 'show proxy' to 'show ep-list'
......................................................................
proxy/vty: add 'show ep [NAME]', rename 'show proxy' to 'show ep-list'
'show ep-list' keeps the brief one-line-per-endpoint summary (now
also showing the full address and power state), while the new
'show ep [NAME]' prints detailed per-channel information.
Change-Id: Ib0af5a47e7298bb0e961652c7a83bd0f6233efda
Related: OS#6672
---
M proxy/src/vty.c
1 file changed, 117 insertions(+), 9 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/proxy/src/vty.c b/proxy/src/vty.c
index 83f41da..6b32ec9 100644
--- a/proxy/src/vty.c
+++ b/proxy/src/vty.c
@@ -397,26 +397,133 @@
return CMD_SUCCESS;
}
-DEFUN(show_proxy,
- show_proxy_cmd,
- "show proxy",
- SHOW_STR "Display configured virtual TRX endpoints\n")
+DEFUN(show_ep_list,
+ show_ep_list_cmd,
+ "show ep-list",
+ SHOW_STR "Display a brief list of configured virtual TRX endpoints\n")
{
struct proxy_trx *trx;
llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
- vty_out(vty, "Endpoint '%s': %s:%u, %u channel(s), %s%s",
+ vty_out(vty, "Endpoint '%s' (%s): l=%s:%u<->r=%s:%u, %u channel(s), power %s%s",
trx->name,
- osmo_trx_ep_get_raddr(trx->ep),
- osmo_trx_ep_get_base_port(trx->ep),
- osmo_trx_ep_get_num_chans(trx->ep),
osmo_trx_ep_is_open(trx->ep) ? "open" : "closed",
+ osmo_trx_ep_get_laddr(trx->ep),
+ osmo_trx_ep_get_base_port(trx->ep),
+ osmo_trx_ep_get_raddr(trx->ep),
+ osmo_trx_ep_get_base_port(trx->ep) + 100,
+ osmo_trx_ep_get_num_chans(trx->ep),
+ trx->powered ? "on" : "off",
VTY_NEWLINE);
}
return CMD_SUCCESS;
}
+static void show_ep_vty(struct vty *vty, struct proxy_trx *trx)
+{
+ vty_out(vty, "Endpoint '%s' (%s):%s",
+ trx->name, osmo_trx_ep_is_open(trx->ep) ? "open" : "closed", VTY_NEWLINE);
+ vty_out(vty, " Address: l=%s:%u<->r=%s:%u%s",
+ osmo_trx_ep_get_laddr(trx->ep), osmo_trx_ep_get_base_port(trx->ep),
+ osmo_trx_ep_get_raddr(trx->ep), osmo_trx_ep_get_base_port(trx->ep) + 100,
+ VTY_NEWLINE);
+ vty_out(vty, " Power: %s (%d dBm)%s",
+ trx->powered ? "on" : "off", trx->tx_power, VTY_NEWLINE);
+ vty_out(vty, " TRXD PDU max version: %u%s", trx->trxd_max_ver, VTY_NEWLINE);
+ vty_out(vty, " TRXD PDU batching: %s%s",
+ osmo_trx_ep_get_pdu_batch(trx->ep) ? "enabled" : "disabled", VTY_NEWLINE);
+
+ /* endpoint not open yet, no channel info available */
+ if (trx->chans == NULL)
+ return;
+
+ for (unsigned int chan = 0; chan < trx->num_chans; chan++) {
+ const struct proxy_trx_chan *c = &trx->chans[chan];
+
+ vty_out(vty, " Channel %u:%s", chan, VTY_NEWLINE);
+ vty_out(vty, " RF state: %s%s", c->rf_muted ? "muted" : "not muted", VTY_NEWLINE);
+ vty_out(vty, " TRXD PDU version: %d%s",
+ osmo_trx_ep_get_pdu_ver(trx->ep, chan), VTY_NEWLINE);
+
+ if (c->fh == NULL) {
+ vty_out(vty, " Rx frequency: %u kHz%s", c->rx_freq / 1000, VTY_NEWLINE);
+ vty_out(vty, " Tx frequency: %u kHz%s", c->tx_freq / 1000, VTY_NEWLINE);
+ } else {
+ vty_out(vty, " Freq. hopping HSN: %u%s", c->fh->hsn, VTY_NEWLINE);
+ vty_out(vty, " Freq. hopping MAIO: %u%s", c->fh->maio, VTY_NEWLINE);
+ vty_out(vty, " Freq. hopping MA length: %u%s", c->fh->ma_len, VTY_NEWLINE);
+ }
+
+ vty_out(vty, " Tx power: %d dBm (%d dB attenuated)%s",
+ c->path_sim.tx_power, c->path_sim.tx_att, VTY_NEWLINE);
+ vty_out(vty, " Timing Advance: %d%s", c->path_sim.ta, VTY_NEWLINE);
+ vty_out(vty, " Reported ToA: %d (jitter %d) 1/256 symbols%s",
+ c->path_sim.toa256, c->path_sim.toa256_jitter, VTY_NEWLINE);
+ if (c->path_sim.flags & PATH_SIM_F_FAKE_RSSI) {
+ vty_out(vty, " Reported RSSI: %d (jitter %d) dBm (fake)%s",
+ c->path_sim.rssi, c->path_sim.rssi_jitter, VTY_NEWLINE);
+ } else {
+ vty_out(vty, " Reported RSSI: computed from path-loss%s", VTY_NEWLINE);
+ }
+ vty_out(vty, " Reported C/I: %d (jitter %d) cB%s",
+ c->path_sim.ci, c->path_sim.ci_jitter, VTY_NEWLINE);
+ if (c->path_sim.burst_drop_amount > 0) {
+ vty_out(vty, " Dropping bursts: %u left, every %u%s",
+ c->path_sim.burst_drop_amount,
+ c->path_sim.burst_drop_period,
+ VTY_NEWLINE);
+ }
+
+ for (unsigned int tn = 0; tn < PROXY_TRX_NUM_TS; tn++) {
+ const struct proxy_trx_ts *ts = &c->ts[tn];
+
+ vty_out(vty, " Timeslot %u: ", tn);
+ if (!ts->valid) {
+ vty_out(vty, "(not configured)%s", VTY_NEWLINE);
+ continue;
+ }
+
+ if (ts->cfg.vamos) {
+ vty_out(vty, "%s (VAMOS)%s",
+ osmo_trxc_vamos_comb_name(ts->cfg.vamos_comb), VTY_NEWLINE);
+ } else {
+ vty_out(vty, "%s%s",
+ osmo_trxc_chan_comb_name(ts->cfg.chan_comb), VTY_NEWLINE);
+ }
+
+ for (unsigned int ss = 0; ss < ts->cfg.num_tsc; ss++) {
+ vty_out(vty, " Sub-channel %u: TSC %u (set %u)%s",
+ ss, ts->cfg.tsc[ss].tsc, ts->cfg.tsc[ss].tsc_set, VTY_NEWLINE);
+ }
+ }
+ }
+}
+
+DEFUN(show_ep,
+ show_ep_cmd,
+ "show ep [NAME]",
+ SHOW_STR "Display detailed information about virtual TRX endpoint(s)\n"
+ "Endpoint name\n")
+{
+ struct proxy_trx *trx;
+ bool found = false;
+
+ llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
+ if (argc > 0 && strcmp(trx->name, argv[0]) != 0)
+ continue;
+ show_ep_vty(vty, trx);
+ found = true;
+ }
+
+ if (argc > 0 && !found) {
+ vty_out(vty, "%% Endpoint '%s' does not exist%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
/*! Called when leaving EP_NODE (interactively via 'exit'/'end', or on dedent
* while reading a config file): validate the endpoint config and open it,
* unless it is already open. Returns 0 on success, non-zero if the node
@@ -474,7 +581,8 @@
osmo_talloc_vty_add_cmds();
osmo_cpu_sched_vty_init(g_talloc_ctx);
- install_element_ve(&show_proxy_cmd);
+ install_element_ve(&show_ep_list_cmd);
+ install_element_ve(&show_ep_cmd);
install_element(CONFIG_NODE, &cfg_proxy_cmd);
install_node(&proxy_node, config_write_proxy);
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43639?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: Ib0af5a47e7298bb0e961652c7a83bd0f6233efda
Gerrit-Change-Number: 43639
Gerrit-PatchSet: 3
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
[L] Change in osmo-trx[master]: proxy: add TDMA clock generator and basic TRXC handler
by fixeria 19 Sep '26
by fixeria 19 Sep '26
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43604?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: proxy: add TDMA clock generator and basic TRXC handler
......................................................................
proxy: add TDMA clock generator and basic TRXC handler
Add clck_gen: a single, process-wide timerfd-driven TDMA clock,
sending "IND CLOCK" every 102 frames to the clock socket of each
currently powered-on endpoint. The clock starts the moment any
endpoint becomes powered and stops once none remain.
Add ctrl_cmd implementing osmo_trx_ep_rx_ctrl_msg(). This module
currently handles POWERON/POWEROFF and RXTUNE/TXTUNE, and simply
ACKs all unknown commands.
Change-Id: I8c0757f15961bf0574f1305a6a8836853b66afcf
Related: OS#6672
---
M proxy/Makefile.am
A proxy/include/osmocom/proxy/clck_gen.h
M proxy/include/osmocom/proxy/trx.h
M proxy/src/Makefile.am
A proxy/src/clck_gen.c
A proxy/src/ctrl_cmd.c
M proxy/src/main.c
M proxy/src/trx.c
M proxy/src/vty.c
9 files changed, 340 insertions(+), 4 deletions(-)
Approvals:
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 23a1d3a..e99dd63 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -3,6 +3,7 @@
$(NULL)
noinst_HEADERS = \
+ include/osmocom/proxy/clck_gen.h \
include/osmocom/proxy/logging.h \
include/osmocom/proxy/proxy.h \
include/osmocom/proxy/trx.h \
diff --git a/proxy/include/osmocom/proxy/clck_gen.h b/proxy/include/osmocom/proxy/clck_gen.h
new file mode 100644
index 0000000..dae2a2d
--- /dev/null
+++ b/proxy/include/osmocom/proxy/clck_gen.h
@@ -0,0 +1,5 @@
+#pragma once
+
+int clck_gen_init(void);
+
+void clck_gen_trx_list_updated(void);
diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h
index e687825..52d2e6a 100644
--- a/proxy/include/osmocom/proxy/trx.h
+++ b/proxy/include/osmocom/proxy/trx.h
@@ -1,24 +1,44 @@
#pragma once
+#include <stdint.h>
+#include <stdbool.h>
+
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
struct osmo_trx_ep;
struct proxy_ctx;
+/*! Per-channel state: each channel is conceptually its own (child)
+ * transceiver with an independent Rx/Tx frequency, sharing the endpoint's
+ * power state and clock. */
+struct proxy_trx_chan {
+ uint32_t rx_freq; /*!< Rx frequency in Hz, 0 if not (yet) tuned */
+ uint32_t tx_freq; /*!< Tx frequency in Hz, 0 if not (yet) tuned */
+};
+
/*! One virtual transceiver endpoint */
struct proxy_trx {
struct llist_head list;
char *name;
struct osmo_trx_ep *ep;
+ bool powered; /*!< POWERON/POWEROFF applies to all channels at once */
+ 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 */
};
#define LOGP_TRX(trx, ss, level, fmt, args...) \
LOGP(ss, level, "(trx=%s) " fmt, (trx)->name, ##args)
+#define LOGP_TRXCH(trx, chan, ss, level, fmt, args...) \
+ LOGP(ss, level, "(trx=%s, chan=%u) " fmt, (trx)->name, chan, ##args)
+
struct proxy_trx *proxy_trx_find(struct proxy_ctx *proxy, const char *name);
struct proxy_trx *proxy_trx_alloc(struct proxy_ctx *proxy, const char *name);
void proxy_trx_free(struct proxy_trx *trx);
int proxy_trx_open(struct proxy_trx *trx);
void proxy_trx_close(struct proxy_trx *trx);
+
+int proxy_trx_set_num_chans(struct proxy_trx *trx, unsigned int num_chans);
+void proxy_trx_set_power(struct proxy_trx *trx, bool on);
diff --git a/proxy/src/Makefile.am b/proxy/src/Makefile.am
index 0350474..4be255f 100644
--- a/proxy/src/Makefile.am
+++ b/proxy/src/Makefile.am
@@ -18,6 +18,8 @@
proxy.c \
vty.c \
trx.c \
+ clck_gen.c \
+ ctrl_cmd.c \
logging.c \
$(NULL)
diff --git a/proxy/src/clck_gen.c b/proxy/src/clck_gen.c
new file mode 100644
index 0000000..c485711
--- /dev/null
+++ b/proxy/src/clck_gen.c
@@ -0,0 +1,135 @@
+/*! \file src/clck_gen.c
+ * osmo-trx-proxy: shared TDMA clock generator. */
+
+/*
+ * (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 <unistd.h>
+#include <stdint.h>
+
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/select.h>
+#include <osmocom/gsm/gsm0502.h>
+
+#include <osmocom/trx/ep.h>
+
+#include <osmocom/proxy/proxy.h>
+#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/clck_gen.h>
+#include <osmocom/proxy/logging.h>
+
+/*! Send "IND CLOCK" every N frames (matches fake_trx.py's CLCKGen default) */
+#define CLCK_GEN_IND_PERIOD 102
+
+struct clck_gen {
+ struct osmo_fd timerfd;
+ uint32_t fn;
+ bool running;
+};
+
+static struct clck_gen g_clck_gen;
+
+static int clck_gen_timer_cb(struct osmo_fd *ofd, unsigned int what)
+{
+ struct clck_gen *gen = ofd->data;
+ uint64_t expire_count;
+
+ if (read(ofd->fd, &expire_count, sizeof(expire_count)) != sizeof(expire_count))
+ return 0;
+
+ while (expire_count-- > 0) {
+ const struct proxy_trx *trx;
+
+ if (gen->fn % CLCK_GEN_IND_PERIOD == 0) {
+ llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
+ if (!trx->powered)
+ continue;
+ if (!osmo_trx_ep_get_clock_socket(trx->ep))
+ continue;
+ LOGP_TRX(trx, DTRXC, LOGL_DEBUG,
+ "Tx CLCK.ind (fn=%u)\n", gen->fn);
+ osmo_trx_ep_send_clck_ind(trx->ep, gen->fn);
+ }
+ }
+
+ /* TODO: drive per-frame burst forwarding (burst_queue/burst_fwd) */
+
+ GSM_TDMA_FN_INC(gen->fn);
+ }
+
+ return 0;
+}
+
+static void clck_gen_start(struct clck_gen *gen)
+{
+ const struct timespec first = { .tv_nsec = GSM_TDMA_FN_DURATION_nS };
+ const struct timespec interval = { .tv_nsec = GSM_TDMA_FN_DURATION_nS };
+
+ if (gen->running)
+ return;
+
+ gen->fn = 0;
+ if (osmo_timerfd_schedule(&gen->timerfd, &first, &interval) < 0) {
+ LOGP(DTRXC, LOGL_ERROR, "Failed to start the TDMA clock generator\n");
+ return;
+ }
+
+ gen->running = true;
+ LOGP(DTRXC, LOGL_NOTICE, "TDMA clock generator started\n");
+}
+
+static void clck_gen_stop(struct clck_gen *gen)
+{
+ if (!gen->running)
+ return;
+
+ osmo_timerfd_disable(&gen->timerfd);
+ gen->running = false;
+ LOGP(DTRXC, LOGL_NOTICE, "TDMA clock generator stopped\n");
+}
+
+/*! Re-evaluate g_proxy_ctx->trx_list and (re)start or stop the (single,
+ * process-wide) TDMA clock generator: running iff at least one endpoint is
+ * currently powered on. Call this after changing any struct proxy_trx's
+ * ->powered field. */
+void clck_gen_trx_list_updated(void)
+{
+ bool any_active = false;
+ struct proxy_trx *trx;
+
+ llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
+ any_active |= trx->powered;
+ }
+
+ if (any_active)
+ clck_gen_start(&g_clck_gen);
+ else
+ clck_gen_stop(&g_clck_gen);
+}
+
+int clck_gen_init(void)
+{
+ g_clck_gen.timerfd.fd = -1;
+ return osmo_timerfd_setup(&g_clck_gen.timerfd,
+ &clck_gen_timer_cb,
+ &g_clck_gen);
+}
diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c
new file mode 100644
index 0000000..281cc13
--- /dev/null
+++ b/proxy/src/ctrl_cmd.c
@@ -0,0 +1,130 @@
+/*! \file src/ctrl_cmd.c
+ * osmo-trx-proxy: TRXC command handling. */
+
+/*
+ * (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 <stdio.h>
+#include <string.h>
+
+#include <osmocom/trx/ep.h>
+#include <osmocom/trx/trxc.h>
+
+#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/logging.h>
+
+static void ctrl_cmd_poweron(struct proxy_trx *trx, struct osmo_trxc_msg *rsp)
+{
+ if (trx->powered) {
+ LOGP_TRX(trx, DTRXC, LOGL_ERROR,
+ "Rx POWERON: already powered on\n");
+ rsp->status = 1;
+ return;
+ }
+
+ for (unsigned int chan = 0; chan < trx->num_chans; chan++) {
+ if (trx->chans[chan].rx_freq == 0 || trx->chans[chan].tx_freq == 0) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "Rx POWERON: Rx/Tx frequency not (yet) set\n");
+ rsp->status = 1;
+ return;
+ }
+ }
+
+ proxy_trx_set_power(trx, true);
+}
+
+static void ctrl_cmd_poweroff(struct proxy_trx *trx, struct osmo_trxc_msg *rsp)
+{
+ proxy_trx_set_power(trx, false);
+}
+
+static void ctrl_cmd_rxtune(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ unsigned int freq_khz = 0;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%u", &freq_khz) != 1) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse Rx frequency: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ trx->chans[chan].rx_freq = freq_khz * 1000;
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO,
+ "Rx frequency set to %u kHz\n", freq_khz);
+ snprintf(rsp->params, sizeof(rsp->params), "%u", freq_khz);
+}
+
+static void ctrl_cmd_txtune(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ unsigned int freq_khz = 0;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%u", &freq_khz) != 1) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse Tx frequency: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ trx->chans[chan].tx_freq = freq_khz * 1000;
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO,
+ "Tx frequency set to %u kHz\n", freq_khz);
+ snprintf(rsp->params, sizeof(rsp->params), "%u", freq_khz);
+}
+
+void osmo_trx_ep_rx_ctrl_msg(struct osmo_trx_ep *ep, unsigned int chan,
+ const struct osmo_trxc_msg *cmd)
+{
+ struct proxy_trx *trx = osmo_trx_ep_get_priv(ep);
+ struct osmo_trxc_msg rsp = *cmd;
+
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_DEBUG,
+ "Rx '%s'\n", osmo_trxc_msg_name(cmd));
+
+ rsp.type = OSMO_TRXC_MT_RSP;
+ rsp.status = 0; /* ACK all commands by default */
+ OSMO_STRLCPY_ARRAY(rsp.cmd, cmd->cmd);
+ OSMO_STRLCPY_ARRAY(rsp.params, cmd->params);
+
+ if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_POWERON)) {
+ ctrl_cmd_poweron(trx, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_POWEROFF)) {
+ ctrl_cmd_poweroff(trx, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_RXTUNE)) {
+ ctrl_cmd_rxtune(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_TXTUNE)) {
+ ctrl_cmd_txtune(trx, chan, cmd, &rsp);
+ } else {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO,
+ "Unhandled command '%s'\n", cmd->cmd);
+ }
+
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_DEBUG,
+ "Tx '%s'\n", osmo_trxc_msg_name(&rsp));
+
+ osmo_trx_ep_send_ctrl_msg(ep, chan, &rsp);
+}
diff --git a/proxy/src/main.c b/proxy/src/main.c
index 5ac023a..074c019 100644
--- a/proxy/src/main.c
+++ b/proxy/src/main.c
@@ -42,6 +42,7 @@
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/vty.h>
#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/clck_gen.h>
#include <osmocom/proxy/logging.h>
void *g_talloc_ctx;
@@ -119,6 +120,11 @@
proxy_vty_init();
+ if (clck_gen_init() < 0) {
+ LOGP(DPROXY, LOGL_FATAL, "Failed to set up the TDMA clock generator\n");
+ return 1;
+ }
+
handle_options(argc, argv);
rc = vty_read_config_file(g_config_file, NULL);
diff --git a/proxy/src/trx.c b/proxy/src/trx.c
index 6eab496..c535c03 100644
--- a/proxy/src/trx.c
+++ b/proxy/src/trx.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <string.h>
+#include <osmocom/core/utils.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/linuxlist.h>
@@ -33,10 +34,12 @@
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/clck_gen.h>
#include <osmocom/proxy/logging.h>
struct proxy_trx *proxy_trx_alloc(struct proxy_ctx *proxy, const char *name)
{
+ const unsigned int num_chans = 1;
struct proxy_trx *trx;
trx = talloc_zero(proxy, struct proxy_trx);
@@ -44,11 +47,12 @@
return NULL;
trx->name = talloc_strdup(trx, name);
- trx->ep = osmo_trx_ep_alloc(trx, 1);
+ trx->ep = osmo_trx_ep_alloc(trx, num_chans);
if (trx->ep == NULL) {
talloc_free(trx);
return NULL;
}
+ proxy_trx_set_num_chans(trx, num_chans);
osmo_trx_ep_set_priv(trx->ep, trx);
osmo_trx_ep_set_name(trx->ep, "%s", name);
@@ -86,11 +90,26 @@
{
if (!trx)
return;
+ proxy_trx_set_power(trx, false);
osmo_trx_ep_free(trx->ep);
llist_del(&trx->list);
talloc_free(trx);
}
+/*! 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)
+{
+ if (trx->powered == on)
+ return;
+
+ LOGP_TRX(trx, DTRXC, LOGL_INFO,
+ "Power %s\n", on ? "on" : "off");
+
+ trx->powered = on;
+ clck_gen_trx_list_updated();
+}
+
int proxy_trx_open(struct proxy_trx *trx)
{
int rc;
@@ -104,5 +123,23 @@
return rc;
}
+ if (rc == 0) { /* first successful open: num_chans is now fixed */
+ trx->chans = talloc_zero_array(trx, struct proxy_trx_chan, trx->num_chans);
+ OSMO_ASSERT(trx->chans != NULL);
+ }
+
+ return 0;
+}
+
+/*! Change the number of channels; must be called before proxy_trx_open(). */
+int proxy_trx_set_num_chans(struct proxy_trx *trx, unsigned int num_chans)
+{
+ int rc;
+
+ rc = osmo_trx_ep_set_num_chans(trx->ep, num_chans);
+ if (rc)
+ return rc;
+
+ trx->num_chans = num_chans;
return 0;
}
diff --git a/proxy/src/vty.c b/proxy/src/vty.c
index 086fe50..ec986d0 100644
--- a/proxy/src/vty.c
+++ b/proxy/src/vty.c
@@ -179,9 +179,9 @@
int num_chans = atoi(argv[0]);
int rc;
- rc = osmo_trx_ep_set_num_chans(trx->ep, num_chans);
+ rc = proxy_trx_set_num_chans(trx, num_chans);
if (rc) {
- vty_out(vty, "%% osmo_trx_ep_set_num_chans(%d) failed: rc=%d%s",
+ vty_out(vty, "%% proxy_trx_set_num_chans(%d) failed: rc=%d%s",
num_chans, rc, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -231,7 +231,7 @@
if (laddr && strcmp(laddr, g_proxy_ctx->bind_addr) != 0)
vty_out(vty, " bind-addr %s%s", laddr, VTY_NEWLINE);
vty_out(vty, " base-port %u%s", osmo_trx_ep_get_base_port(trx->ep), VTY_NEWLINE);
- vty_out(vty, " num-chans %u%s", osmo_trx_ep_get_num_chans(trx->ep), VTY_NEWLINE);
+ vty_out(vty, " num-chans %u%s", trx->num_chans, VTY_NEWLINE);
if (!osmo_trx_ep_get_clock_socket(trx->ep))
vty_out(vty, " no clock-socket%s", VTY_NEWLINE);
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43604?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: I8c0757f15961bf0574f1305a6a8836853b66afcf
Gerrit-Change-Number: 43604
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
[M] Change in osmo-trx[master]: proxy: implement burst forwarding (proxying) logic
by fixeria 19 Sep '26
by fixeria 19 Sep '26
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43605?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: proxy: implement burst forwarding (proxying) logic
......................................................................
proxy: implement burst forwarding (proxying) logic
Implement osmo_trx_ep_rx_burst_req(): forward a Tx burst request
immediately (no per-endpoint queueing yet) to every other powered-on
endpoint/channel whose Rx frequency matches the source channel's Tx
frequency. Hard bits are converted to soft bits via osmo_ubit2sbit();
toa256/rssi are left at placeholder nominal values until the upcoming
path simulation logic computes them for real.
Change-Id: I1df0389ef523a59402081deb8f74b84e136ea7dd
Related: OS#6672
---
M proxy/src/Makefile.am
A proxy/src/burst_fwd.c
2 files changed, 100 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/proxy/src/Makefile.am b/proxy/src/Makefile.am
index 4be255f..5c8b931 100644
--- a/proxy/src/Makefile.am
+++ b/proxy/src/Makefile.am
@@ -20,6 +20,7 @@
trx.c \
clck_gen.c \
ctrl_cmd.c \
+ burst_fwd.c \
logging.c \
$(NULL)
diff --git a/proxy/src/burst_fwd.c b/proxy/src/burst_fwd.c
new file mode 100644
index 0000000..2a9f22d
--- /dev/null
+++ b/proxy/src/burst_fwd.c
@@ -0,0 +1,99 @@
+/*! \file src/burst_fwd.c
+ * osmo-trx-proxy: forward Tx bursts by Rx/Tx frequency match. */
+
+/*
+ * (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 <string.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/core/linuxlist.h>
+
+#include <osmocom/trx/ep.h>
+
+#include <osmocom/proxy/proxy.h>
+#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/logging.h>
+
+/* Placeholder measurement values, until path_sim.c computes them for real
+ * (matches fake_trx.py's FakeTRX nominal defaults: no timing offset, and
+ * -60 dBm = 50 dBm nominal Tx power - 0 dB Tx attenuation - 110 dB path loss). */
+#define BURST_FWD_TOA256_DEFAULT 0
+#define BURST_FWD_RSSI_DEFAULT -60
+
+#define OSMO_TRXD_F_COMMON_MASK ( \
+ OSMO_TRXD_F_NOPE_REQ | \
+ OSMO_TRXD_F_MOD_TYPE | \
+ OSMO_TRXD_F_TS_INFO | \
+ OSMO_TRXD_F_TRX_NUM \
+ )
+
+static void burst_fwd_to_chan(struct proxy_trx *dst, unsigned int dst_chan,
+ const struct osmo_trxd_burst_req *br)
+{
+ struct osmo_trxd_burst_ind bi = {
+ .flags = br->flags & OSMO_TRXD_F_COMMON_MASK,
+ .fn = br->fn,
+ .tn = br->tn,
+ .toa256 = BURST_FWD_TOA256_DEFAULT,
+ .rssi = BURST_FWD_RSSI_DEFAULT,
+ .burst_len = br->burst_len,
+ .mod = br->mod,
+ .tsc_set = br->tsc_set,
+ .tsc = br->tsc,
+ .trx_num = br->trx_num,
+ };
+
+ osmo_ubit2sbit(bi.burst, br->burst, br->burst_len);
+
+ osmo_trx_ep_send_burst_ind(dst->ep, dst_chan, &bi);
+}
+
+/*! Forward a Tx burst request to every powered-on endpoint/channel
+ * whose Rx frequency matches the source channel's Tx frequency.
+ * TODO: (no frequency hopping support yet, see SETFH in fake_trx.py). */
+void osmo_trx_ep_rx_burst_req(struct osmo_trx_ep *ep, unsigned int chan,
+ const struct osmo_trxd_burst_req *br)
+{
+ const struct proxy_trx *src = osmo_trx_ep_get_priv(ep);
+ const uint32_t tx_freq = src->chans[chan].tx_freq;
+ struct proxy_trx *dst;
+
+ if (!src->powered) {
+ LOGP_TRXCH(src, chan, DTRXD, LOGL_NOTICE,
+ "Rx BURST.req while not powered on, dropping\n");
+ return;
+ }
+
+ llist_for_each_entry(dst, &g_proxy_ctx->trx_list, list) {
+ unsigned int dst_chan;
+
+ if (dst == src || !dst->powered)
+ continue;
+
+ for (dst_chan = 0; dst_chan < dst->num_chans; dst_chan++) {
+ if (dst->chans[dst_chan].rx_freq != tx_freq)
+ continue;
+ burst_fwd_to_chan(dst, dst_chan, br);
+ }
+ }
+}
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43605?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: I1df0389ef523a59402081deb8f74b84e136ea7dd
Gerrit-Change-Number: 43605
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
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43607?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: proxy: implement power measurement emulation
......................................................................
proxy: implement power measurement emulation
Add the TRXC MEASURE command, used by the MS side (trxcon) to probe
RF power on a given frequency. Scan all powered-on channels on the
requested frequency: if found, report the RSSI it would be measured
at using the same path-loss formula (or FAKE_RSSI override) as burst
forwarding; if not, report a fixed noise floor.
The noise floor is configurable via the new 'pm-rssi-noise' VTY
command under the 'proxy' node (default -110 dBm).
Change-Id: I9be028ae9c1a20caf24327b7ee81eeeabbda0634
Related: OS#6672
---
M proxy/include/osmocom/proxy/path_sim.h
M proxy/include/osmocom/proxy/proxy.h
M proxy/src/ctrl_cmd.c
M proxy/src/path_sim.c
M proxy/src/proxy.c
M proxy/src/vty.c
6 files changed, 74 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/proxy/include/osmocom/proxy/path_sim.h b/proxy/include/osmocom/proxy/path_sim.h
index d27a3b1..c263eea 100644
--- a/proxy/include/osmocom/proxy/path_sim.h
+++ b/proxy/include/osmocom/proxy/path_sim.h
@@ -30,3 +30,4 @@
struct proxy_trx_chan *dst,
const struct osmo_trxd_burst_req *br,
const struct proxy_trx_chan *src);
+int path_sim_measure(uint32_t freq_hz, int rssi_noise);
diff --git a/proxy/include/osmocom/proxy/proxy.h b/proxy/include/osmocom/proxy/proxy.h
index 080ff53..2d17ce9 100644
--- a/proxy/include/osmocom/proxy/proxy.h
+++ b/proxy/include/osmocom/proxy/proxy.h
@@ -13,8 +13,12 @@
#define PROXY_DEFAULT_MS_NAME "ms"
#define PROXY_DEFAULT_MS_PORT 6700
+/*! RSSI (dBm) reported by MEASURE for a frequency with no Tx found on it */
+#define PROXY_DEFAULT_PM_RSSI_NOISE -110
+
struct proxy_ctx {
char *bind_addr;
+ int path_sim_noise_dbm; /*!< dBm, MEASURE result for frequencies with no Tx found */
struct llist_head trx_list; /*!< struct proxy_trx::list */
};
diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c
index 449fe81..9a86bb1 100644
--- a/proxy/src/ctrl_cmd.c
+++ b/proxy/src/ctrl_cmd.c
@@ -29,6 +29,7 @@
#include <osmocom/trx/ep.h>
#include <osmocom/trx/trxc.h>
+#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
#include <osmocom/proxy/path_sim.h>
#include <osmocom/proxy/logging.h>
@@ -36,6 +37,7 @@
/* Not part of the well-known OSMO_TRXC_CMD_* verbs (libosmo-trx/trxc.h) since
* they are specific to this transceiver's RF path simulation. */
#define CTRL_CMD_SETTA "SETTA"
+#define CTRL_CMD_MEASURE "MEASURE"
#define CTRL_CMD_FAKE_TOA "FAKE_TOA"
#define CTRL_CMD_FAKE_RSSI "FAKE_RSSI"
#define CTRL_CMD_FAKE_CI "FAKE_CI"
@@ -274,6 +276,23 @@
"Dropping %d burst(s), every %d frame(s)\n", amount, period);
}
+static void ctrl_cmd_measure(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ int freq_khz, rssi;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d", &freq_khz) != 1) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse target frequency: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ rssi = path_sim_measure(freq_khz * 1000, g_proxy_ctx->path_sim_noise_dbm);
+ snprintf(rsp->params, sizeof(rsp->params), "%d %d", freq_khz, rssi);
+}
+
void osmo_trx_ep_rx_ctrl_msg(struct osmo_trx_ep *ep, unsigned int chan,
const struct osmo_trxc_msg *cmd)
{
@@ -304,6 +323,8 @@
ctrl_cmd_rfmute(trx, chan, cmd, &rsp);
} else if (!strcmp(cmd->cmd, CTRL_CMD_SETTA)) {
ctrl_cmd_setta(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, CTRL_CMD_MEASURE)) {
+ ctrl_cmd_measure(trx, chan, cmd, &rsp);
} else if (!strcmp(cmd->cmd, CTRL_CMD_FAKE_TOA)) {
ctrl_cmd_fake_toa(trx, chan, cmd, &rsp);
} else if (!strcmp(cmd->cmd, CTRL_CMD_FAKE_RSSI)) {
diff --git a/proxy/src/path_sim.c b/proxy/src/path_sim.c
index b835f76..d51c20a 100644
--- a/proxy/src/path_sim.c
+++ b/proxy/src/path_sim.c
@@ -27,6 +27,7 @@
#include <osmocom/trx/trxd.h>
+#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
#include <osmocom/proxy/path_sim.h>
@@ -119,3 +120,34 @@
bi->ci_cb = dst->path_sim.ci + path_sim_jitter(dst->path_sim.ci_jitter);
bi->flags |= OSMO_TRXD_F_CI_CB;
}
+
+static int path_sim_measure_rssi(const struct proxy_trx_chan *tx)
+{
+ if (tx->path_sim.flags & PATH_SIM_F_FAKE_RSSI)
+ return tx->path_sim.rssi;
+
+ return (tx->path_sim.tx_power - tx->path_sim.tx_att) - PATH_SIM_PATH_LOSS_DEFAULT;
+}
+
+/*! Emulate a power measurement (MEASURE CTRL command) on a given Tx
+ * frequency: if some powered-on channel is currently transmitting on it,
+ * return the RSSI it would be measured at (same path-loss formula, or
+ * FAKE_RSSI override, as path_sim_apply()); otherwise return rssi_noise. */
+int path_sim_measure(uint32_t freq_hz, int rssi_noise)
+{
+ struct proxy_trx *trx;
+
+ llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
+ unsigned int chan;
+
+ if (!trx->powered)
+ continue;
+
+ for (chan = 0; chan < trx->num_chans; chan++) {
+ if (trx->chans[chan].tx_freq == freq_hz)
+ return path_sim_measure_rssi(&trx->chans[chan]);
+ }
+ }
+
+ return rssi_noise;
+}
diff --git a/proxy/src/proxy.c b/proxy/src/proxy.c
index b194bc9..4495909 100644
--- a/proxy/src/proxy.c
+++ b/proxy/src/proxy.c
@@ -45,6 +45,7 @@
return NULL;
proxy->bind_addr = talloc_strdup(proxy, PROXY_DEFAULT_BIND_ADDR);
+ proxy->path_sim_noise_dbm = PROXY_DEFAULT_PM_RSSI_NOISE;
INIT_LLIST_HEAD(&proxy->trx_list);
return proxy;
diff --git a/proxy/src/vty.c b/proxy/src/vty.c
index ec986d0..aa8288a 100644
--- a/proxy/src/vty.c
+++ b/proxy/src/vty.c
@@ -91,6 +91,19 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_proxy_pm_rssi_noise,
+ cfg_proxy_pm_rssi_noise_cmd,
+ "pm-rssi-noise <-150-0>",
+ "Set the RSSI reported by MEASURE for a frequency with no Tx found\n"
+ "RSSI in dBm\n")
+{
+ struct proxy_ctx *proxy = vty->index;
+
+ proxy->path_sim_noise_dbm = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_proxy_ep,
cfg_proxy_ep_cmd,
"ep NAME",
@@ -220,6 +233,7 @@
vty_out(vty, "proxy%s", VTY_NEWLINE);
if (g_proxy_ctx->bind_addr)
vty_out(vty, " bind-addr %s%s", g_proxy_ctx->bind_addr, VTY_NEWLINE);
+ vty_out(vty, " pm-rssi-noise %d%s", g_proxy_ctx->path_sim_noise_dbm, VTY_NEWLINE);
llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
const char *raddr = osmo_trx_ep_get_raddr(trx->ep);
@@ -322,6 +336,7 @@
install_element(CONFIG_NODE, &cfg_proxy_cmd);
install_node(&proxy_node, config_write_proxy);
install_element(PROXY_NODE, &cfg_proxy_bind_addr_cmd);
+ install_element(PROXY_NODE, &cfg_proxy_pm_rssi_noise_cmd);
install_element(PROXY_NODE, &cfg_proxy_ep_cmd);
install_element(PROXY_NODE, &cfg_no_proxy_ep_cmd);
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43607?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: I9be028ae9c1a20caf24327b7ee81eeeabbda0634
Gerrit-Change-Number: 43607
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
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43606?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: proxy: implement RF path simulation
......................................................................
proxy: implement RF path simulation
Compute real ToA/RSSI/CI values for forwarded bursts instead of the
fixed placeholder constants in burst_fwd.c. Each channel gets its own
struct path_sim_state, tracking Tx power/attenuation, Timing Advance,
reported ToA/RSSI/CI, and burst-dropping parameters. RSSI defaults to
a path-loss formula (Tx power - burst attenuation - fixed path loss)
unless overridden via FAKE_RSSI.
Add the CTRL commands needed to drive this: SETTA, SETPOWER,
NOMTXPOWER, RFMUTE, and the FAKE_TOA/FAKE_RSSI/FAKE_CI/FAKE_DROP
simulation helpers. RFMUTE and burst dropping (FAKE_DROP) turn a
forwarded burst into a NOPE.ind, matching the existing NOPE.req
handling path.
Change-Id: Iefa51d6b0e0bba1f12bdbcdf576528e7d3588b8f
Related: OS#6672
---
M proxy/Makefile.am
A proxy/include/osmocom/proxy/path_sim.h
M proxy/include/osmocom/proxy/trx.h
M proxy/src/Makefile.am
M proxy/src/burst_fwd.c
M proxy/src/ctrl_cmd.c
A proxy/src/path_sim.c
M proxy/src/trx.c
8 files changed, 367 insertions(+), 13 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index e99dd63..909c698 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -5,6 +5,7 @@
noinst_HEADERS = \
include/osmocom/proxy/clck_gen.h \
include/osmocom/proxy/logging.h \
+ include/osmocom/proxy/path_sim.h \
include/osmocom/proxy/proxy.h \
include/osmocom/proxy/trx.h \
include/osmocom/proxy/vty.h \
diff --git a/proxy/include/osmocom/proxy/path_sim.h b/proxy/include/osmocom/proxy/path_sim.h
new file mode 100644
index 0000000..d27a3b1
--- /dev/null
+++ b/proxy/include/osmocom/proxy/path_sim.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <stdint.h>
+
+struct proxy_trx_chan;
+struct osmo_trxd_burst_ind;
+struct osmo_trxd_burst_req;
+
+#define PATH_SIM_F_FAKE_RSSI (1 << 0) /*!< use rssi instead of the path-loss formula */
+
+/*! Per-channel RF path simulation state: ToA/RSSI/C-I measurement emulation
+ * and burst dropping (simulated path loss / weak signal / interference). */
+struct path_sim_state {
+ uint32_t flags; /*!< PATH_SIM_F_* */
+ int tx_power; /*!< dBm, nominal Tx power (NOMTXPOWER) */
+ int tx_att; /*!< dB, Tx power attenuation (SETPOWER) */
+ int ta; /*!< Timing Advance, symbol periods (SETTA) */
+ int toa256; /*!< reported ToA, 1/256 symbol periods (FAKE_TOA) */
+ int toa256_jitter; /*!< +/- random jitter around toa256 (FAKE_TOA "<val> <threshold>") */
+ int rssi; /*!< reported RSSI in dBm, if PATH_SIM_F_FAKE_RSSI (FAKE_RSSI) */
+ int rssi_jitter; /*!< +/- random jitter around rssi (FAKE_RSSI "<val> <threshold>") */
+ int ci; /*!< reported C/I in cB (FAKE_CI) */
+ int ci_jitter; /*!< +/- random jitter around ci (FAKE_CI "<val> <threshold>") */
+ unsigned int burst_drop_amount; /*!< bursts left to drop (FAKE_DROP) */
+ unsigned int burst_drop_period; /*!< drop if (fn % period) == 0 */
+};
+
+void path_sim_state_reset(struct path_sim_state *ps);
+void path_sim_apply(struct osmo_trxd_burst_ind *bi,
+ struct proxy_trx_chan *dst,
+ const struct osmo_trxd_burst_req *br,
+ const struct proxy_trx_chan *src);
diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h
index 52d2e6a..f91acbf 100644
--- a/proxy/include/osmocom/proxy/trx.h
+++ b/proxy/include/osmocom/proxy/trx.h
@@ -6,6 +6,8 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
+#include <osmocom/proxy/path_sim.h>
+
struct osmo_trx_ep;
struct proxy_ctx;
@@ -15,6 +17,8 @@
struct proxy_trx_chan {
uint32_t rx_freq; /*!< Rx frequency in Hz, 0 if not (yet) tuned */
uint32_t tx_freq; /*!< Tx frequency in Hz, 0 if not (yet) tuned */
+ bool rf_muted; /*!< RFMUTE: force NOPE.ind on bursts this channel transmits */
+ struct path_sim_state path_sim; /*!< RF path simulation state (path_sim.c) */
};
/*! One virtual transceiver endpoint */
diff --git a/proxy/src/Makefile.am b/proxy/src/Makefile.am
index 5c8b931..4c3678e 100644
--- a/proxy/src/Makefile.am
+++ b/proxy/src/Makefile.am
@@ -21,6 +21,7 @@
clck_gen.c \
ctrl_cmd.c \
burst_fwd.c \
+ path_sim.c \
logging.c \
$(NULL)
diff --git a/proxy/src/burst_fwd.c b/proxy/src/burst_fwd.c
index 2a9f22d..1254e02 100644
--- a/proxy/src/burst_fwd.c
+++ b/proxy/src/burst_fwd.c
@@ -32,14 +32,9 @@
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/path_sim.h>
#include <osmocom/proxy/logging.h>
-/* Placeholder measurement values, until path_sim.c computes them for real
- * (matches fake_trx.py's FakeTRX nominal defaults: no timing offset, and
- * -60 dBm = 50 dBm nominal Tx power - 0 dB Tx attenuation - 110 dB path loss). */
-#define BURST_FWD_TOA256_DEFAULT 0
-#define BURST_FWD_RSSI_DEFAULT -60
-
#define OSMO_TRXD_F_COMMON_MASK ( \
OSMO_TRXD_F_NOPE_REQ | \
OSMO_TRXD_F_MOD_TYPE | \
@@ -47,15 +42,14 @@
OSMO_TRXD_F_TRX_NUM \
)
-static void burst_fwd_to_chan(struct proxy_trx *dst, unsigned int dst_chan,
+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)
{
struct osmo_trxd_burst_ind bi = {
.flags = br->flags & OSMO_TRXD_F_COMMON_MASK,
.fn = br->fn,
.tn = br->tn,
- .toa256 = BURST_FWD_TOA256_DEFAULT,
- .rssi = BURST_FWD_RSSI_DEFAULT,
.burst_len = br->burst_len,
.mod = br->mod,
.tsc_set = br->tsc_set,
@@ -64,6 +58,8 @@
};
osmo_ubit2sbit(bi.burst, br->burst, br->burst_len);
+ path_sim_apply(&bi, &dst->chans[dst_chan],
+ br, &src->chans[src_chan]);
osmo_trx_ep_send_burst_ind(dst->ep, dst_chan, &bi);
}
@@ -74,9 +70,9 @@
void osmo_trx_ep_rx_burst_req(struct osmo_trx_ep *ep, unsigned int chan,
const struct osmo_trxd_burst_req *br)
{
- const struct proxy_trx *src = osmo_trx_ep_get_priv(ep);
- const uint32_t tx_freq = src->chans[chan].tx_freq;
- struct proxy_trx *dst;
+ 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,
@@ -84,6 +80,8 @@
return;
}
+ tx_freq = src->chans[chan].tx_freq;
+
llist_for_each_entry(dst, &g_proxy_ctx->trx_list, list) {
unsigned int dst_chan;
@@ -93,7 +91,7 @@
for (dst_chan = 0; dst_chan < dst->num_chans; dst_chan++) {
if (dst->chans[dst_chan].rx_freq != tx_freq)
continue;
- burst_fwd_to_chan(dst, dst_chan, br);
+ burst_fwd_to_chan(src, chan, dst, dst_chan, br);
}
}
}
diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c
index 281cc13..449fe81 100644
--- a/proxy/src/ctrl_cmd.c
+++ b/proxy/src/ctrl_cmd.c
@@ -30,8 +30,17 @@
#include <osmocom/trx/trxc.h>
#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/path_sim.h>
#include <osmocom/proxy/logging.h>
+/* Not part of the well-known OSMO_TRXC_CMD_* verbs (libosmo-trx/trxc.h) since
+ * they are specific to this transceiver's RF path simulation. */
+#define CTRL_CMD_SETTA "SETTA"
+#define CTRL_CMD_FAKE_TOA "FAKE_TOA"
+#define CTRL_CMD_FAKE_RSSI "FAKE_RSSI"
+#define CTRL_CMD_FAKE_CI "FAKE_CI"
+#define CTRL_CMD_FAKE_DROP "FAKE_DROP"
+
static void ctrl_cmd_poweron(struct proxy_trx *trx, struct osmo_trxc_msg *rsp)
{
if (trx->powered) {
@@ -96,6 +105,175 @@
snprintf(rsp->params, sizeof(rsp->params), "%u", freq_khz);
}
+static void ctrl_cmd_setta(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ int ta;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d", &ta) != 1) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): failed to parse Timing Advance: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ trx->chans[chan].path_sim.ta = ta;
+
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO, "Timing Advance set to %d\n", ta);
+}
+
+static void ctrl_cmd_setpower(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ int att;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d", &att) != 1) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse Tx power attenuation: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ trx->chans[chan].path_sim.tx_att = att;
+
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO, "Tx power attenuation set to %d dB\n", att);
+}
+
+static void ctrl_cmd_nomtxpower(struct proxy_trx *trx, unsigned int chan, struct osmo_trxc_msg *rsp)
+{
+ snprintf(rsp->params, sizeof(rsp->params), "%d", trx->chans[chan].path_sim.tx_power);
+}
+
+static void ctrl_cmd_rfmute(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ int mute;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d", &mute) != 1) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse command arguments: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ trx->chans[chan].rf_muted = mute > 0;
+
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO,
+ "RF mute %s\n", trx->chans[chan].rf_muted ? "on" : "off");
+}
+
+/* FAKE_TOA/FAKE_RSSI/FAKE_CI: "<delta>" adjusts the current value by delta;
+ * "<value> <threshold>" sets an absolute value with a +/-threshold random
+ * jitter applied on every forwarded burst (see path_sim_apply()). */
+
+static void ctrl_cmd_fake_toa(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ struct path_sim_state *ps = &trx->chans[chan].path_sim;
+ int value, threshold;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d %d", &value, &threshold) == 2) {
+ if (threshold < 0) {
+ rsp->status = 1;
+ return;
+ }
+ ps->toa256 = value;
+ ps->toa256_jitter = threshold;
+ } else if (osmo_trxc_msg_params_scan(cmd, "%d", &value) == 1) {
+ ps->toa256 += value;
+ } else {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse command arguments: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ }
+}
+
+static void ctrl_cmd_fake_rssi(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ struct path_sim_state *ps = &trx->chans[chan].path_sim;
+ int value, threshold;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d %d", &value, &threshold) == 2) {
+ if (threshold < 0) {
+ rsp->status = 1;
+ return;
+ }
+ ps->rssi = value;
+ ps->rssi_jitter = threshold;
+ } else if (osmo_trxc_msg_params_scan(cmd, "%d", &value) == 1) {
+ ps->rssi = value;
+ ps->rssi_jitter = 0;
+ } else {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse command arguments: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ ps->flags |= PATH_SIM_F_FAKE_RSSI;
+}
+
+static void ctrl_cmd_fake_ci(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ struct path_sim_state *ps = &trx->chans[chan].path_sim;
+ int value, threshold;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d %d", &value, &threshold) == 2) {
+ if (threshold < 0) {
+ rsp->status = 1;
+ return;
+ }
+ ps->ci = value;
+ ps->ci_jitter = threshold;
+ } else if (osmo_trxc_msg_params_scan(cmd, "%d", &value) == 1) {
+ ps->ci += value;
+ } else {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse command arguments: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ }
+}
+
+static void ctrl_cmd_fake_drop(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ struct path_sim_state *ps = &trx->chans[chan].path_sim;
+ int amount, period;
+
+ if (osmo_trxc_msg_params_scan(cmd, "%d %d", &amount, &period) == 2) {
+ if (amount < 0 || period <= 0) {
+ rsp->status = 1;
+ return;
+ }
+ } else if (osmo_trxc_msg_params_scan(cmd, "%d", &amount) == 1) {
+ if (amount < 0) {
+ rsp->status = 1;
+ return;
+ }
+ period = 1;
+ } else {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse command arguments: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ ps->burst_drop_amount = amount;
+ ps->burst_drop_period = period;
+
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO,
+ "Dropping %d burst(s), every %d frame(s)\n", amount, period);
+}
+
void osmo_trx_ep_rx_ctrl_msg(struct osmo_trx_ep *ep, unsigned int chan,
const struct osmo_trxc_msg *cmd)
{
@@ -118,6 +296,22 @@
ctrl_cmd_rxtune(trx, chan, cmd, &rsp);
} else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_TXTUNE)) {
ctrl_cmd_txtune(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_SETPOWER)) {
+ ctrl_cmd_setpower(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_NOMTXPOWER)) {
+ ctrl_cmd_nomtxpower(trx, chan, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_RFMUTE)) {
+ ctrl_cmd_rfmute(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, CTRL_CMD_SETTA)) {
+ ctrl_cmd_setta(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, CTRL_CMD_FAKE_TOA)) {
+ ctrl_cmd_fake_toa(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, CTRL_CMD_FAKE_RSSI)) {
+ ctrl_cmd_fake_rssi(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, CTRL_CMD_FAKE_CI)) {
+ ctrl_cmd_fake_ci(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, CTRL_CMD_FAKE_DROP)) {
+ ctrl_cmd_fake_drop(trx, chan, cmd, &rsp);
} else {
LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO,
"Unhandled command '%s'\n", cmd->cmd);
diff --git a/proxy/src/path_sim.c b/proxy/src/path_sim.c
new file mode 100644
index 0000000..b835f76
--- /dev/null
+++ b/proxy/src/path_sim.c
@@ -0,0 +1,121 @@
+/*! \file src/path_sim.c
+ * osmo-trx-proxy: RF path simulation (ToA/RSSI/C-I, burst dropping, RF mute). */
+
+/*
+ * (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 <stdlib.h>
+
+#include <osmocom/trx/trxd.h>
+
+#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/path_sim.h>
+
+#define PATH_SIM_NOMINAL_TX_POWER_DEFAULT 50 /* dBm */
+#define PATH_SIM_TX_ATT_DEFAULT 0 /* dB */
+#define PATH_SIM_PATH_LOSS_DEFAULT 110 /* dB */
+#define PATH_SIM_CI_DEFAULT 90 /* cB */
+
+/* Values reported for NOPE.ind (burst dropped / RF muted) */
+#define PATH_SIM_TOA256_NOISE_DEFAULT 0
+#define PATH_SIM_RSSI_NOISE_DEFAULT -110
+#define PATH_SIM_CI_NOISE_DEFAULT -30
+
+/*! Reset a channel's RF path simulation state to nominal defaults. */
+void path_sim_state_reset(struct path_sim_state *ps)
+{
+ ps->flags = 0;
+ ps->tx_power = PATH_SIM_NOMINAL_TX_POWER_DEFAULT;
+ ps->tx_att = PATH_SIM_TX_ATT_DEFAULT;
+ ps->ta = 0;
+ ps->toa256 = 0;
+ ps->toa256_jitter = 0;
+ ps->rssi = PATH_SIM_NOMINAL_TX_POWER_DEFAULT -
+ PATH_SIM_TX_ATT_DEFAULT - PATH_SIM_PATH_LOSS_DEFAULT;
+ ps->rssi_jitter = 0;
+ ps->ci = PATH_SIM_CI_DEFAULT;
+ ps->ci_jitter = 0;
+ ps->burst_drop_amount = 0;
+ ps->burst_drop_period = 1;
+}
+
+/* Path loss simulation: burst dropping. Returns true if the burst at the
+ * given frame number is to be dropped (and consumes one drop credit). */
+static bool path_sim_burst_drop(struct path_sim_state *dst, uint32_t fn)
+{
+ if (dst->burst_drop_amount == 0)
+ return false;
+
+ if (fn % dst->burst_drop_period == 0) {
+ dst->burst_drop_amount--;
+ return true;
+ }
+
+ return false;
+}
+
+/* Uniform random offset in [-threshold, +threshold], or 0 if threshold <= 0. */
+static int path_sim_jitter(int threshold)
+{
+ if (threshold <= 0)
+ return 0;
+
+ return (rand() % (2 * threshold + 1)) - threshold;
+}
+
+/*! Fill in the RF path simulation results (ToA, RSSI, C/I, burst dropping,
+ * RF mute) of a BURST.ind that is about to be forwarded from src to dst. */
+void path_sim_apply(struct osmo_trxd_burst_ind *bi,
+ struct proxy_trx_chan *dst,
+ const struct osmo_trxd_burst_req *br,
+ const struct proxy_trx_chan *src)
+{
+ bool nope = bi->flags & OSMO_TRXD_F_NOPE_IND;
+
+ if (src->rf_muted)
+ nope = true;
+ else if (!nope)
+ nope = path_sim_burst_drop(&dst->path_sim, br->fn);
+
+ if (nope) {
+ 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 = PATH_SIM_RSSI_NOISE_DEFAULT;
+ bi->ci_cb = PATH_SIM_CI_NOISE_DEFAULT;
+ return;
+ }
+
+ bi->toa256 = dst->path_sim.toa256 + path_sim_jitter(dst->path_sim.toa256_jitter);
+ if (src->path_sim.ta != 0)
+ bi->toa256 -= src->path_sim.ta * 256;
+
+ if (dst->path_sim.flags & PATH_SIM_F_FAKE_RSSI) {
+ bi->rssi = dst->path_sim.rssi + path_sim_jitter(dst->path_sim.rssi_jitter);
+ } else {
+ int tx_power = src->path_sim.tx_power - src->path_sim.tx_att;
+ bi->rssi = tx_power - (int)br->att - PATH_SIM_PATH_LOSS_DEFAULT;
+ }
+
+ bi->ci_cb = dst->path_sim.ci + path_sim_jitter(dst->path_sim.ci_jitter);
+ bi->flags |= OSMO_TRXD_F_CI_CB;
+}
diff --git a/proxy/src/trx.c b/proxy/src/trx.c
index c535c03..7087d6a 100644
--- a/proxy/src/trx.c
+++ b/proxy/src/trx.c
@@ -35,6 +35,7 @@
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
#include <osmocom/proxy/clck_gen.h>
+#include <osmocom/proxy/path_sim.h>
#include <osmocom/proxy/logging.h>
struct proxy_trx *proxy_trx_alloc(struct proxy_ctx *proxy, const char *name)
@@ -126,6 +127,8 @@
if (rc == 0) { /* first successful open: num_chans is now fixed */
trx->chans = talloc_zero_array(trx, struct proxy_trx_chan, trx->num_chans);
OSMO_ASSERT(trx->chans != NULL);
+ for (unsigned int i = 0; i < trx->num_chans; i++)
+ path_sim_state_reset(&trx->chans[i].path_sim);
}
return 0;
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43606?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: Iefa51d6b0e0bba1f12bdbcdf576528e7d3588b8f
Gerrit-Change-Number: 43606
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
[M] Change in osmo-trx[master]: proxy: make path_sim values configurable via VTY
by fixeria 19 Sep '26
by fixeria 19 Sep '26
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43608?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: proxy: make path_sim values configurable via VTY
......................................................................
proxy: make path_sim values configurable via VTY
Move the RF path loss and default reported ToA/CI for forwarded
bursts ('path-loss'/'nominal-toa256'/'nominal-ci' under 'proxy'),
and each endpoint's nominal Tx power ('tx-power' under 'ep'), out
of path_sim.c's compile-time constants and into new VTY commands.
The global values are held in a new opaque struct path_sim_cfg,
talloc-allocated by path_sim_cfg_alloc() and exposed only through
path_sim_cfg_{get,set}_*() accessors, keeping struct proxy_ctx down to
a single pointer instead of exposing path_sim internals. tx_power is
per-endpoint and lives directly on struct proxy_trx. Both are applied
when a channel's path_sim_state is (re)initialized.
Change-Id: I969e9df1ab394e631da3da9b3044fab1446db40e
Related: OS#6672
---
M proxy/include/osmocom/proxy/path_sim.h
M proxy/include/osmocom/proxy/proxy.h
M proxy/include/osmocom/proxy/trx.h
M proxy/src/burst_fwd.c
M proxy/src/ctrl_cmd.c
M proxy/src/path_sim.c
M proxy/src/proxy.c
M proxy/src/trx.c
M proxy/src/vty.c
9 files changed, 194 insertions(+), 33 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/proxy/include/osmocom/proxy/path_sim.h b/proxy/include/osmocom/proxy/path_sim.h
index c263eea..58bd9bb 100644
--- a/proxy/include/osmocom/proxy/path_sim.h
+++ b/proxy/include/osmocom/proxy/path_sim.h
@@ -5,6 +5,7 @@
struct proxy_trx_chan;
struct osmo_trxd_burst_ind;
struct osmo_trxd_burst_req;
+struct path_sim_cfg;
#define PATH_SIM_F_FAKE_RSSI (1 << 0) /*!< use rssi instead of the path-loss formula */
@@ -25,9 +26,24 @@
unsigned int burst_drop_period; /*!< drop if (fn % period) == 0 */
};
-void path_sim_state_reset(struct path_sim_state *ps);
+void path_sim_state_reset(struct path_sim_state *ps, int tx_power, int toa256, int ci);
void path_sim_apply(struct osmo_trxd_burst_ind *bi,
struct proxy_trx_chan *dst,
const struct osmo_trxd_burst_req *br,
- const struct proxy_trx_chan *src);
-int path_sim_measure(uint32_t freq_hz, int rssi_noise);
+ 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);
+
+struct path_sim_cfg *path_sim_cfg_alloc(void *talloc_ctx);
+
+void path_sim_cfg_set_noise_dbm(struct path_sim_cfg *cfg, int noise_dbm);
+int path_sim_cfg_get_noise_dbm(const struct path_sim_cfg *cfg);
+
+void path_sim_cfg_set_path_loss_db(struct path_sim_cfg *cfg, int path_loss_db);
+int path_sim_cfg_get_path_loss_db(const struct path_sim_cfg *cfg);
+
+void path_sim_cfg_set_nom_toa256(struct path_sim_cfg *cfg, int nom_toa256);
+int path_sim_cfg_get_nom_toa256(const struct path_sim_cfg *cfg);
+
+void path_sim_cfg_set_nom_ci_cb(struct path_sim_cfg *cfg, int nom_ci_cb);
+int path_sim_cfg_get_nom_ci_cb(const struct path_sim_cfg *cfg);
diff --git a/proxy/include/osmocom/proxy/proxy.h b/proxy/include/osmocom/proxy/proxy.h
index 2d17ce9..30b9316 100644
--- a/proxy/include/osmocom/proxy/proxy.h
+++ b/proxy/include/osmocom/proxy/proxy.h
@@ -13,12 +13,11 @@
#define PROXY_DEFAULT_MS_NAME "ms"
#define PROXY_DEFAULT_MS_PORT 6700
-/*! RSSI (dBm) reported by MEASURE for a frequency with no Tx found on it */
-#define PROXY_DEFAULT_PM_RSSI_NOISE -110
+struct path_sim_cfg;
struct proxy_ctx {
char *bind_addr;
- int path_sim_noise_dbm; /*!< dBm, MEASURE result for frequencies with no Tx found */
+ struct path_sim_cfg *path_sim; /*!< RF path simulation config (path_sim.c) */
struct llist_head trx_list; /*!< struct proxy_trx::list */
};
diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h
index f91acbf..4f56a24 100644
--- a/proxy/include/osmocom/proxy/trx.h
+++ b/proxy/include/osmocom/proxy/trx.h
@@ -11,6 +11,9 @@
struct osmo_trx_ep;
struct proxy_ctx;
+/*! dBm, nominal Tx power (per endpoint) */
+#define PROXY_TRX_DEFAULT_TX_POWER 50
+
/*! Per-channel state: each channel is conceptually its own (child)
* transceiver with an independent Rx/Tx frequency, sharing the endpoint's
* power state and clock. */
@@ -27,6 +30,7 @@
char *name;
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) */
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/burst_fwd.c b/proxy/src/burst_fwd.c
index 1254e02..2166714 100644
--- a/proxy/src/burst_fwd.c
+++ b/proxy/src/burst_fwd.c
@@ -59,7 +59,8 @@
osmo_ubit2sbit(bi.burst, br->burst, br->burst_len);
path_sim_apply(&bi, &dst->chans[dst_chan],
- br, &src->chans[src_chan]);
+ br, &src->chans[src_chan],
+ g_proxy_ctx->path_sim);
osmo_trx_ep_send_burst_ind(dst->ep, dst_chan, &bi);
}
diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c
index 9a86bb1..ceaed21 100644
--- a/proxy/src/ctrl_cmd.c
+++ b/proxy/src/ctrl_cmd.c
@@ -289,7 +289,7 @@
return;
}
- rssi = path_sim_measure(freq_khz * 1000, g_proxy_ctx->path_sim_noise_dbm);
+ rssi = path_sim_measure(freq_khz * 1000, g_proxy_ctx->path_sim);
snprintf(rsp->params, sizeof(rsp->params), "%d %d", freq_khz, rssi);
}
diff --git a/proxy/src/path_sim.c b/proxy/src/path_sim.c
index d51c20a..260cce2 100644
--- a/proxy/src/path_sim.c
+++ b/proxy/src/path_sim.c
@@ -25,35 +25,103 @@
#include <stdlib.h>
+#include <osmocom/core/talloc.h>
+
#include <osmocom/trx/trxd.h>
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
#include <osmocom/proxy/path_sim.h>
-#define PATH_SIM_NOMINAL_TX_POWER_DEFAULT 50 /* dBm */
-#define PATH_SIM_TX_ATT_DEFAULT 0 /* dB */
-#define PATH_SIM_PATH_LOSS_DEFAULT 110 /* dB */
-#define PATH_SIM_CI_DEFAULT 90 /* cB */
+/* Defaults for struct path_sim_cfg */
+#define PATH_SIM_CFG_DEFAULT_NOISE_DBM -110
+#define PATH_SIM_CFG_DEFAULT_PATH_LOSS_DB 110
+#define PATH_SIM_CFG_DEFAULT_TOA256 0
+#define PATH_SIM_CFG_DEFAULT_CI_CB 90
/* Values reported for NOPE.ind (burst dropped / RF muted) */
#define PATH_SIM_TOA256_NOISE_DEFAULT 0
#define PATH_SIM_RSSI_NOISE_DEFAULT -110
#define PATH_SIM_CI_NOISE_DEFAULT -30
-/*! Reset a channel's RF path simulation state to nominal defaults. */
-void path_sim_state_reset(struct path_sim_state *ps)
+/*! Global RF path simulation configuration (see path_sim.h). */
+struct path_sim_cfg {
+ int noise_dbm; /*!< dBm, MEASURE result for frequencies with no Tx found */
+ int path_loss_db; /*!< dB, RF path loss used by the RSSI formula */
+ int nom_toa256; /*!< default reported ToA for BURST.ind, 1/256 symbol periods */
+ int nom_ci_cb; /*!< default reported C/I for BURST.ind, in cB */
+};
+
+/*! Global RF path simulation configuration. Opaque; use the accessors below. */
+struct path_sim_cfg *path_sim_cfg_alloc(void *talloc_ctx)
+{
+ struct path_sim_cfg *cfg;
+
+ cfg = talloc_zero(talloc_ctx, struct path_sim_cfg);
+ if (cfg == NULL)
+ return NULL;
+
+ cfg->noise_dbm = PATH_SIM_CFG_DEFAULT_NOISE_DBM;
+ cfg->path_loss_db = PATH_SIM_CFG_DEFAULT_PATH_LOSS_DB;
+ cfg->nom_toa256 = PATH_SIM_CFG_DEFAULT_TOA256;
+ cfg->nom_ci_cb = PATH_SIM_CFG_DEFAULT_CI_CB;
+
+ return cfg;
+}
+
+void path_sim_cfg_set_noise_dbm(struct path_sim_cfg *cfg, int noise_dbm)
+{
+ cfg->noise_dbm = noise_dbm;
+}
+
+int path_sim_cfg_get_noise_dbm(const struct path_sim_cfg *cfg)
+{
+ return cfg->noise_dbm;
+}
+
+void path_sim_cfg_set_path_loss_db(struct path_sim_cfg *cfg, int path_loss_db)
+{
+ cfg->path_loss_db = path_loss_db;
+}
+
+int path_sim_cfg_get_path_loss_db(const struct path_sim_cfg *cfg)
+{
+ return cfg->path_loss_db;
+}
+
+void path_sim_cfg_set_nom_toa256(struct path_sim_cfg *cfg, int nom_toa256)
+{
+ cfg->nom_toa256 = nom_toa256;
+}
+
+int path_sim_cfg_get_nom_toa256(const struct path_sim_cfg *cfg)
+{
+ return cfg->nom_toa256;
+}
+
+void path_sim_cfg_set_nom_ci_cb(struct path_sim_cfg *cfg, int nom_ci_cb)
+{
+ cfg->nom_ci_cb = nom_ci_cb;
+}
+
+int path_sim_cfg_get_nom_ci_cb(const struct path_sim_cfg *cfg)
+{
+ return cfg->nom_ci_cb;
+}
+
+/*! Reset a channel's RF path simulation state to the given nominal Tx power,
+ * ToA and C/I defaults. */
+void path_sim_state_reset(struct path_sim_state *ps, int tx_power, int toa256, int ci)
{
ps->flags = 0;
- ps->tx_power = PATH_SIM_NOMINAL_TX_POWER_DEFAULT;
- ps->tx_att = PATH_SIM_TX_ATT_DEFAULT;
+ ps->tx_power = tx_power;
+ ps->tx_att = 0;
ps->ta = 0;
- ps->toa256 = 0;
+ ps->toa256 = toa256;
ps->toa256_jitter = 0;
- ps->rssi = PATH_SIM_NOMINAL_TX_POWER_DEFAULT -
- PATH_SIM_TX_ATT_DEFAULT - PATH_SIM_PATH_LOSS_DEFAULT;
+ ps->rssi = 0; /* unused unless PATH_SIM_F_FAKE_RSSI is set */
ps->rssi_jitter = 0;
- ps->ci = PATH_SIM_CI_DEFAULT;
+ ps->ci = ci;
ps->ci_jitter = 0;
ps->burst_drop_amount = 0;
ps->burst_drop_period = 1;
@@ -88,7 +156,8 @@
void path_sim_apply(struct osmo_trxd_burst_ind *bi,
struct proxy_trx_chan *dst,
const struct osmo_trxd_burst_req *br,
- const struct proxy_trx_chan *src)
+ const struct proxy_trx_chan *src,
+ const struct path_sim_cfg *cfg)
{
bool nope = bi->flags & OSMO_TRXD_F_NOPE_IND;
@@ -114,26 +183,27 @@
bi->rssi = dst->path_sim.rssi + path_sim_jitter(dst->path_sim.rssi_jitter);
} else {
int tx_power = src->path_sim.tx_power - src->path_sim.tx_att;
- bi->rssi = tx_power - (int)br->att - PATH_SIM_PATH_LOSS_DEFAULT;
+ bi->rssi = tx_power - (int)br->att - cfg->path_loss_db;
}
bi->ci_cb = dst->path_sim.ci + path_sim_jitter(dst->path_sim.ci_jitter);
bi->flags |= OSMO_TRXD_F_CI_CB;
}
-static int path_sim_measure_rssi(const struct proxy_trx_chan *tx)
+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)
return tx->path_sim.rssi;
- return (tx->path_sim.tx_power - tx->path_sim.tx_att) - PATH_SIM_PATH_LOSS_DEFAULT;
+ return (tx->path_sim.tx_power - tx->path_sim.tx_att) - cfg->path_loss_db;
}
/*! Emulate a power measurement (MEASURE CTRL command) on a given Tx
* frequency: if some powered-on channel is currently transmitting on it,
* return the RSSI it would be measured at (same path-loss formula, or
- * FAKE_RSSI override, as path_sim_apply()); otherwise return rssi_noise. */
-int path_sim_measure(uint32_t freq_hz, int rssi_noise)
+ * FAKE_RSSI override, as path_sim_apply()); otherwise return the configured
+ * noise floor. */
+int path_sim_measure(uint32_t freq_hz, const struct path_sim_cfg *cfg)
{
struct proxy_trx *trx;
@@ -145,9 +215,9 @@
for (chan = 0; chan < trx->num_chans; chan++) {
if (trx->chans[chan].tx_freq == freq_hz)
- return path_sim_measure_rssi(&trx->chans[chan]);
+ return path_sim_measure_rssi(&trx->chans[chan], cfg);
}
}
- return rssi_noise;
+ return cfg->noise_dbm;
}
diff --git a/proxy/src/proxy.c b/proxy/src/proxy.c
index 4495909..db7258b 100644
--- a/proxy/src/proxy.c
+++ b/proxy/src/proxy.c
@@ -32,6 +32,7 @@
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/path_sim.h>
#include <osmocom/proxy/logging.h>
struct proxy_ctx *g_proxy_ctx = NULL;
@@ -45,7 +46,11 @@
return NULL;
proxy->bind_addr = talloc_strdup(proxy, PROXY_DEFAULT_BIND_ADDR);
- proxy->path_sim_noise_dbm = PROXY_DEFAULT_PM_RSSI_NOISE;
+ proxy->path_sim = path_sim_cfg_alloc(proxy);
+ if (proxy->path_sim == NULL) {
+ talloc_free(proxy);
+ return NULL;
+ }
INIT_LLIST_HEAD(&proxy->trx_list);
return proxy;
diff --git a/proxy/src/trx.c b/proxy/src/trx.c
index 7087d6a..eb42ebe 100644
--- a/proxy/src/trx.c
+++ b/proxy/src/trx.c
@@ -48,6 +48,7 @@
return NULL;
trx->name = talloc_strdup(trx, name);
+ trx->tx_power = PROXY_TRX_DEFAULT_TX_POWER;
trx->ep = osmo_trx_ep_alloc(trx, num_chans);
if (trx->ep == NULL) {
talloc_free(trx);
@@ -127,8 +128,11 @@
if (rc == 0) { /* first successful open: num_chans is now fixed */
trx->chans = talloc_zero_array(trx, struct proxy_trx_chan, trx->num_chans);
OSMO_ASSERT(trx->chans != NULL);
- for (unsigned int i = 0; i < trx->num_chans; i++)
- path_sim_state_reset(&trx->chans[i].path_sim);
+ for (unsigned int i = 0; i < trx->num_chans; i++) {
+ 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));
+ }
}
return 0;
diff --git a/proxy/src/vty.c b/proxy/src/vty.c
index aa8288a..7b863c4 100644
--- a/proxy/src/vty.c
+++ b/proxy/src/vty.c
@@ -41,6 +41,7 @@
#include <osmocom/proxy/proxy.h>
#include <osmocom/proxy/vty.h>
#include <osmocom/proxy/trx.h>
+#include <osmocom/proxy/path_sim.h>
extern void *g_talloc_ctx;
@@ -99,7 +100,46 @@
{
struct proxy_ctx *proxy = vty->index;
- proxy->path_sim_noise_dbm = atoi(argv[0]);
+ path_sim_cfg_set_noise_dbm(proxy->path_sim, atoi(argv[0]));
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_proxy_path_loss,
+ cfg_proxy_path_loss_cmd,
+ "path-loss <0-200>",
+ "Set the simulated RF path loss used to compute the reported RSSI\n"
+ "Path loss in dB\n")
+{
+ struct proxy_ctx *proxy = vty->index;
+
+ path_sim_cfg_set_path_loss_db(proxy->path_sim, atoi(argv[0]));
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_proxy_nom_toa256,
+ cfg_proxy_nom_toa256_cmd,
+ "nominal-toa256 <-32768-32767>",
+ "Set the default reported ToA for a forwarded burst\n"
+ "ToA in 1/256 of a symbol period\n")
+{
+ struct proxy_ctx *proxy = vty->index;
+
+ path_sim_cfg_set_nom_toa256(proxy->path_sim, atoi(argv[0]));
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_proxy_nom_ci,
+ cfg_proxy_nom_ci_cmd,
+ "nominal-ci <-1280-1280>",
+ "Set the default reported C/I for a forwarded burst\n"
+ "C/I in centiBels\n")
+{
+ struct proxy_ctx *proxy = vty->index;
+
+ path_sim_cfg_set_nom_ci_cb(proxy->path_sim, atoi(argv[0]));
return CMD_SUCCESS;
}
@@ -202,6 +242,20 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_ep_tx_power,
+ cfg_ep_tx_power_cmd,
+ "tx-power <-100-100>",
+ "Set the nominal Tx power reported by NOMTXPOWER and used to compute "
+ "the RSSI of bursts sent from this endpoint\n"
+ "Tx power in dBm\n")
+{
+ struct proxy_trx *trx = vty->index;
+
+ trx->tx_power = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_ep_clock_socket,
cfg_ep_clock_socket_cmd,
"clock-socket",
@@ -233,7 +287,10 @@
vty_out(vty, "proxy%s", VTY_NEWLINE);
if (g_proxy_ctx->bind_addr)
vty_out(vty, " bind-addr %s%s", g_proxy_ctx->bind_addr, VTY_NEWLINE);
- vty_out(vty, " pm-rssi-noise %d%s", g_proxy_ctx->path_sim_noise_dbm, VTY_NEWLINE);
+ vty_out(vty, " pm-rssi-noise %d%s", path_sim_cfg_get_noise_dbm(g_proxy_ctx->path_sim), VTY_NEWLINE);
+ vty_out(vty, " path-loss %d%s", path_sim_cfg_get_path_loss_db(g_proxy_ctx->path_sim), VTY_NEWLINE);
+ vty_out(vty, " nominal-toa256 %d%s", path_sim_cfg_get_nom_toa256(g_proxy_ctx->path_sim), VTY_NEWLINE);
+ vty_out(vty, " nominal-ci %d%s", path_sim_cfg_get_nom_ci_cb(g_proxy_ctx->path_sim), VTY_NEWLINE);
llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
const char *raddr = osmo_trx_ep_get_raddr(trx->ep);
@@ -246,6 +303,7 @@
vty_out(vty, " bind-addr %s%s", laddr, VTY_NEWLINE);
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 (!osmo_trx_ep_get_clock_socket(trx->ep))
vty_out(vty, " no clock-socket%s", VTY_NEWLINE);
@@ -337,6 +395,9 @@
install_node(&proxy_node, config_write_proxy);
install_element(PROXY_NODE, &cfg_proxy_bind_addr_cmd);
install_element(PROXY_NODE, &cfg_proxy_pm_rssi_noise_cmd);
+ install_element(PROXY_NODE, &cfg_proxy_path_loss_cmd);
+ install_element(PROXY_NODE, &cfg_proxy_nom_toa256_cmd);
+ install_element(PROXY_NODE, &cfg_proxy_nom_ci_cmd);
install_element(PROXY_NODE, &cfg_proxy_ep_cmd);
install_element(PROXY_NODE, &cfg_no_proxy_ep_cmd);
@@ -345,6 +406,7 @@
install_element(EP_NODE, &cfg_ep_bind_addr_cmd);
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_clock_socket_cmd);
install_element(EP_NODE, &cfg_ep_no_clock_socket_cmd);
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43608?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: I969e9df1ab394e631da3da9b3044fab1446db40e
Gerrit-Change-Number: 43608
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
[M] Change in osmo-trx[master]: proxy: make clck_gen start Fn and period configurable
by fixeria 19 Sep '26
by fixeria 19 Sep '26
19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43628?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 clck_gen start Fn and period configurable
......................................................................
proxy: make clck_gen start Fn and period configurable
Change-Id: I85bc0a1e4674685c7ddcf6627d139f4b8268f7a6
Related: OS#6672
---
M proxy/include/osmocom/proxy/clck_gen.h
M proxy/src/clck_gen.c
M proxy/src/vty.c
3 files changed, 107 insertions(+), 5 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/proxy/include/osmocom/proxy/clck_gen.h b/proxy/include/osmocom/proxy/clck_gen.h
index dae2a2d..54764a6 100644
--- a/proxy/include/osmocom/proxy/clck_gen.h
+++ b/proxy/include/osmocom/proxy/clck_gen.h
@@ -1,5 +1,15 @@
#pragma once
+/*! Special value for clck_gen_{get,set}_start_fn() meaning
+ * a random starting TDMA frame number (default). */
+#define CLCK_GEN_START_FN_RANDOM (-1)
+
int clck_gen_init(void);
void clck_gen_trx_list_updated(void);
+
+int clck_gen_set_start_fn(int fn);
+int clck_gen_get_start_fn(void);
+
+int clck_gen_set_ind_period(unsigned int period);
+unsigned int clck_gen_get_ind_period(void);
diff --git a/proxy/src/clck_gen.c b/proxy/src/clck_gen.c
index c485711..813530c 100644
--- a/proxy/src/clck_gen.c
+++ b/proxy/src/clck_gen.c
@@ -23,8 +23,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
#include <unistd.h>
#include <stdint.h>
+#include <stdlib.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/select.h>
@@ -37,16 +39,21 @@
#include <osmocom/proxy/clck_gen.h>
#include <osmocom/proxy/logging.h>
-/*! Send "IND CLOCK" every N frames (matches fake_trx.py's CLCKGen default) */
+/*! Default "IND CLOCK" period, in frames */
#define CLCK_GEN_IND_PERIOD 102
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 */
};
-static struct clck_gen g_clck_gen;
+static struct clck_gen g_clck_gen = {
+ .start_fn = CLCK_GEN_START_FN_RANDOM,
+ .ind_period = CLCK_GEN_IND_PERIOD,
+};
static int clck_gen_timer_cb(struct osmo_fd *ofd, unsigned int what)
{
@@ -59,7 +66,7 @@
while (expire_count-- > 0) {
const struct proxy_trx *trx;
- if (gen->fn % CLCK_GEN_IND_PERIOD == 0) {
+ if (gen->fn % gen->ind_period == 0) {
llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) {
if (!trx->powered)
continue;
@@ -87,14 +94,19 @@
if (gen->running)
return;
- gen->fn = 0;
+ if (gen->start_fn == CLCK_GEN_START_FN_RANDOM)
+ gen->fn = rand() % GSM_TDMA_HYPERFRAME;
+ else
+ gen->fn = (uint32_t)gen->start_fn;
+
if (osmo_timerfd_schedule(&gen->timerfd, &first, &interval) < 0) {
LOGP(DTRXC, LOGL_ERROR, "Failed to start the TDMA clock generator\n");
return;
}
gen->running = true;
- LOGP(DTRXC, LOGL_NOTICE, "TDMA clock generator started\n");
+ LOGP(DTRXC, LOGL_NOTICE, "TDMA clock generator started (fn=%u, period=%u)\n",
+ gen->fn, gen->ind_period);
}
static void clck_gen_stop(struct clck_gen *gen)
@@ -133,3 +145,40 @@
&clck_gen_timer_cb,
&g_clck_gen);
}
+
+/*! Set the frame number the clock generator starts counting from the next
+ * time it (re)starts: either a fixed FN, or CLCK_GEN_START_FN_RANDOM to
+ * pick a random one (default). Returns 0 on success, -EINVAL if fn is
+ * neither CLCK_GEN_START_FN_RANDOM nor a valid FN. */
+int clck_gen_set_start_fn(int fn)
+{
+ if (fn < CLCK_GEN_START_FN_RANDOM || fn >= GSM_TDMA_HYPERFRAME)
+ return -EINVAL;
+
+ g_clck_gen.start_fn = fn;
+ return 0;
+}
+
+/*! Get the currently configured starting frame number, or
+ * CLCK_GEN_START_FN_RANDOM if set to pick a random one. */
+int clck_gen_get_start_fn(void)
+{
+ return g_clck_gen.start_fn;
+}
+
+/*! Set how many frames apart "IND CLOCK" is sent (default: 102). Returns 0
+ * on success, -EINVAL if period is 0 or exceeds the TDMA hyperframe length. */
+int clck_gen_set_ind_period(unsigned int period)
+{
+ if (period == 0 || period > GSM_TDMA_HYPERFRAME)
+ return -EINVAL;
+
+ g_clck_gen.ind_period = period;
+ return 0;
+}
+
+/*! Get the currently configured "IND CLOCK" period, in frames. */
+unsigned int clck_gen_get_ind_period(void)
+{
+ return g_clck_gen.ind_period;
+}
diff --git a/proxy/src/vty.c b/proxy/src/vty.c
index 7b863c4..ab53147 100644
--- a/proxy/src/vty.c
+++ b/proxy/src/vty.c
@@ -42,6 +42,7 @@
#include <osmocom/proxy/vty.h>
#include <osmocom/proxy/trx.h>
#include <osmocom/proxy/path_sim.h>
+#include <osmocom/proxy/clck_gen.h>
extern void *g_talloc_ctx;
@@ -144,6 +145,41 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_proxy_clck_gen_start_fn,
+ cfg_proxy_clck_gen_start_fn_cmd,
+ "clck-gen start-fn (random|<0-2715647>)",
+ "Configure the shared TDMA clock generator\n"
+ "Set the frame number the clock generator starts counting from\n"
+ "Start from a random frame number every time it (re)starts (default)\n"
+ "Start from this fixed frame number\n")
+{
+ int fn = !strcmp(argv[0], "random") ? CLCK_GEN_START_FN_RANDOM : atoi(argv[0]);
+
+ if (clck_gen_set_start_fn(fn) < 0) {
+ vty_out(vty, "%% Invalid starting frame number: %d%s", fn, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_proxy_clck_gen_ind_period,
+ cfg_proxy_clck_gen_ind_period_cmd,
+ "clck-gen ind-period <1-2715648>",
+ "Configure the shared TDMA clock generator\n"
+ "Set how many frames apart \"IND CLOCK\" is sent (default: 102)\n"
+ "Period in frames\n")
+{
+ unsigned int period = atoi(argv[0]);
+
+ if (clck_gen_set_ind_period(period) < 0) {
+ vty_out(vty, "%% Invalid IND CLOCK period: %u%s", period, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_proxy_ep,
cfg_proxy_ep_cmd,
"ep NAME",
@@ -287,6 +323,11 @@
vty_out(vty, "proxy%s", VTY_NEWLINE);
if (g_proxy_ctx->bind_addr)
vty_out(vty, " bind-addr %s%s", g_proxy_ctx->bind_addr, VTY_NEWLINE);
+ if (clck_gen_get_start_fn() == CLCK_GEN_START_FN_RANDOM)
+ vty_out(vty, " clck-gen start-fn random%s", VTY_NEWLINE);
+ else
+ vty_out(vty, " clck-gen start-fn %d%s", clck_gen_get_start_fn(), VTY_NEWLINE);
+ vty_out(vty, " clck-gen ind-period %u%s", clck_gen_get_ind_period(), VTY_NEWLINE);
vty_out(vty, " pm-rssi-noise %d%s", path_sim_cfg_get_noise_dbm(g_proxy_ctx->path_sim), VTY_NEWLINE);
vty_out(vty, " path-loss %d%s", path_sim_cfg_get_path_loss_db(g_proxy_ctx->path_sim), VTY_NEWLINE);
vty_out(vty, " nominal-toa256 %d%s", path_sim_cfg_get_nom_toa256(g_proxy_ctx->path_sim), VTY_NEWLINE);
@@ -398,6 +439,8 @@
install_element(PROXY_NODE, &cfg_proxy_path_loss_cmd);
install_element(PROXY_NODE, &cfg_proxy_nom_toa256_cmd);
install_element(PROXY_NODE, &cfg_proxy_nom_ci_cmd);
+ install_element(PROXY_NODE, &cfg_proxy_clck_gen_start_fn_cmd);
+ install_element(PROXY_NODE, &cfg_proxy_clck_gen_ind_period_cmd);
install_element(PROXY_NODE, &cfg_proxy_ep_cmd);
install_element(PROXY_NODE, &cfg_no_proxy_ep_cmd);
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43628?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: I85bc0a1e4674685c7ddcf6627d139f4b8268f7a6
Gerrit-Change-Number: 43628
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
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43609?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: proxy: implement TRXC SETSLOT
......................................................................
proxy: implement TRXC SETSLOT
Store the timeslot config into per-chan timeslot state struct.
Currently unused, but may be useful later for VTY introspection.
Change-Id: I0f038fc453336e60d41641ec490907cddf259c3f
Related: OS#6672
---
M proxy/include/osmocom/proxy/trx.h
M proxy/src/ctrl_cmd.c
2 files changed, 31 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h
index 4f56a24..7301f62 100644
--- a/proxy/include/osmocom/proxy/trx.h
+++ b/proxy/include/osmocom/proxy/trx.h
@@ -6,6 +6,8 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
+#include <osmocom/trx/trxc.h>
+
#include <osmocom/proxy/path_sim.h>
struct osmo_trx_ep;
@@ -14,6 +16,15 @@
/*! dBm, nominal Tx power (per endpoint) */
#define PROXY_TRX_DEFAULT_TX_POWER 50
+/*! TDMA timeslots per GSM frame */
+#define PROXY_TRX_NUM_TS 8
+
+/*! Per-timeslot config received via SETSLOT. */
+struct proxy_trx_ts {
+ struct osmo_trxc_setslot cfg;
+ bool valid; /*!< has SETSLOT been received for this TS? */
+};
+
/*! Per-channel state: each channel is conceptually its own (child)
* transceiver with an independent Rx/Tx frequency, sharing the endpoint's
* power state and clock. */
@@ -22,6 +33,7 @@
uint32_t tx_freq; /*!< Tx frequency in Hz, 0 if not (yet) tuned */
bool rf_muted; /*!< RFMUTE: force NOPE.ind on bursts this channel transmits */
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) */
};
/*! One virtual transceiver endpoint */
diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c
index ceaed21..ca6ac7b 100644
--- a/proxy/src/ctrl_cmd.c
+++ b/proxy/src/ctrl_cmd.c
@@ -167,6 +167,23 @@
"RF mute %s\n", trx->chans[chan].rf_muted ? "on" : "off");
}
+static void ctrl_cmd_setslot(struct proxy_trx *trx, unsigned int chan,
+ const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp)
+{
+ struct osmo_trxc_setslot ss;
+
+ if (osmo_trxc_setslot_parse(&ss, cmd) < 0) {
+ LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR,
+ "%s(): Failed to parse command arguments: '%s'\n",
+ __func__, osmo_trxc_msg_name(cmd));
+ rsp->status = 1;
+ return;
+ }
+
+ trx->chans[chan].ts[ss.tn].cfg = ss;
+ trx->chans[chan].ts[ss.tn].valid = true;
+}
+
/* FAKE_TOA/FAKE_RSSI/FAKE_CI: "<delta>" adjusts the current value by delta;
* "<value> <threshold>" sets an absolute value with a +/-threshold random
* jitter applied on every forwarded burst (see path_sim_apply()). */
@@ -321,6 +338,8 @@
ctrl_cmd_nomtxpower(trx, chan, &rsp);
} else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_RFMUTE)) {
ctrl_cmd_rfmute(trx, chan, cmd, &rsp);
+ } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_SETSLOT)) {
+ ctrl_cmd_setslot(trx, chan, cmd, &rsp);
} else if (!strcmp(cmd->cmd, CTRL_CMD_SETTA)) {
ctrl_cmd_setta(trx, chan, cmd, &rsp);
} else if (!strcmp(cmd->cmd, CTRL_CMD_MEASURE)) {
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43609?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: I0f038fc453336e60d41641ec490907cddf259c3f
Gerrit-Change-Number: 43609
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