tools: kwboot: Do not call tcdrain() after each sent packet
authorPali Rohár <pali@kernel.org>
Wed, 27 Oct 2021 18:56:59 +0000 (20:56 +0200)
committerStefan Roese <sr@denx.de>
Wed, 3 Nov 2021 05:45:27 +0000 (06:45 +0100)
commitcab817d260341244f011f7a0c490df51b33c05aa
tree5156b6634928bf31cf0484ea5ddfe5363a44c1c9
parent455c0d22fb084550ecc6aaf810a9c7b684b2dee0
tools: kwboot: Do not call tcdrain() after each sent packet

Kwboot puts each xmodem packet to kernel queue, then waits until all bytes
of that packet are transmitted over UART and then waits for xmodem reply
until it is received into kernel queue.

If some reply is received during the time we are waiting until all bytes
are transmitted, then kernel puts them into the queue and returns it to
kwboot in next read() call.

So there is no need to wait (with tcdrain() function) until all bytes from
xmodem packet are transmitted over UART, since any reply received either
during that time or after is returned to kwboot with the next read().

Therefore do not call tcdrain() after each xmodem packet sent. Instead
directly wait for any reply after putting xmodem packet into write kernel
queue.

This change could speed up xmodem transfer in case tcdrain() function waits
for a longer time.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c