fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/30612 )


Change subject: trxcon: allow advancing FBSB timeout (quirks for slow PHYs)
......................................................................

trxcon: allow advancing 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/12/30612/1

diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h 
b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index 9148771..10527e3 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 advance (in TDMA FNs) */
+               unsigned int fbsb_advance_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 7c0057a..ea7471b 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -159,9 +159,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_advance_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..e967cd8 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_advance_fns = 0;
+
        return trxcon;
 }

diff --git a/src/host/trxcon/src/trxcon_main.c 
b/src/host/trxcon/src/trxcon_main.c
index 95e5549..0f9e616 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 advance (in TDMA FNs) */
+       int phyq_fbsb_advance_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_advance_fns = 0,
 };

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

        trxcon->gsmtap = app_data.gsmtap;
+       trxcon->phy_quirks.fbsb_advance_fns = app_data.phyq_fbsb_advance_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-advance FBSB timeout advance (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");
@@ -200,13 +206,14 @@
                        {"trx-remote", 1, 0, 'i'},
                        {"trx-port", 1, 0, 'p'},
                        {"trx-advance", 1, 0, 'f'},
+                       {"fbsb-advance", 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;
@@ -232,6 +239,13 @@
                case 'f':
                        app_data.trx_fn_advance = atoi(optarg);
                        break;
+               case 'F':
+                       app_data.phyq_fbsb_advance_fns = atoi(optarg);
+                       if (app_data.phyq_fbsb_advance_fns < 0) {
+                               fprintf(stderr, "Error: FBSB advance shall be a 
positive value\n");
+                               exit(1);
+                       }
+                       break;
                case 's':
                        app_data.bind_socket = optarg;
                        break;

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30612
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ia68954c5bdacda45fc871ffea0ccdf2460936408
Gerrit-Change-Number: 30612
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to