fixeria has uploaded this change for review.

View Change

proxy: implement TRXC SETFORMAT

Change-Id: I9c453e7ba2a799a8c4ce037afef14037b596a29d
Related: OS#6672
---
M proxy/src/ctrl_cmd.c
1 file changed, 29 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/10/43610/1
diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c
index ca6ac7b..bf49ce3 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,32 @@
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));
+ rsp->status = -1;
+ 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 +367,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 change 43610. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I9c453e7ba2a799a8c4ce037afef14037b596a29d
Gerrit-Change-Number: 43610
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>