diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2017-12-08 18:34:52 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-12-10 14:05:57 +0000 |
commit | 4b4c2ec4b324b94b0a4f6b4c36a68bfc60bfce3d (patch) | |
tree | 14948935df8ea1fa24fb054869a74b6fa830ce9e | |
parent | 62b575db671f2ae1856a058611f1b1304e5cad68 (diff) |
bts-trx: Avoid enqueueing consecutive duplicate messages to TRX
While debugging other protocol/timing issues between osmobts-trx and osmo-trx,
I found that sometimes two consecutives "POWER OFF" commands are
enqueued and sent to osmo-trx.
There's no point in doing so, as the write queue already maintains state
and retries the command until a RSP is received, then goes for the next
one.
With this change we hence improve timing response as we don't need to
wait for the second command to be processed, and on top we get cleaner
logs and simplified states which are easier to debug.
Change-Id: Ib6a5e7bfac8bc5e1b372da6a1f801c07a3d5ebb7
-rw-r--r-- | src/osmo-bts-trx/trx_if.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 1ac21d59..57fd953a 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -214,8 +214,13 @@ static int trx_ctrl_cmd(struct trx_l1h *l1h, int critical, const char *cmd, tcm->cmd[sizeof(tcm->cmd)-1] = '\0'; tcm->cmd_len = strlen(cmd); tcm->critical = critical; - llist_add_tail(&tcm->list, &l1h->trx_ctrl_list); - LOGP(DTRX, LOGL_INFO, "Enqueuing TRX control command '%s'\n", tcm->cmd); + + /* Avoid adding consecutive duplicate messages, eg: two consecutive POWEROFF */ + if (!pending || + strcmp(tcm->cmd, llist_entry(l1h->trx_ctrl_list.prev, struct trx_ctrl_msg, list)->cmd)) { + LOGP(DTRX, LOGL_INFO, "Enqueuing TRX control command '%s'\n", tcm->cmd); + llist_add_tail(&tcm->list, &l1h->trx_ctrl_list); + } /* send message, if we didn't already have pending messages */ if (!pending) |