Re: [PATCH] tools: usb: p9_fwd: Send complete requests to the TCP server
From: Michael Grzeschik
Date: Fri Nov 20 2026 - 04:48:26 EST
On Fri, Nov 20, 2026 at 02:19:37PM +0800, Zhu Jun wrote:
> socket.send() can return after sending only a prefix of a request.
> The forwarder ignores that result and waits for a response to an
> incomplete message. Use sendall() so request forwarding completes
> only once all bytes have been sent or a write error is reported.
>
> Fixes: 673f0c3ffc75 ("tools: usb: p9_fwd: add usb gadget packet forwarder script")
> Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
Acked-by: Michael Grzeschik <mgr@xxxxxxxxxx>
> ---
> tools/usb/p9_fwd.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/usb/p9_fwd.py b/tools/usb/p9_fwd.py
> index 12c76cbb046b..d5ffb2f0c5ab 100755
> --- a/tools/usb/p9_fwd.py
> +++ b/tools/usb/p9_fwd.py
> @@ -124,7 +124,7 @@ class Forwarder:
> data += self.ep_in.read(size - len(data))
> logging.log(logging.TRACE, "c2s: writing")
> self._log_hexdump(data)
> - self.s.send(data)
> + self.s.sendall(data)
> logging.debug("c2s: forwarded %i bytes", size)
> self.stats["c2s packets"] += 1
> self.stats["c2s bytes"] += size
>
>