Review at https://gerrit.osmocom.org/6790
host/trxcon/scheduler: process frames in advance In order to get the transceiver more time to process bursts, the L1 scheduler should process the frames and send the bursts in advance (a few frames before), like OsmoBTS does. By default, the advance value is 20 frames, but this can be adjusted using a new command line option of trxcon '-f'. Change-Id: Ic258a169f3554f931d6277e18ca060d029b77f32 --- M src/host/trxcon/sched_trx.c M src/host/trxcon/sched_trx.h M src/host/trxcon/scheduler.h M src/host/trxcon/trxcon.c 4 files changed, 23 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/90/6790/1 diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index b7ebfeb..02da241 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -75,8 +75,14 @@ if (llist_empty(&ts->tx_prims)) continue; + /** + * Advance frame number, giving the transceiver more + * time until a burst must be transmitted... + */ + fn = (sched->fn_counter_proc + sched->fn_counter_advance) + % GSM_HYPERFRAME; + /* Get frame from multiframe */ - fn = sched->fn_counter_proc; offset = fn % ts->mf_layout->period; frame = ts->mf_layout->frames + offset; @@ -103,7 +109,7 @@ } } -int sched_trx_init(struct trx_instance *trx) +int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance) { struct trx_sched *sched; @@ -122,6 +128,9 @@ sched = &trx->sched; sched->data = trx; + /* Set frame counter advance */ + sched->fn_counter_advance = fn_advance; + return 0; } diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index 9d038fb..e1ef924 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -246,7 +246,7 @@ enum gsm_phys_chan_config config, int tn); /* Scheduler management functions */ -int sched_trx_init(struct trx_instance *trx); +int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance); int sched_trx_reset(struct trx_instance *trx, int reset_clock); int sched_trx_shutdown(struct trx_instance *trx); diff --git a/src/host/trxcon/scheduler.h b/src/host/trxcon/scheduler.h index b025d91..f36c3b2 100644 --- a/src/host/trxcon/scheduler.h +++ b/src/host/trxcon/scheduler.h @@ -24,6 +24,8 @@ struct timeval clock; /*! \brief Count of processed frames */ uint32_t fn_counter_proc; + /*! \brief Local frame counter advance */ + uint32_t fn_counter_advance; /*! \brief Frame counter */ uint32_t fn_counter_lost; /*! \brief Frame callback timer */ diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c index 4a571b9..07ab169 100644 --- a/src/host/trxcon/trxcon.c +++ b/src/host/trxcon/trxcon.c @@ -69,6 +69,7 @@ struct trx_instance *trx; const char *trx_ip; uint16_t trx_base_port; + uint32_t trx_fn_advance; } app_data; void *tall_trx_ctx = NULL; @@ -143,6 +144,7 @@ printf(" -d --debug Change debug flags. Default: %s\n", DEBUG_DEFAULT); printf(" -i --trx-ip IP address of host runing TRX (default 127.0.0.1)\n"); printf(" -p --trx-port Base port of TRX instance (default 5700)\n"); + printf(" -f --trx-advance Scheduler clock advance (default 20)\n"); printf(" -s --socket Listening socket for layer23 (default /tmp/osmocom_l2)\n"); printf(" -D --daemonize Run as daemon\n"); } @@ -157,11 +159,12 @@ {"socket", 1, 0, 's'}, {"trx-ip", 1, 0, 'i'}, {"trx-port", 1, 0, 'p'}, + {"trx-advance", 1, 0, 'f'}, {"daemonize", 0, 0, 'D'}, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "d:i:p:s:Dh", + c = getopt_long(argc, argv, "d:i:p:f:s:Dh", long_options, &option_index); if (c == -1) break; @@ -181,6 +184,9 @@ case 'p': app_data.trx_base_port = atoi(optarg); break; + case 'f': + app_data.trx_fn_advance = atoi(optarg); + break; case 's': app_data.bind_socket = optarg; break; @@ -198,6 +204,7 @@ app_data.bind_socket = "/tmp/osmocom_l2"; app_data.trx_ip = "127.0.0.1"; app_data.trx_base_port = 5700; + app_data.trx_fn_advance = 20; app_data.debug_mask = NULL; app_data.daemonize = 0; @@ -263,7 +270,7 @@ app_data.trx->l1l = app_data.l1l; /* Init scheduler */ - rc = sched_trx_init(app_data.trx); + rc = sched_trx_init(app_data.trx, app_data.trx_fn_advance); if (rc) goto exit; -- To view, visit https://gerrit.osmocom.org/6790 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic258a169f3554f931d6277e18ca060d029b77f32 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>