jolly has uploaded this change for review.

View Change

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

To view, visit change 34034. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I2c544594eb187110861ab2564323654a2dc6e85a
Gerrit-Change-Number: 34034
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas@eversberg.eu>
Gerrit-MessageType: newchange