diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-02-21 15:16:40 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-02-21 15:16:40 +0100 |
commit | e943638a926a09e82fb56e18a1ca8ec14f2e1681 (patch) | |
tree | 183345ecb7707cba9338ce229457db891ab0c075 /src | |
parent | 0c1881a417651385664dfceac8511be38bf2cb87 (diff) |
sercomm_cons: Utilize msgb's better, don't always end at \n
In the sercomm_cons layer, ee used to enqueue a msgb for sending
every time there is an end-of-line. However, if we send a number
of very short lines, we easily run out of msgbs.
Now we check how much msgb backlog there is in the transmit queue,
and decide to skip the end-of-line flushing if needed.
This still doesn't solve all our problems, but its still a useful
mechanism.
Diffstat (limited to 'src')
-rw-r--r-- | src/target/firmware/comm/sercomm_cons.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/target/firmware/comm/sercomm_cons.c b/src/target/firmware/comm/sercomm_cons.c index fa08b50e..5b481bcb 100644 --- a/src/target/firmware/comm/sercomm_cons.c +++ b/src/target/firmware/comm/sercomm_cons.c @@ -91,8 +91,11 @@ int sercomm_puts(const char *s) { unsigned int i; for (i = 0; i < write_num; i++) { - /* flush buffer at end of line */ - if (*s == '\n') + /* flush buffer at end of line, but skip + * flushing if we have a backlog in order to + * increase efficiency of msgb filling */ + if (*s == '\n' && + sercomm_tx_queue_depth(SC_DLCI_CONSOLE) < 4) flush = 1; *data++ = *s++; } |