This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12589 Change subject: trxcon: make trxcon_fsm parent for both l1ctl_fsm and trx_fsm ...................................................................... trxcon: make trxcon_fsm parent for both l1ctl_fsm and trx_fsm Change-Id: I6262726f2b6e23abe543d6d67edfd634eece1b71 --- M src/host/trxcon/l1ctl_link.c M src/host/trxcon/l1ctl_link.h M src/host/trxcon/trx_if.c M src/host/trxcon/trx_if.h M src/host/trxcon/trxcon.c 5 files changed, 22 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/89/12589/1 diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index 897259a..f384753 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -177,7 +177,8 @@ } osmo_fsm_inst_state_chg(l1l->fsm, L1CTL_STATE_CONNECTED, 0, 0); - osmo_fsm_inst_dispatch(trxcon_fsm, TRXCON_E_L1CTL_CONNECT, NULL); + osmo_fsm_inst_dispatch(l1l->fsm->proc.parent, + TRXCON_E_L1CTL_CONNECT, NULL); LOGP(DL1C, LOGL_NOTICE, "L1CTL has a new connection\n"); @@ -224,12 +225,14 @@ osmo_wqueue_clear(&l1l->wq); osmo_fsm_inst_state_chg(l1l->fsm, L1CTL_STATE_IDLE, 0, 0); - osmo_fsm_inst_dispatch(trxcon_fsm, TRXCON_E_L1CTL_DISCONNECT, NULL); + osmo_fsm_inst_dispatch(l1l->fsm->proc.parent, + TRXCON_E_L1CTL_DISCONNECT, NULL); return 0; } -struct l1ctl_link *l1ctl_link_init(void *tall_ctx, const char *sock_path) +struct l1ctl_link *l1ctl_link_init(struct osmo_fsm_inst *parent_fi, + const char *sock_path) { struct l1ctl_link *l1l; struct osmo_fd *bfd; @@ -237,15 +240,15 @@ LOGP(DL1C, LOGL_NOTICE, "Init L1CTL link (%s)\n", sock_path); - l1l = talloc_zero(tall_ctx, struct l1ctl_link); + l1l = talloc_zero(parent_fi, struct l1ctl_link); if (!l1l) { LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n"); return NULL; } /* Allocate a new dedicated state machine */ - l1l->fsm = osmo_fsm_inst_alloc(&l1ctl_fsm, l1l, - NULL, LOGL_DEBUG, "l1ctl_link"); + l1l->fsm = osmo_fsm_inst_alloc_child(&l1ctl_fsm, + parent_fi, TRXCON_E_L1CTL_DISCONNECT); if (l1l->fsm == NULL) { LOGP(DTRX, LOGL_ERROR, "Failed to allocate an instance " "of FSM '%s'\n", l1ctl_fsm.name); diff --git a/src/host/trxcon/l1ctl_link.h b/src/host/trxcon/l1ctl_link.h index da64419..ceeaa30 100644 --- a/src/host/trxcon/l1ctl_link.h +++ b/src/host/trxcon/l1ctl_link.h @@ -41,7 +41,8 @@ void (*shutdown_cb)(struct l1ctl_link *l1l); }; -struct l1ctl_link *l1ctl_link_init(void *tall_ctx, const char *sock_path); +struct l1ctl_link *l1ctl_link_init(struct osmo_fsm_inst *parent_fi, + const char *sock_path); void l1ctl_link_shutdown(struct l1ctl_link *l1l); int l1ctl_link_send(struct l1ctl_link *l1l, struct msgb *msg); diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c index f2db145..7eca984 100644 --- a/src/host/trxcon/trx_if.c +++ b/src/host/trxcon/trx_if.c @@ -173,7 +173,8 @@ if (++tcm->retry_cnt > 3) { LOGP(DTRX, LOGL_NOTICE, "Transceiver offline\n"); osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_OFFLINE, 0, 0); - osmo_fsm_inst_dispatch(trxcon_fsm, TRXCON_E_TRX_DISCONNECT, NULL); + osmo_fsm_inst_dispatch(trx->fsm->proc.parent, + TRXCON_E_TRX_DISCONNECT, NULL); return; } @@ -514,7 +515,8 @@ rsp_error: /* Notify higher layers about the problem */ - osmo_fsm_inst_dispatch(trxcon_fsm, TRXCON_E_TRX_CTRL_ERROR, NULL); + osmo_fsm_inst_dispatch(trx->fsm->proc.parent, + TRXCON_E_TRX_CTRL_ERROR, NULL); return -EIO; } @@ -627,7 +629,7 @@ } /* Init TRX interface (TRXC, TRXD sockets and FSM) */ -struct trx_instance *trx_if_open(void *tall_ctx, +struct trx_instance *trx_if_open(struct osmo_fsm_inst *parent_fi, const char *local_host, const char *remote_host, uint16_t port) { struct trx_instance *trx; @@ -636,15 +638,15 @@ LOGP(DTRX, LOGL_NOTICE, "Init transceiver interface\n"); /* Try to allocate memory */ - trx = talloc_zero(tall_ctx, struct trx_instance); + trx = talloc_zero(parent_fi, struct trx_instance); if (!trx) { LOGP(DTRX, LOGL_ERROR, "Failed to allocate memory\n"); return NULL; } /* Allocate a new dedicated state machine */ - trx->fsm = osmo_fsm_inst_alloc(&trx_fsm, trx, - NULL, LOGL_DEBUG, "trx_interface"); + trx->fsm = osmo_fsm_inst_alloc_child(&trx_fsm, + parent_fi, TRXCON_E_TRX_DISCONNECT); if (trx->fsm == NULL) { LOGP(DTRX, LOGL_ERROR, "Failed to allocate an instance " "of FSM '%s'\n", trx_fsm.name); diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h index 0b3f36f..8180669 100644 --- a/src/host/trxcon/trx_if.h +++ b/src/host/trxcon/trx_if.h @@ -52,7 +52,7 @@ int cmd_len; }; -struct trx_instance *trx_if_open(void *tall_ctx, +struct trx_instance *trx_if_open(struct osmo_fsm_inst *parent_fi, const char *local_host, const char *remote_host, uint16_t port); void trx_if_flush_ctrl(struct trx_instance *trx); void trx_if_close(struct trx_instance *trx); diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c index dda0a00..ab753d0 100644 --- a/src/host/trxcon/trxcon.c +++ b/src/host/trxcon/trxcon.c @@ -214,12 +214,12 @@ goto exit; /* Init L1CTL server */ - app_data.l1l = l1ctl_link_init(tall_trxcon_ctx, app_data.bind_socket); + app_data.l1l = l1ctl_link_init(trxcon_fsm, app_data.bind_socket); if (app_data.l1l == NULL) goto exit; /* Init transceiver interface */ - app_data.trx = trx_if_open(tall_trxcon_ctx, + app_data.trx = trx_if_open(trxcon_fsm, app_data.trx_bind_ip, app_data.trx_remote_ip, app_data.trx_base_port); if (!app_data.trx) -- To view, visit https://gerrit.osmocom.org/12589 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I6262726f2b6e23abe543d6d67edfd634eece1b71 Gerrit-Change-Number: 12589 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190116/306ac9c3/attachment.htm>