lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2026

  • 1 participants
  • 1894 discussions
[S] Change in osmo-trx[master]: proxy: implement TRXC SETFORMAT
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43610?usp=email ) Change subject: proxy: implement TRXC SETFORMAT ...................................................................... proxy: implement TRXC SETFORMAT Change-Id: I9c453e7ba2a799a8c4ce037afef14037b596a29d Related: OS#6672 --- M proxy/src/ctrl_cmd.c 1 file changed, 33 insertions(+), 0 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c index ca6ac7b..1f8c543 100644 --- a/proxy/src/ctrl_cmd.c +++ b/proxy/src/ctrl_cmd.c @@ -28,6 +28,7 @@ #include <osmocom/trx/ep.h> #include <osmocom/trx/trxc.h> +#include <osmocom/trx/trxd.h> #include <osmocom/proxy/proxy.h> #include <osmocom/proxy/trx.h> @@ -184,6 +185,36 @@ trx->chans[chan].ts[ss.tn].valid = true; } +/* SETFORMAT negotiates the TRXD PDU version used on the data socket: the + * response status carries the version to use (the requested one, or our + * preferred version if out of range), not a plain ACK/NACK. */ +static void ctrl_cmd_setformat(struct proxy_trx *trx, unsigned int chan, + const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp) +{ + int ver_req; + + if (osmo_trxc_msg_params_scan(cmd, "%d", &ver_req) != 1 || ver_req < 0) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, + "%s(): Failed to parse command arguments: '%s'\n", + __func__, osmo_trxc_msg_name(cmd)); + /* -1 is the reserved status for "no suitable version" / malformed + * request (see trx_if.adoc); clear params, there is no valid + * <ver_req> to echo back. */ + rsp->status = -1; + rsp->params[0] = '\0'; + return; + } + + if (ver_req > OSMO_TRXD_PDU_VER_MAX) + ver_req = OSMO_TRXD_PDU_VER_MAX; + + osmo_trx_ep_set_pdu_ver(trx->ep, chan, ver_req); + rsp->status = ver_req; + + LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO, + "TRXD header version set to %d\n", ver_req); +} + /* 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()). */ @@ -340,6 +371,8 @@ 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, OSMO_TRXC_CMD_SETFORMAT)) { + ctrl_cmd_setformat(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/+/43610?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: I9c453e7ba2a799a8c4ce037afef14037b596a29d Gerrit-Change-Number: 43610 Gerrit-PatchSet: 6 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-trx[master]: proxy: implement freq. hopping
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43611?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 freq. hopping ...................................................................... proxy: implement freq. hopping Handle TRXC SETFH ("<HSN> <MAIO> <RXF1> <TXF1> [... <RXFN> <TXFN>]"), storing a per-channel struct proxy_trx_fh (HSN, MAIO, and the parsed Mobile Allocation of Rx/Tx frequency pairs, struct proxy_trx_fh_freq). burst_fwd.c resolves both the source channel's Tx frequency and each candidate destination channel's Rx frequency per TDMA frame number via proxy_trx_fh_resolve() whenever a channel has hopping configured, falling back to the static RXTUNE/TXTUNE frequency otherwise. Change-Id: I574b4d4dc337f771b044bd868088b29db9902de9 Related: OS#6672 --- M proxy/include/osmocom/proxy/trx.h M proxy/src/burst_fwd.c M proxy/src/ctrl_cmd.c M proxy/src/trx.c 4 files changed, 163 insertions(+), 4 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h index 7301f62..633c9fa 100644 --- a/proxy/include/osmocom/proxy/trx.h +++ b/proxy/include/osmocom/proxy/trx.h @@ -25,6 +25,21 @@ bool valid; /*!< has SETSLOT been received for this TS? */ }; +/*! One Mobile Allocation entry: the Rx/Tx frequency pair for one ARFCN. */ +struct proxy_trx_fh_freq { + uint32_t rx_freq; /*!< Rx frequency in Hz */ + uint32_t tx_freq; /*!< Tx frequency in Hz */ +}; + +/*! Synthesizer frequency hopping parameters (SETFH), per 3GPP TS 45.002: + * HSN, MAIO and the Mobile Allocation (list of Rx/Tx frequency pairs). */ +struct proxy_trx_fh { + uint8_t hsn; + uint8_t maio; + unsigned int ma_len; + struct proxy_trx_fh_freq *ma; /*!< talloc array of ma_len entries */ +}; + /*! 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. */ @@ -34,6 +49,7 @@ 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) */ + struct proxy_trx_fh *fh; /*!< frequency hopping config (SETFH), NULL if disabled */ }; /*! One virtual transceiver endpoint */ @@ -62,3 +78,8 @@ 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); + +struct proxy_trx_fh *proxy_trx_fh_alloc(void *talloc_ctx, uint8_t hsn, uint8_t maio, + const struct proxy_trx_fh_freq *ma, unsigned int ma_len); +void proxy_trx_fh_resolve(const struct proxy_trx_fh *fh, uint32_t fn, + uint32_t *rx_freq, uint32_t *tx_freq); diff --git a/proxy/src/burst_fwd.c b/proxy/src/burst_fwd.c index 2166714..de057b6 100644 --- a/proxy/src/burst_fwd.c +++ b/proxy/src/burst_fwd.c @@ -66,8 +66,8 @@ } /*! 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). */ + * whose Rx frequency matches the source channel's Tx frequency (resolved + * per TDMA frame number if frequency hopping (SETFH) is configured). */ void osmo_trx_ep_rx_burst_req(struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_req *br) { @@ -81,7 +81,10 @@ return; } - tx_freq = src->chans[chan].tx_freq; + if (src->chans[chan].fh != NULL) + proxy_trx_fh_resolve(src->chans[chan].fh, br->fn, NULL, &tx_freq); + else + tx_freq = src->chans[chan].tx_freq; llist_for_each_entry(dst, &g_proxy_ctx->trx_list, list) { unsigned int dst_chan; @@ -90,7 +93,15 @@ continue; for (dst_chan = 0; dst_chan < dst->num_chans; dst_chan++) { - if (dst->chans[dst_chan].rx_freq != tx_freq) + struct proxy_trx_chan *dc = &dst->chans[dst_chan]; + uint32_t rx_freq; + + if (dc->fh != NULL) + proxy_trx_fh_resolve(dc->fh, br->fn, &rx_freq, NULL); + else + rx_freq = dc->rx_freq; + + if (rx_freq != tx_freq) continue; 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 1f8c543..c6b238a 100644 --- a/proxy/src/ctrl_cmd.c +++ b/proxy/src/ctrl_cmd.c @@ -26,6 +26,9 @@ #include <stdio.h> #include <string.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/talloc.h> + #include <osmocom/trx/ep.h> #include <osmocom/trx/trxc.h> #include <osmocom/trx/trxd.h> @@ -38,6 +41,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_SETFH "SETFH" #define CTRL_CMD_MEASURE "MEASURE" #define CTRL_CMD_FAKE_TOA "FAKE_TOA" #define CTRL_CMD_FAKE_RSSI "FAKE_RSSI" @@ -185,6 +189,82 @@ trx->chans[chan].ts[ss.tn].valid = true; } +/* Max Mobile Allocation length accepted by SETFH (GSM ARFCN range) */ +#define CTRL_CMD_SETFH_MA_MAX 64 + +/* Syntax: "CMD SETFH <HSN> <MAIO> <RXF1> <TXF1> [... <RXFN> <TXFN>]", + * frequencies in kHz. Configures synthesizer frequency hopping (3GPP TS + * 45.002); the per-burst Rx/Tx frequencies are then resolved by TDMA frame + * number (see proxy_trx_fh_resolve(), used from burst_fwd.c). */ +static void ctrl_cmd_setfh(struct proxy_trx *trx, unsigned int chan, + const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp) +{ + struct proxy_trx_fh_freq ma[CTRL_CMD_SETFH_MA_MAX]; + char params[OSMO_TRXC_PARAMS_LEN_MAX]; + char *saveptr, *tok; + unsigned int hsn, maio, ma_len = 0; + + OSMO_STRLCPY_ARRAY(params, cmd->params); + + tok = strtok_r(params, " ", &saveptr); + if (tok == NULL || sscanf(tok, "%u", &hsn) != 1 || hsn > 63) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, "Rx SETFH with invalid HSN\n"); + rsp->status = 1; + return; + } + + tok = strtok_r(NULL, " ", &saveptr); + if (tok == NULL || sscanf(tok, "%u", &maio) != 1 || maio > 63) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, "Rx SETFH with invalid MAIO\n"); + rsp->status = 1; + return; + } + + while ((tok = strtok_r(NULL, " ", &saveptr)) != NULL) { + unsigned int rx_khz, tx_khz; + char *tok2; + + if (ma_len >= ARRAY_SIZE(ma) || sscanf(tok, "%u", &rx_khz) != 1) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, + "Rx SETFH with an invalid/too long Mobile Allocation\n"); + rsp->status = 1; + return; + } + + tok2 = strtok_r(NULL, " ", &saveptr); + if (tok2 == NULL || sscanf(tok2, "%u", &tx_khz) != 1) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, + "Rx SETFH with an odd/malformed Mobile Allocation\n"); + rsp->status = 1; + return; + } + + ma[ma_len].rx_freq = rx_khz * 1000; + ma[ma_len].tx_freq = tx_khz * 1000; + ma_len++; + } + + if (ma_len == 0) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, + "Rx SETFH with an empty Mobile Allocation\n"); + rsp->status = 1; + return; + } + + talloc_free(trx->chans[chan].fh); + trx->chans[chan].fh = proxy_trx_fh_alloc(trx, hsn, maio, ma, ma_len); + if (trx->chans[chan].fh == NULL) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, + "%s(): Failed to allocate frequency hopping state\n", __func__); + rsp->status = 1; + return; + } + + LOGP_TRXCH(trx, chan, DTRXC, LOGL_INFO, + "Frequency hopping configured: hsn=%u, maio=%u, ma_len=%u\n", + hsn, maio, ma_len); +} + /* SETFORMAT negotiates the TRXD PDU version used on the data socket: the * response status carries the version to use (the requested one, or our * preferred version if out of range), not a plain ACK/NACK. */ @@ -375,6 +455,8 @@ ctrl_cmd_setformat(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_SETFH)) { + ctrl_cmd_setfh(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)) { diff --git a/proxy/src/trx.c b/proxy/src/trx.c index eb42ebe..da315d1 100644 --- a/proxy/src/trx.c +++ b/proxy/src/trx.c @@ -30,6 +30,9 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/gsm0502.h> + #include <osmocom/trx/ep.h> #include <osmocom/proxy/proxy.h> @@ -150,3 +153,45 @@ trx->num_chans = num_chans; return 0; } + +/*! Allocate a frequency hopping configuration; ma is copied. */ +struct proxy_trx_fh *proxy_trx_fh_alloc(void *talloc_ctx, uint8_t hsn, uint8_t maio, + const struct proxy_trx_fh_freq *ma, unsigned int ma_len) +{ + struct proxy_trx_fh *fh; + + if (ma_len == 0) + return NULL; + + fh = talloc_zero(talloc_ctx, struct proxy_trx_fh); + if (fh == NULL) + return NULL; + + fh->ma = talloc_memdup(fh, ma, ma_len * sizeof(*ma)); + if (fh->ma == NULL) { + talloc_free(fh); + return NULL; + } + + fh->hsn = hsn; + fh->maio = maio; + fh->ma_len = ma_len; + + return fh; +} + +/*! Resolve the Rx/Tx frequencies to use for the given TDMA frame number. */ +void proxy_trx_fh_resolve(const struct proxy_trx_fh *fh, uint32_t fn, + uint32_t *rx_freq, uint32_t *tx_freq) +{ + struct gsm_time gt; + uint16_t mai; + + gsm_fn2gsmtime(&gt, fn); + mai = gsm0502_hop_seq_gen(&gt, fh->hsn, fh->maio, fh->ma_len, NULL); + + if (rx_freq) + *rx_freq = fh->ma[mai].rx_freq; + if (tx_freq) + *tx_freq = fh->ma[mai].tx_freq; +} -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43611?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: I574b4d4dc337f771b044bd868088b29db9902de9 Gerrit-Change-Number: 43611 Gerrit-PatchSet: 6 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-trx[master]: Transceiver52M: check rc of osmo_trxc_msg_params_scan()
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43682?usp=email ) Change subject: Transceiver52M: check rc of osmo_trxc_msg_params_scan() ...................................................................... Transceiver52M: check rc of osmo_trxc_msg_params_scan() Change-Id: Ibb029e04816209423569037890fe85dcf174bd7b Fixes: CID#564238 --- M Transceiver52M/Transceiver.cpp 1 file changed, 17 insertions(+), 10 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 865b122..fb2cdd9 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -1060,18 +1060,25 @@ } else if (!strcmp(cmd.cmd, "SETFORMAT")) { // set TRXD protocol version unsigned version_recv = 0; - osmo_trxc_msg_params_scan(&cmd, "%u", &version_recv); - LOGCHAN(chan, DTRXCTRL, INFO) << "BTS requests TRXD version switch: " << version_recv; - if (version_recv > TRX_DATA_FORMAT_VER) { - LOGCHAN(chan, DTRXCTRL, INFO) << "rejecting TRXD version " << version_recv - << " in favor of " << TRX_DATA_FORMAT_VER; - rsp.status = TRX_DATA_FORMAT_VER; + if (osmo_trxc_msg_params_scan(&cmd, "%u", &version_recv) != 1) { + LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus message on control interface"; + /* Unlike other commands, SETFORMAT's status is not a generic ACK/NACK + * but the negotiated/preferred version; -1 is the reserved value for + * "no suitable version" / malformed request. */ + rsp.status = -1; } else { - LOGCHAN(chan, DTRXCTRL, NOTICE) << "switching to TRXD version " << version_recv; - mVersionTRXD[chan] = version_recv; - rsp.status = version_recv; + LOGCHAN(chan, DTRXCTRL, INFO) << "BTS requests TRXD version switch: " << version_recv; + if (version_recv > TRX_DATA_FORMAT_VER) { + LOGCHAN(chan, DTRXCTRL, INFO) << "rejecting TRXD version " << version_recv + << " in favor of " << TRX_DATA_FORMAT_VER; + rsp.status = TRX_DATA_FORMAT_VER; + } else { + LOGCHAN(chan, DTRXCTRL, NOTICE) << "switching to TRXD version " << version_recv; + mVersionTRXD[chan] = version_recv; + rsp.status = version_recv; + } + snprintf(rsp.params, sizeof(rsp.params), "%u", version_recv); } - snprintf(rsp.params, sizeof(rsp.params), "%u", version_recv); } else if (!strcmp(cmd.cmd, "RFMUTE")) { // (Un)mute RF TX and RX unsigned mute = 0; -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43682?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: Ibb029e04816209423569037890fe85dcf174bd7b Gerrit-Change-Number: 43682 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-trx[master]: osmo-trx-proxy: initial app skeleton
by fixeria 19 Sep '26

