input/ipaccess: Don't start zero-ms timer on every write

Historically, before November 15, 2010 when commit
d49fc5ae24fc9d44d2b284392ab619cc7a69a876 was merged to [back then]
OpenBSC, before libosmo-abis became a separate library, we used to
have a 10us delay timer for subsequent writes to ip.access nanoBTS 900.

    ts: Reduce the delay to 0 for OML and RSL

    This is possible after not sending more than one OML command that
    requires an extra ACK. For the RSL line we do not need any speed
    limitation.

Ever since the above-mentioned commit, the BSC always sets that timeout
to zero, which makes libosmo-abis start a zero-microsecond libosmocore timer,
which in turn will make libosmocore call select/poll with zero timeout, which
makes the kernel return immediately.

Why not remove the timer completely? Because ipaccess-config.c still specifies
a non-zero signaling delay, and we cannot be sure that this is really not
needed.

So let's alter the code to only start the timer if it's non-zero

Change-Id: I9c379364e7e6afce35fc6316392b5b33748980f7
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 9659b36..b995fde 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -494,12 +494,12 @@
 	int ret;
 
 	e1i_ts = ipaccess_line_ts(bfd, line);
-	osmo_fd_write_disable(bfd);
 
 	/* get the next msg for this timeslot */
 	msg = e1inp_tx_ts(e1i_ts, &sign_link);
 	if (!msg) {
 		/* no message after tx delay timer */
+		osmo_fd_write_disable(bfd);
 		return 0;
 	}
 
@@ -527,11 +527,15 @@
 		goto err;
 	}
 
-	/* set tx delay timer for next event */
-	osmo_timer_setup(&e1i_ts->sign.tx_timer, timeout_ts1_write, e1i_ts);
-
-	/* Reducing this might break the nanoBTS 900 init. */
-	osmo_timer_schedule(&e1i_ts->sign.tx_timer, 0, e1i_ts->sign.delay);
+	/* this is some ancient code that apparently exists to slow down writes towards
+	 * some even more ancient nanoBTS 900 units. See git commit
+	 * d49fc5ae24fc9d44d2b284392ab619cc7a69a876 of openbsc.git (now osmo-bsc.git) */
+	if (e1i_ts->sign.delay) {
+		osmo_fd_write_disable(bfd);
+		/* set tx delay timer for next event */
+		osmo_timer_setup(&e1i_ts->sign.tx_timer, timeout_ts1_write, e1i_ts);
+		osmo_timer_schedule(&e1i_ts->sign.tx_timer, 0, e1i_ts->sign.delay);
+	}
 
 out:
 	msgb_free(msg);