jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/34034 )
Change subject: dahdi: Disable OSMO_FD_WRITE if HDLC/RAW write queue is empty ......................................................................
dahdi: Disable OSMO_FD_WRITE if HDLC/RAW write queue is empty
Not doing so will cause 100% CPU usage, because the write functions are constantly called if their queue is empty.
Change-Id: I2c544594eb187110861ab2564323654a2dc6e85a --- M src/input/dahdi.c 1 file changed, 18 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/34/34034/1
diff --git a/src/input/dahdi.c b/src/input/dahdi.c index acf1f94..b4e6657 100644 --- a/src/input/dahdi.c +++ b/src/input/dahdi.c @@ -277,8 +277,10 @@
/* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, NULL); - if (!msg) + if (!msg) { + osmo_fd_write_disable(bfd); return; + }
if (msgb_tailroom(msg) >= 2) { /* two bytes of space for the FCS added by DAHDI in the kernel */ @@ -402,8 +404,10 @@
/* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, NULL); - if (!msg) + if (!msg) { + osmo_fd_write_disable(bfd); return 0; + }
if (msg->len != D_BCHAN_TX_GRAN) { /* This might lead to a transmit underrun, as we call tx