19 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43603?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: osmo-trx-proxy: initial app skeleton ...................................................................... osmo-trx-proxy: initial app skeleton osmo-trx-proxy is a C rewrite of the fake_trx.py: a virtual TRX endpoint that BTS/MS-side L1 implementations (osmo-bts-trx, trxcon) can connect to over the TRXC/TRXD protocol instead of real RF hardware, useful for testing without SDR devices. This first commit adds just the daemon skeleton (config context, VTY, logging). Change-Id: Id2b12e5e7d053eea53338fbabc48131b9c46c82a Related: OS#6672 --- M .gitignore M Makefile.am M configure.ac A proxy/Makefile.am A proxy/include/osmocom/proxy/logging.h A proxy/include/osmocom/proxy/proxy.h A proxy/include/osmocom/proxy/trx.h A proxy/include/osmocom/proxy/vty.h A proxy/src/Makefile.am A proxy/src/logging.c A proxy/src/main.c A proxy/src/proxy.c A proxy/src/trx.c A proxy/src/vty.c 14 files changed, 871 insertions(+), 0 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve diff --git a/.gitignore b/.gitignore index 164e863..8c51628 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ Transceiver52M/osmo-trx-ms-uhd Transceiver52M/osmo-trx-ms-ipc Transceiver52M/device/ipc/uhddev_ipc.cpp +proxy/src/osmo-trx-proxy .clang-format diff --git a/Makefile.am b/Makefile.am index 844d6e7..2585fdf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,13 @@ # Order must be preserved SUBDIRS += \ libosmo-trx \ + $(NULL) + +if ENABLE_PROXY +SUBDIRS += proxy +endif + +SUBDIRS += \ CommonLibs \ GSM \ Transceiver52M \ diff --git a/configure.ac b/configure.ac index e18f943..fd71f47 100644 --- a/configure.ac +++ b/configure.ac @@ -162,6 +162,11 @@ [enable MS TRX]) ]) +AC_ARG_WITH(proxy, [ + AS_HELP_STRING([--with-proxy], + [enable osmo-trx-proxy [default=enabled]]) +]) + AC_ARG_WITH(neon, [ AS_HELP_STRING([--with-neon], [enable ARM NEON support]) @@ -288,6 +293,7 @@ AM_CONDITIONAL(ARCH_ARM, [test "x$with_neon" = "xyes" || test "x$with_neon_vfpv4" = "xyes"]) AM_CONDITIONAL(ARCH_ARM_A15, [test "x$with_neon_vfpv4" = "xyes"]) AM_CONDITIONAL(ENABLE_MS_TRX, [test "x$with_mstrx" = "xyes"]) +AM_CONDITIONAL(ENABLE_PROXY, [test "x$with_proxy" != "xno"]) # Disable Multi ARFCN support AC_ARG_ENABLE(multi-arfcn, @@ -375,6 +381,8 @@ libosmo-trx/src/Makefile \ libosmo-trx/libosmo-trx.pc \ libosmo-trx/Doxyfile.trx \ + proxy/Makefile \ + proxy/src/Makefile \ CommonLibs/Makefile \ GSM/Makefile \ Transceiver52M/Makefile \ diff --git a/proxy/Makefile.am b/proxy/Makefile.am new file mode 100644 index 0000000..23a1d3a --- /dev/null +++ b/proxy/Makefile.am @@ -0,0 +1,10 @@ +SUBDIRS = \ + src \ + $(NULL) + +noinst_HEADERS = \ + include/osmocom/proxy/logging.h \ + include/osmocom/proxy/proxy.h \ + include/osmocom/proxy/trx.h \ + include/osmocom/proxy/vty.h \ + $(NULL) diff --git a/proxy/include/osmocom/proxy/logging.h b/proxy/include/osmocom/proxy/logging.h new file mode 100644 index 0000000..6e94ba0 --- /dev/null +++ b/proxy/include/osmocom/proxy/logging.h @@ -0,0 +1,11 @@ +#pragma once + +#include <osmocom/core/logging.h> + +extern const struct log_info log_info; + +enum { + DPROXY, /* main/vty/config */ + DTRXC, /* TRXC (control) + clock handling */ + DTRXD, /* TRXD (burst data) handling / forwarding */ +}; diff --git a/proxy/include/osmocom/proxy/proxy.h b/proxy/include/osmocom/proxy/proxy.h new file mode 100644 index 0000000..080ff53 --- /dev/null +++ b/proxy/include/osmocom/proxy/proxy.h @@ -0,0 +1,25 @@ +#pragma once + +#include <stdbool.h> + +#include <osmocom/core/linuxlist.h> + +#define PROXY_DEFAULT_BIND_ADDR "0.0.0.0" + +/* Endpoints created when the config file defines none explicitly */ +#define PROXY_DEFAULT_REMOTE_ADDR "127.0.0.1" +#define PROXY_DEFAULT_BTS_NAME "bts" +#define PROXY_DEFAULT_BTS_PORT 5700 +#define PROXY_DEFAULT_MS_NAME "ms" +#define PROXY_DEFAULT_MS_PORT 6700 + +struct proxy_ctx { + char *bind_addr; + struct llist_head trx_list; /*!< struct proxy_trx::list */ +}; + +extern struct proxy_ctx *g_proxy_ctx; + +struct proxy_ctx *proxy_ctx_alloc(void *talloc_ctx); +void proxy_ctx_free(struct proxy_ctx *proxy); +int proxy_ctx_add_defaults_if_empty(struct proxy_ctx *proxy); diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h new file mode 100644 index 0000000..e687825 --- /dev/null +++ b/proxy/include/osmocom/proxy/trx.h @@ -0,0 +1,24 @@ +#pragma once + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/logging.h> + +struct osmo_trx_ep; +struct proxy_ctx; + +/*! One virtual transceiver endpoint */ +struct proxy_trx { + struct llist_head list; + char *name; + struct osmo_trx_ep *ep; +}; + +#define LOGP_TRX(trx, ss, level, fmt, args...) \ + LOGP(ss, level, "(trx=%s) " fmt, (trx)->name, ##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); diff --git a/proxy/include/osmocom/proxy/vty.h b/proxy/include/osmocom/proxy/vty.h new file mode 100644 index 0000000..e23b350 --- /dev/null +++ b/proxy/include/osmocom/proxy/vty.h @@ -0,0 +1,3 @@ +#pragma once + +int proxy_vty_init(void); diff --git a/proxy/src/Makefile.am b/proxy/src/Makefile.am new file mode 100644 index 0000000..0350474 --- /dev/null +++ b/proxy/src/Makefile.am @@ -0,0 +1,29 @@ +AM_CPPFLAGS = \ + -Wall \ + -I$(top_srcdir)/proxy/include \ + -I$(top_srcdir)/libosmo-trx/include \ + -I$(top_builddir)/libosmo-trx/include \ + $(NULL) + +AM_CFLAGS = \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +bin_PROGRAMS = osmo-trx-proxy + +osmo_trx_proxy_SOURCES = \ + main.c \ + proxy.c \ + vty.c \ + trx.c \ + logging.c \ + $(NULL) + +osmo_trx_proxy_LDADD = \ + $(top_builddir)/libosmo-trx/src/libosmo-trx.la \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(NULL) diff --git a/proxy/src/logging.c b/proxy/src/logging.c new file mode 100644 index 0000000..b1d3fbb --- /dev/null +++ b/proxy/src/logging.c @@ -0,0 +1,57 @@ +/*! \file src/logging.c + * osmo-trx-proxy: log category definitions. */ + +/* + * (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 <osmocom/core/logging.h> +#include <osmocom/core/utils.h> + +#include <osmocom/proxy/logging.h> + +static const struct log_info_cat default_categories[] = { + [DPROXY] = { + .name = "DPROXY", + .description = "Main generic category", + .loglevel = LOGL_INFO, + .enabled = 1, + }, + [DTRXC] = { + .name = "DTRXC", + .description = "TRXC (control) interface + clock handling", + .color = "\033[1;33m", + .loglevel = LOGL_NOTICE, + .enabled = 1, + }, + [DTRXD] = { + .name = "DTRXD", + .description = "TRXD (burst data) interface handling / forwarding", + .color = "\033[1;33m", + .loglevel = LOGL_NOTICE, + .enabled = 1, + }, +}; + +const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; diff --git a/proxy/src/main.c b/proxy/src/main.c new file mode 100644 index 0000000..5ac023a --- /dev/null +++ b/proxy/src/main.c @@ -0,0 +1,150 @@ +/*! \file src/main.c + * osmo-trx-proxy: main program entry point. */ + +/* + * (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 <stdlib.h> +#include <signal.h> +#include <getopt.h> + +#include <osmocom/core/talloc.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/select.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/application.h> +#include <osmocom/vty/vty.h> +#include <osmocom/vty/command.h> +#include <osmocom/vty/cpu_sched_vty.h> +#include <osmocom/vty/telnet_interface.h> +#include <osmocom/vty/ports.h> + +#include <osmocom/proxy/proxy.h> +#include <osmocom/proxy/vty.h> +#include <osmocom/proxy/trx.h> +#include <osmocom/proxy/logging.h> + +void *g_talloc_ctx; +static char *g_config_file = "osmo-trx-proxy.cfg"; +static volatile sig_atomic_t g_quit = 0; + +static void print_help(void) +{ + printf("Usage: osmo-trx-proxy [options]\n"); + printf(" -h, --help This text\n"); + printf(" -c, --config-file FILE Specify the configuration file (default: %s)\n", + g_config_file); +} + +static void handle_options(int argc, char **argv) +{ + while (1) { + int option_index = 0; + static const struct option long_options[] = { + { "help", 0, 0, 'h' }, + { "config-file", 1, 0, 'c' }, + { 0, 0, 0, 0 } + }; + + int c = getopt_long(argc, argv, "hc:", long_options, &option_index); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(); + exit(0); + case 'c': + g_config_file = optarg; + break; + default: + exit(2); + } + } +} + +static void signal_handler(int signum) +{ + switch (signum) { + case SIGINT: + case SIGTERM: + g_quit = 1; + break; + default: + break; + } +} + +int main(int argc, char **argv) +{ + int rc; + + g_talloc_ctx = talloc_named_const(NULL, 0, "osmo-trx-proxy"); + msgb_talloc_ctx_init(g_talloc_ctx, 0); + + signal(SIGINT, &signal_handler); + signal(SIGTERM, &signal_handler); + osmo_init_ignore_signals(); + + g_proxy_ctx = proxy_ctx_alloc(g_talloc_ctx); + OSMO_ASSERT(g_proxy_ctx != NULL); + + osmo_init_logging2(g_talloc_ctx, &log_info); + log_set_print_extended_timestamp(osmo_stderr_target, 1); + log_set_print_category_hex(osmo_stderr_target, 0); + log_set_print_category(osmo_stderr_target, 1); + log_set_print_level(osmo_stderr_target, 1); + log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME); + log_set_print_filename_pos(osmo_stderr_target, LOG_FILENAME_POS_LINE_END); + + proxy_vty_init(); + + handle_options(argc, argv); + + rc = vty_read_config_file(g_config_file, NULL); + if (rc < 0) { + fprintf(stderr, "Failed to open config file: '%s'\n", g_config_file); + return 2; + } + + rc = telnet_init_default(g_talloc_ctx, NULL, OSMO_VTY_PORT_TRX); + if (rc < 0) + return 1; + + osmo_cpu_sched_vty_apply_localthread(); + + /* Only apply the built-in BTS/MS defaults if the config file did not + * declare any 'ep' stanza of its own. */ + rc = proxy_ctx_add_defaults_if_empty(g_proxy_ctx); + if (rc < 0) + return 1; + + LOGP(DPROXY, LOGL_NOTICE, "osmo-trx-proxy started\n"); + + while (!g_quit) + osmo_select_main(0); + + LOGP(DPROXY, LOGL_NOTICE, "Shutting down...\n"); + proxy_ctx_free(g_proxy_ctx); + return 0; +} diff --git a/proxy/src/proxy.c b/proxy/src/proxy.c new file mode 100644 index 0000000..b194bc9 --- /dev/null +++ b/proxy/src/proxy.c @@ -0,0 +1,101 @@ +/*! \file src/proxy.c + * osmo-trx-proxy: top-level daemon context (struct proxy_ctx). */ + +/* + * (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 <errno.h> + +#include <osmocom/core/talloc.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> + +struct proxy_ctx *g_proxy_ctx = NULL; + +struct proxy_ctx *proxy_ctx_alloc(void *talloc_ctx) +{ + struct proxy_ctx *proxy; + + proxy = talloc_zero(talloc_ctx, struct proxy_ctx); + if (proxy == NULL) + return NULL; + + proxy->bind_addr = talloc_strdup(proxy, PROXY_DEFAULT_BIND_ADDR); + INIT_LLIST_HEAD(&proxy->trx_list); + + return proxy; +} + +void proxy_ctx_free(struct proxy_ctx *proxy) +{ + struct proxy_trx *trx, *trx2; + + if (!proxy) + return; + + llist_for_each_entry_safe(trx, trx2, &proxy->trx_list, list) { + proxy_trx_close(trx); + proxy_trx_free(trx); + } + + talloc_free(proxy); +} + +/*! Populate the config with the default BTS/MS endpoints (base ports 5700 + * and 6700) and open them, iff the config file did not declare any + * endpoint explicitly. + * \returns 0 on success; negative on error (see proxy_trx_open()) */ +int proxy_ctx_add_defaults_if_empty(struct proxy_ctx *proxy) +{ + struct proxy_trx *trx; + int rc; + + if (!llist_empty(&proxy->trx_list)) + return 0; + + LOGP(DPROXY, LOGL_NOTICE, + "No endpoints configured, creating defaults ('%s' and '%s')\n", + PROXY_DEFAULT_BTS_NAME, PROXY_DEFAULT_MS_NAME); + + trx = proxy_trx_alloc(proxy, PROXY_DEFAULT_BTS_NAME); + osmo_trx_ep_set_raddr(trx->ep, PROXY_DEFAULT_REMOTE_ADDR); + osmo_trx_ep_set_base_port(trx->ep, PROXY_DEFAULT_BTS_PORT); + rc = proxy_trx_open(trx); + if (rc != 0) + return rc; + + trx = proxy_trx_alloc(proxy, PROXY_DEFAULT_MS_NAME); + osmo_trx_ep_set_raddr(trx->ep, PROXY_DEFAULT_REMOTE_ADDR); + osmo_trx_ep_set_base_port(trx->ep, PROXY_DEFAULT_MS_PORT); + /* MS (trxcon) side has no use for TRX clock indications */ + osmo_trx_ep_set_clock_socket(trx->ep, false); + rc = proxy_trx_open(trx); + if (rc != 0) + return rc; + + return 0; +} diff --git a/proxy/src/trx.c b/proxy/src/trx.c new file mode 100644 index 0000000..6eab496 --- /dev/null +++ b/proxy/src/trx.c @@ -0,0 +1,108 @@ +/*! \file src/trx.c + * osmo-trx-proxy: virtual transceiver management. */ + +/* + * (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 <errno.h> +#include <string.h> + +#include <osmocom/core/talloc.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> + +struct proxy_trx *proxy_trx_alloc(struct proxy_ctx *proxy, const char *name) +{ + struct proxy_trx *trx; + + trx = talloc_zero(proxy, struct proxy_trx); + if (trx == NULL) + return NULL; + + trx->name = talloc_strdup(trx, name); + trx->ep = osmo_trx_ep_alloc(trx, 1); + if (trx->ep == NULL) { + talloc_free(trx); + return NULL; + } + + osmo_trx_ep_set_priv(trx->ep, trx); + osmo_trx_ep_set_name(trx->ep, "%s", name); + osmo_trx_ep_set_log_cat(trx->ep, DPROXY); + osmo_trx_ep_set_mode(trx->ep, OSMO_TRX_EP_MODE_TRX); + osmo_trx_ep_set_laddr(trx->ep, proxy->bind_addr); + osmo_trx_ep_set_clock_socket(trx->ep, true); + osmo_trx_ep_set_ctrl_promisc(trx->ep, true); + + llist_add_tail(&trx->list, &proxy->trx_list); + + return trx; +} + +struct proxy_trx *proxy_trx_find(struct proxy_ctx *proxy, const char *name) +{ + struct proxy_trx *trx; + + llist_for_each_entry(trx, &proxy->trx_list, list) { + if (strcmp(trx->name, name) == 0) + return trx; + } + + return NULL; +} + +void proxy_trx_close(struct proxy_trx *trx) +{ + if (!trx) + return; + osmo_trx_ep_close(trx->ep); +} + +void proxy_trx_free(struct proxy_trx *trx) +{ + if (!trx) + return; + osmo_trx_ep_free(trx->ep); + llist_del(&trx->list); + talloc_free(trx); +} + +int proxy_trx_open(struct proxy_trx *trx) +{ + int rc; + + rc = osmo_trx_ep_open(trx->ep); + if (rc < 0 && rc != -EALREADY) { + LOGP_TRX(trx, DPROXY, LOGL_ERROR, + "Failed to open TRX endpoint %s:%u\n", + osmo_trx_ep_get_raddr(trx->ep), + osmo_trx_ep_get_base_port(trx->ep)); + return rc; + } + + return 0; +} diff --git a/proxy/src/vty.c b/proxy/src/vty.c new file mode 100644 index 0000000..086fe50 --- /dev/null +++ b/proxy/src/vty.c @@ -0,0 +1,337 @@ +/*! \file src/vty.c + * osmo-trx-proxy: VTY configuration interface. */ + +/* + * (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 <errno.h> +#include <stdlib.h> +#include <string.h> + +#include <osmocom/core/talloc.h> +#include <osmocom/core/utils.h> + +#include <osmocom/vty/command.h> +#include <osmocom/vty/vty.h> +#include <osmocom/vty/misc.h> +#include <osmocom/vty/logging.h> +#include <osmocom/vty/cpu_sched_vty.h> + +#include <osmocom/trx/ep.h> + +#include <osmocom/proxy/proxy.h> +#include <osmocom/proxy/vty.h> +#include <osmocom/proxy/trx.h> + +extern void *g_talloc_ctx; + +enum proxy_vty_node { + PROXY_NODE = _LAST_OSMOVTY_NODE + 1, + EP_NODE, +}; + +static struct cmd_node proxy_node = { + PROXY_NODE, + "%s(config-proxy)# ", + 1, +}; + +static struct cmd_node ep_node = { + EP_NODE, + "%s(config-proxy-ep)# ", + 1, +}; + +static int dummy_config_write(struct vty *vty) +{ + return CMD_SUCCESS; +} + +DEFUN(cfg_proxy, + cfg_proxy_cmd, + "proxy", + "Configure osmo-trx-proxy\n") +{ + vty->node = PROXY_NODE; + vty->index = g_proxy_ctx; + + return CMD_SUCCESS; +} + +DEFUN(cfg_proxy_bind_addr, + cfg_proxy_bind_addr_cmd, + "bind-addr " VTY_IPV46_CMD, + "Set the default local bind address for endpoints without one of their own\n" + "IPv4 Address\n" + "IPv6 Address\n") +{ + struct proxy_ctx *proxy = vty->index; + + osmo_talloc_replace_string(proxy, &proxy->bind_addr, argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_proxy_ep, + cfg_proxy_ep_cmd, + "ep NAME", + "Configure a virtual TRX endpoint\n" + "Endpoint name (used for logging)\n") +{ + struct proxy_ctx *proxy = vty->index; + struct proxy_trx *trx = proxy_trx_find(proxy, argv[0]); + + if (!trx) + trx = proxy_trx_alloc(proxy, argv[0]); + + vty->node = EP_NODE; + vty->index = trx; + + return CMD_SUCCESS; +} + +DEFUN(cfg_no_proxy_ep, + cfg_no_proxy_ep_cmd, + "no ep NAME", + NO_STR "Remove a virtual TRX endpoint, closing its sockets if currently open\n" + "Endpoint name\n") +{ + struct proxy_ctx *proxy = vty->index; + struct proxy_trx *trx = proxy_trx_find(proxy, argv[0]); + + if (!trx) { + vty_out(vty, "%% Endpoint '%s' does not exist%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + + proxy_trx_free(trx); + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_remote_addr, + cfg_ep_remote_addr_cmd, + "remote-addr " VTY_IPV46_CMD, + "Set the remote (L1 peer) IP address\n" + "IPv4 Address\n" + "IPv6 Address\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_raddr(trx->ep, argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_bind_addr, + cfg_ep_bind_addr_cmd, + "bind-addr " VTY_IPV46_CMD, + "Set the local bind address for this endpoint, overriding the 'proxy' default\n" + "IPv4 Address\n" + "IPv6 Address\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_laddr(trx->ep, argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_base_port, + cfg_ep_base_port_cmd, + "base-port <1-65535>", + "Set the TRX base port\n" + "Base port (clock: +0, per channel N: ctrl +2N+1, data +2N+2)\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_base_port(trx->ep, atoi(argv[0])); + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_num_chans, + cfg_ep_num_chans_cmd, + "num-chans <1-16>", + "Set the number of channels (1 + number of child transceivers)\n" + "Number of channels\n") +{ + struct proxy_trx *trx = vty->index; + int num_chans = atoi(argv[0]); + int rc; + + rc = osmo_trx_ep_set_num_chans(trx->ep, num_chans); + if (rc) { + vty_out(vty, "%% osmo_trx_ep_set_num_chans(%d) failed: rc=%d%s", + num_chans, rc, VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_clock_socket, + cfg_ep_clock_socket_cmd, + "clock-socket", + "Enable the clock socket for this endpoint (default)\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_clock_socket(trx->ep, true); + + return CMD_SUCCESS; +} + +DEFUN(cfg_ep_no_clock_socket, + cfg_ep_no_clock_socket_cmd, + "no clock-socket", + NO_STR "Disable the clock socket for this endpoint\n") +{ + struct proxy_trx *trx = vty->index; + + osmo_trx_ep_set_clock_socket(trx->ep, false); + + return CMD_SUCCESS; +} + +static int config_write_proxy(struct vty *vty) +{ + struct proxy_trx *trx; + + 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); + + llist_for_each_entry(trx, &g_proxy_ctx->trx_list, list) { + const char *raddr = osmo_trx_ep_get_raddr(trx->ep); + const char *laddr = osmo_trx_ep_get_laddr(trx->ep); + + vty_out(vty, " ep %s%s", trx->name, VTY_NEWLINE); + if (raddr) + vty_out(vty, " remote-addr %s%s", raddr, VTY_NEWLINE); + 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); + + if (!osmo_trx_ep_get_clock_socket(trx->ep)) + vty_out(vty, " no clock-socket%s", VTY_NEWLINE); + } + + return CMD_SUCCESS; +} + +DEFUN(show_proxy, + show_proxy_cmd, + "show proxy", + SHOW_STR "Display 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", + 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", + VTY_NEWLINE); + } + + 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 + * should not be left (so the user/config can fix the problem). */ +static int proxy_vty_ep_node_exit(struct vty *vty, struct proxy_trx *trx) +{ + int rc = proxy_trx_open(trx); + + if (rc < 0 && rc != -EALREADY) { + vty_out(vty, "%% Endpoint '%s': failed to open%s", + trx->name, VTY_NEWLINE); + return -1; + } + + return 0; +} + +static int proxy_vty_go_parent(struct vty *vty) +{ + switch (vty->node) { + case PROXY_NODE: + vty->node = CONFIG_NODE; + break; + case EP_NODE: + if (proxy_vty_ep_node_exit(vty, vty->index) != 0) + break; + vty->node = PROXY_NODE; + vty->index = g_proxy_ctx; + break; + default: + vty->node = CONFIG_NODE; + } + + return vty->node; +} + +static struct vty_app_info g_vty_info = { + .name = "OsmoTRXProxy", + .copyright = + "Copyright (C) 2026 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>\r\n" + "Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de>\r\n" + "License AGPLv3+: GNU AGPL version 3 or later " + "<http://gnu.org/licenses/agpl-3.0.html>\r\n" + "This is free software: you are free to change and redistribute it.\r\n" + "There is NO WARRANTY, to the extent permitted by law.\r\n", + .go_parent_cb = proxy_vty_go_parent, +}; + +int proxy_vty_init(void) +{ + g_vty_info.tall_ctx = g_talloc_ctx; + vty_init(&g_vty_info); + + logging_vty_add_cmds(); + osmo_talloc_vty_add_cmds(); + osmo_cpu_sched_vty_init(g_talloc_ctx); + + install_element_ve(&show_proxy_cmd); + + 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_ep_cmd); + install_element(PROXY_NODE, &cfg_no_proxy_ep_cmd); + + install_node(&ep_node, dummy_config_write); + install_element(EP_NODE, &cfg_ep_remote_addr_cmd); + 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_clock_socket_cmd); + install_element(EP_NODE, &cfg_ep_no_clock_socket_cmd); + + return 0; +} -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43603?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: Id2b12e5e7d053eea53338fbabc48131b9c46c82a Gerrit-Change-Number: 43603 Gerrit-PatchSet: 6 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-trx[master]: proxy: implement TRXC SETFORMAT
by fixeria 19 Sep '26

