fixeria has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/28668 )
Change subject: trxcon: move FBSB state from struct l1ctl_link to trxcon_inst
......................................................................
trxcon: move FBSB state from struct l1ctl_link to trxcon_inst
Ideally, FBSB procedure should be implemented as a state of trxcon's
FSM. For now let's simply move the related fields to trxcon_inst.
Remove l1ctl_shutdown_cb() as it's not needed anymore.
Change-Id: I92b50cf1bb36886fbe3d6460af3c0b1c57256ae8
---
M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl_link.h
M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
M src/host/trxcon/src/l1ctl.c
M src/host/trxcon/src/l1ctl_link.c
M src/host/trxcon/src/trxcon.c
6 files changed, 17 insertions(+), 31 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
index 6fac3a0..4d1670e 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
@@ -8,7 +8,6 @@
/* Event handlers */
int l1ctl_rx_cb(struct l1ctl_link *l1l, struct msgb *msg);
-void l1ctl_shutdown_cb(struct l1ctl_link *l1l);
int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result,
const struct l1ctl_info_dl *dl_info, uint8_t bsic);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl_link.h
b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl_link.h
index 5cfcc10..84a8638 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl_link.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl_link.h
@@ -29,13 +29,6 @@
/* Some private data */
void *priv;
-
- /* L1CTL handlers specific */
- struct osmo_timer_list fbsb_timer;
- bool fbsb_conf_sent;
-
- /* Shutdown callback */
- void (*shutdown_cb)(struct l1ctl_link *l1l);
};
struct l1ctl_link *l1ctl_link_init(void *tall_ctx, const char *sock_path);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index 6cec162..986f423 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -29,6 +29,10 @@
/* L1/L2 interfaces */
struct trx_instance *trx;
struct l1ctl_link *l1l;
+
+ /* TODO: implement this as an FSM state with timeout */
+ struct osmo_timer_list fbsb_timer;
+ bool fbsb_conf_sent;
};
struct trxcon_inst *trxcon_inst_alloc(void *ctx);
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 3cf06e1..9d762d3 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -167,6 +167,7 @@
int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result,
const struct l1ctl_info_dl *dl_info, uint8_t bsic)
{
+ struct trxcon_inst *trxcon = l1l->priv;
struct l1ctl_fbsb_conf *conf;
struct msgb *msg;
@@ -182,11 +183,11 @@
conf->initial_freq_err = 0;
/* Ask SCH handler not to send L1CTL_FBSB_CONF anymore */
- l1l->fbsb_conf_sent = true;
+ trxcon->fbsb_conf_sent = true;
/* Abort FBSB expire timer */
- if (osmo_timer_pending(&l1l->fbsb_timer))
- osmo_timer_del(&l1l->fbsb_timer);
+ if (osmo_timer_pending(&trxcon->fbsb_timer))
+ osmo_timer_del(&trxcon->fbsb_timer);
return l1ctl_link_send(l1l, msg);
}
@@ -316,7 +317,7 @@
fbsb_conf_make(msg, 255, 0);
/* Ask SCH handler not to send L1CTL_FBSB_CONF anymore */
- l1l->fbsb_conf_sent = true;
+ trxcon->fbsb_conf_sent = true;
l1ctl_link_send(l1l, msg);
}
@@ -353,7 +354,7 @@
l1sched_configure_ts(trxcon->sched, 0, ch_config);
/* Ask SCH handler to send L1CTL_FBSB_CONF */
- l1l->fbsb_conf_sent = false;
+ trxcon->fbsb_conf_sent = false;
/* Only if current ARFCN differs */
if (trxcon->trx->band_arfcn != band_arfcn) {
@@ -371,10 +372,10 @@
trx_if_cmd_poweron(trxcon->trx);
/* Start FBSB expire timer */
- l1l->fbsb_timer.data = l1l;
- l1l->fbsb_timer.cb = fbsb_timer_cb;
+ trxcon->fbsb_timer.data = l1l;
+ trxcon->fbsb_timer.cb = fbsb_timer_cb;
LOGP(DL1C, LOGL_INFO, "Starting FBSB timer %u ms\n", timeout *
GSM_TDMA_FN_DURATION_uS / 1000);
- osmo_timer_schedule(&l1l->fbsb_timer, 0,
+ osmo_timer_schedule(&trxcon->fbsb_timer, 0,
timeout * GSM_TDMA_FN_DURATION_uS);
exit:
@@ -902,10 +903,3 @@
return -EINVAL;
}
}
-
-void l1ctl_shutdown_cb(struct l1ctl_link *l1l)
-{
- /* Abort FBSB expire timer */
- if (osmo_timer_pending(&l1l->fbsb_timer))
- osmo_timer_del(&l1l->fbsb_timer);
-}
diff --git a/src/host/trxcon/src/l1ctl_link.c b/src/host/trxcon/src/l1ctl_link.c
index 294ed6f..672991c 100644
--- a/src/host/trxcon/src/l1ctl_link.c
+++ b/src/host/trxcon/src/l1ctl_link.c
@@ -265,9 +265,6 @@
return NULL;
}
- /* Bind shutdown handler */
- l1l->shutdown_cb = l1ctl_shutdown_cb;
-
/**
* To be able to accept first connection and
* drop others, it should be set to -1
@@ -287,10 +284,6 @@
LOGP(DL1C, LOGL_NOTICE, "Shutdown L1CTL link\n");
- /* Call shutdown callback */
- if (l1l->shutdown_cb != NULL)
- l1l->shutdown_cb(l1l);
-
listen_bfd = &l1l->listen_bfd;
/* Check if we have an established connection */
diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c
index 4f7dd32..179594c 100644
--- a/src/host/trxcon/src/trxcon.c
+++ b/src/host/trxcon/src/trxcon.c
@@ -164,7 +164,7 @@
break;
case L1SCHED_DT_OTHER:
if (lchan->type == L1SCHED_SCH) {
- if (trxcon->l1l->fbsb_conf_sent)
+ if (trxcon->fbsb_conf_sent)
return 0;
rc = l1ctl_tx_fbsb_conf(trxcon->l1l, 0, &dl_hdr, sched->bsic);
break;
@@ -371,6 +371,9 @@
if (trxcon->trx != NULL)
trx_if_close(trxcon->trx);
+ if (osmo_timer_pending(&trxcon->fbsb_timer))
+ osmo_timer_del(&trxcon->fbsb_timer);
+
if (trxcon->fi != NULL)
osmo_fsm_inst_free(trxcon->fi);
talloc_free(trxcon);
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/28668
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I92b50cf1bb36886fbe3d6460af3c0b1c57256ae8
Gerrit-Change-Number: 28668
Gerrit-PatchSet: 5
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: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged