From: Stefano Brivio <sbrivio@redhat.com>
To: Anshu Kumari <anskuma@redhat.com>
Cc: passt-dev@passt.top, david@gibson.dropbear.id.au, lvivier@redhat.com
Subject: Re: [PATCH v2] tcp: Handle errors from tcp_send_flag()
Date: Sat, 25 Apr 2026 09:42:12 +0200 (CEST) [thread overview]
Message-ID: <20260425094211.0bdead04@elisabeth> (raw)
In-Reply-To: <20260423062314.905614-1-anskuma@redhat.com>
On Thu, 23 Apr 2026 11:53:14 +0530
Anshu Kumari <anskuma@redhat.com> wrote:
> tcp_send_flag() can fail in two different ways:
> - tcp_prepare_flags() returns -ECONNRESET when getsockopt(TCP_INFO)
> fails: the socket is broken and the connection must be reset.
> - tcp_vu_send_flag() returns -EAGAIN when vu_collect() finds no
> available vhost-user buffers: this is a transient condition
> equivalent to a dropped packet on the wire.
>
> Have tcp_vu_send_flag() return -EAGAIN instead of a bare -1 for the
> buffer-unavailable case. Absorb -EAGAIN in the tcp_send_flag()
> dispatcher so that callers only see fatal errors.
>
> Check the return value at each call site and handle fatal errors:
> - in tcp_data_from_tap(), return -1 so the caller resets
> - in tcp_tap_handler(), goto reset
> - in tcp_timer_handler()/tcp_sock_handler()/tcp_conn_from_sock_finish(),
> call tcp_rst() and return
> - in tcp_tap_conn_from_sock(), set CLOSING flag, call
> FLOW_ACTIVATE() to avoid leaving the flow in TYPED state, and
> return
> - in tcp_connect_finish(), call tcp_rst() and return
> - in tcp_keepalive(), call tcp_rst() and continue the loop
> - in tcp_flow_migrate_target_ext(), goto fail
>
> The call in tcp_rst_do() is left unchecked: we are already
> resetting, and tcp_sock_rst() still needs to run regardless.
>
> Link: https://bugs.passt.top/show_bug.cgi?id=194
> Signed-off-by: Anshu Kumari <anskuma@redhat.com>
> ---
> v2:
> - updated commit message.
> - update tcp_vu_send_flag() to return -EAGAIN instead of -1 for
> buffer-unavailable case.
> - in tcp_tap_conn_from_sock(), added FLOW_ACTIVATE call.
> - inside tcp_send_flag(), updated the return statement. function will
> return 0 incase of -EAGAIN error.
Applied, thanks for the detailed change log!
Just one detail: this had two trivial conflicts with commit
831857e9b547 ("tcp: Replace send buffer boost with EPOLLOUT monitoring")
which I merged earlier this week (my Monday):
$ git show -s --format=%cd 831857e9b547
Mon Apr 20 23:20:41 2026 +0200
I solved those on merge, and I usually do that if the resolution is
obvious, but in general you should 'git pull --rebase' or similar
(depending on how / whether you use branches) just before submitting
patches, so that conflicts are less likely to happen.
They might still happen if there are other pending patches that are
then merged at the same time but that's unavoidable (and in general
I'll just solve conflicts in that case because that's usually my
fault for reviewing or merging things too late / slowly).
--
Stefano
prev parent reply other threads:[~2026-04-25 7:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 6:23 Anshu Kumari
2026-04-25 7:42 ` Stefano Brivio [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260425094211.0bdead04@elisabeth \
--to=sbrivio@redhat.com \
--cc=anskuma@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).