19 Sep '26
Attention is currently required from: laforge, pespin. fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-trx/+/43610?usp=email ) Change subject: proxy: implement TRXC SETFORMAT ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43610?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I9c453e7ba2a799a8c4ce037afef14037b596a29d Gerrit-Change-Number: 43610 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> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Sat, 19 Sep 2026 22:41:08 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-trx[master]: Transceiver52M: check rc of osmo_trxc_msg_params_scan()
by fixeria 19 Sep '26

19 Sep '26
fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-trx/+/43682?usp=email ) Change subject: Transceiver52M: check rc of osmo_trxc_msg_params_scan() ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43682?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ibb029e04816209423569037890fe85dcf174bd7b Gerrit-Change-Number: 43682 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sat, 19 Sep 2026 22:41:01 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[L] Change in osmo-trx[master]: osmo-trx-proxy: initial app skeleton
by fixeria 19 Sep '26

19 Sep '26
Attention is currently required from: fixeria. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-trx/+/43603?usp=email to look at the new patch set (#6). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. Change subject: osmo-trx-proxy: initial app skeleton ...................................................................... osmo-trx-proxy: initial app skeleton osmo-trx-proxy is a C rewrite of the fake_trx.py: a virtual TRX endpoint that BTS/MS-side L1 implementations (osmo-bts-trx, trxcon) can connect to over the TRXC/TRXD protocol instead of real RF hardware, useful for testing without SDR devices. This first commit adds just the daemon skeleton (config context, VTY, logging). Change-Id: Id2b12e5e7d053eea53338fbabc48131b9c46c82a Related: OS#6672 --- M .gitignore M Makefile.am M configure.ac A proxy/Makefile.am A proxy/include/osmocom/proxy/logging.h A proxy/include/osmocom/proxy/proxy.h A proxy/include/osmocom/proxy/trx.h A proxy/include/osmocom/proxy/vty.h A proxy/src/Makefile.am A proxy/src/logging.c A proxy/src/main.c A proxy/src/proxy.c A proxy/src/trx.c A proxy/src/vty.c 14 files changed, 871 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/03/43603/6 -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43603?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Id2b12e5e7d053eea53338fbabc48131b9c46c82a Gerrit-Change-Number: 43603 Gerrit-PatchSet: 6 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-trx[master]: Transceiver52M: check rc of osmo_trxc_msg_params_scan()
by fixeria 19 Sep '26

19 Sep '26
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-trx/+/43682?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: Transceiver52M: check rc of osmo_trxc_msg_params_scan() ...................................................................... Transceiver52M: check rc of osmo_trxc_msg_params_scan() Change-Id: Ibb029e04816209423569037890fe85dcf174bd7b Fixes: CID#564238 --- M Transceiver52M/Transceiver.cpp 1 file changed, 17 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/82/43682/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43682?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ibb029e04816209423569037890fe85dcf174bd7b Gerrit-Change-Number: 43682 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder
1 0
0 0
[L] Change in osmo-trx[master]: proxy: add TDMA clock generator and basic TRXC handler
by fixeria 19 Sep '26

19 Sep '26
Attention is currently required from: fixeria. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-trx/+/43604?usp=email to look at the new patch set (#6). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/04/43604/6 -- 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: newpatchset 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: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-trx[master]: proxy: implement burst forwarding (proxying) logic
by fixeria 19 Sep '26

19 Sep '26
Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-trx/+/43605?usp=email to look at the new patch set (#6). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/05/43605/6 -- 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: newpatchset 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
0 0
  • ← Newer
  • 1
  • ...
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • ...
  • 190
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.