From 3bd97d839e59a18b2638ff3ac76f5bc3dc3d22d5 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 25 Oct 2023 14:28:38 +0200 Subject: Revert "trx_if: Allow calling trx_if_flush/close from within TRXC callback" This reverts commit 4444262a6ab1e1e231ea81c4ec990f1a1f571a1f. This commit introduced several side effects: - tcm is left out of the l1h->trx_ctrl_list and hence won't be ever retransmitted. - Since tcm is removed before rsp callback, the llist may become empty and if somehwere in the rsp callback a new message is enqueud it will be sent immediatelly, and will be retransmitted again when trx_ctrl_read_cb() calls trx_ctrl_send() at the end. Change-Id: Ideb2d08ac8a2902bceeabfb055c59c9a13dbe3c0 Related: OS#6020 --- src/osmo-bts-trx/trx_if.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index fef8c22f..3f9fc049 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -721,13 +721,6 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what) rsp.cb = tcm->cb; - /* Remove command from list, save it to last_acked and remove previous - * last_acked. Do it before calling callback to avoid user freeing tcm - * pointer if flushing/closing the iface. */ - llist_del(&tcm->list); - talloc_free(l1h->last_acked); - l1h->last_acked = tcm; - /* check for response code */ rc = trx_ctrl_rx_rsp(l1h, &rsp, tcm); if (rc == -EINVAL) @@ -735,11 +728,15 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what) /* re-schedule last cmd in rc seconds time */ if (rc > 0) { - if (!llist_empty(&l1h->trx_ctrl_list)) - osmo_timer_schedule(&l1h->trx_ctrl_timer, rc, 0); + osmo_timer_schedule(&l1h->trx_ctrl_timer, rc, 0); return 0; } + /* remove command from list, save it to last_acked and removed previous last_acked */ + llist_del(&tcm->list); + talloc_free(l1h->last_acked); + l1h->last_acked = tcm; + trx_ctrl_send(l1h); return 0; -- cgit v1.2.3-59-g8ed1b