fixeria submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve Hoernchen: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
trxcon: allow extending FBSB timeout (quirks for slow PHYs)

This is needed for SDR based PHYs, because for them it takes longer
to tune, flush the buffers and so on. Add a field to the trxcon_inst
structure and a command line option (-F) for the trxcon app.

Change-Id: Ia68954c5bdacda45fc871ffea0ccdf2460936408
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
M src/host/trxcon/src/trxcon_fsm.c
M src/host/trxcon/src/trxcon_inst.c
M src/host/trxcon/src/trxcon_main.c
4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index 9148771..15e63f7 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -32,6 +32,12 @@
uint8_t tx_power;
int8_t ta;
} l1p;
+
+ /* PHY specific quirks */
+ struct {
+ /* FBSB timeout extension (in TDMA FNs) */
+ unsigned int fbsb_extend_fns;
+ } phy_quirks;
};

enum trxcon_log_cat {
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index 10663b1..11b60ac 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -164,9 +164,11 @@
case TRXCON_EV_FBSB_SEARCH_REQ:
{
const struct trxcon_param_fbsb_search_req *req = data;
- unsigned long timeout_ms;
+ unsigned long timeout_fns, timeout_ms;

- timeout_ms = req->timeout_fns * GSM_TDMA_FN_DURATION_uS / 1000;
+ /* Some PHYs need additional time to tune (in TDMA FNs) */
+ timeout_fns = req->timeout_fns + trxcon->phy_quirks.fbsb_extend_fns;
+ timeout_ms = timeout_fns * GSM_TDMA_FN_DURATION_uS / 1000;
osmo_fsm_inst_state_chg_ms(fi, TRXCON_ST_FBSB_SEARCH, timeout_ms, 0);

l1sched_configure_ts(trxcon->sched, 0, req->pchan_config);
diff --git a/src/host/trxcon/src/trxcon_inst.c b/src/host/trxcon/src/trxcon_inst.c
index 7d3813e..da4d618 100644
--- a/src/host/trxcon/src/trxcon_inst.c
+++ b/src/host/trxcon/src/trxcon_inst.c
@@ -91,6 +91,8 @@
return NULL;
}

+ trxcon->phy_quirks.fbsb_extend_fns = 0;
+
return trxcon;
}

diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c
index 742246e..26a5742 100644
--- a/src/host/trxcon/src/trxcon_main.c
+++ b/src/host/trxcon/src/trxcon_main.c
@@ -67,6 +67,9 @@
uint16_t trx_base_port;
uint32_t trx_fn_advance;

+ /* PHY quirk: FBSB timeout extension (in TDMA FNs) */
+ unsigned int phyq_fbsb_extend_fns;
+
/* GSMTAP specific */
struct gsmtap_inst *gsmtap;
const char *gsmtap_ip;
@@ -77,6 +80,7 @@
.trx_bind_ip = "0.0.0.0",
.trx_base_port = 6700,
.trx_fn_advance = 3,
+ .phyq_fbsb_extend_fns = 0,
};

static void *tall_trxcon_ctx = NULL;
@@ -153,6 +157,7 @@
}

trxcon->gsmtap = app_data.gsmtap;
+ trxcon->phy_quirks.fbsb_extend_fns = app_data.phyq_fbsb_extend_fns;
}

static void l1ctl_conn_close_cb(struct l1ctl_client *l1c)
@@ -179,6 +184,7 @@
printf(" -i --trx-remote TRX remote IP address (default 127.0.0.1)\n");
printf(" -p --trx-port Base port of TRX instance (default 6700)\n");
printf(" -f --trx-advance Uplink burst scheduling advance (default 3)\n");
+ printf(" -F --fbsb-extend FBSB timeout extension (in TDMA FNs, default 0)\n");
printf(" -s --socket Listening socket for layer23 (default /tmp/osmocom_l2)\n");
printf(" -g --gsmtap-ip The destination IP used for GSMTAP (disabled by default)\n");
printf(" -C --max-clients Maximum number of L1CTL connections (default 1)\n");
@@ -201,13 +207,14 @@
{"trx-remote", 1, 0, 'i'},
{"trx-port", 1, 0, 'p'},
{"trx-advance", 1, 0, 'f'},
+ {"fbsb-extend", 1, 0, 'F'},
{"gsmtap-ip", 1, 0, 'g'},
{"max-clients", 1, 0, 'C'},
{"daemonize", 0, 0, 'D'},
{0, 0, 0, 0}
};

- c = getopt_long(argc, argv, "d:b:i:p:f:s:g:C:Dh",
+ c = getopt_long(argc, argv, "d:b:i:p:f:F:s:g:C:Dh",
long_options, &option_index);
if (c == -1)
break;
@@ -243,6 +250,13 @@
exit(EXIT_FAILURE);
}
break;
+ case 'F':
+ app_data.phyq_fbsb_extend_fns = strtoul(optarg, &endptr, 10);
+ if (errno || *endptr != '\0') {
+ fprintf(stderr, "Failed to parse -F/--fbsb-extend=%s\n", optarg);
+ exit(EXIT_FAILURE);
+ }
+ break;
case 's':
app_data.bind_socket = optarg;
break;

To view, visit change 30612. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ia68954c5bdacda45fc871ffea0ccdf2460936408
Gerrit-Change-Number: 30612
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged