From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Oleinik, Alexander" <alxndr@bu.edu>
Cc: Jason Wang <jasowang@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"bsd@redhat.com" <bsd@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/2] net: assert that tx packets have nonzero size
Date: Mon, 22 Jul 2019 08:17:06 +0100 [thread overview]
Message-ID: <20190722071706.GA22361@stefanha-x1.localdomain> (raw)
In-Reply-To: <20190719185158.20316-2-alxndr@bu.edu>
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
On Fri, Jul 19, 2019 at 06:52:24PM +0000, Oleinik, Alexander wrote:
> Virtual devices should not try to send zero-sized packets. The caller
> should check the size prior to calling qemu_sendv_packet_async.
>
> Signed-off-by: Alexander Oleinik <alxndr@bu.edu>
> ---
> net/net.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/net.c b/net/net.c
> index 7d4098254f..fad20bc611 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -741,6 +741,9 @@ ssize_t qemu_sendv_packet_async(NetClientState *sender,
> size_t size = iov_size(iov, iovcnt);
> int ret;
>
> + /* 0-sized packets are unsupported. Check size in the caller */
> + assert(size);
Please include the rationale:
A return value of 0 means the packet has been queued and will be sent
asynchronously. Therefore this function has no way of reporting that
a 0-sized packet has been sent successfully. Forbid it for now and if
someone needs this functionality then the API will require a change.
This way someone who hits this will understand why the assertion is
there.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-07-22 7:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 18:52 [Qemu-devel] [PATCH 0/2] Avoid sending zero-size packets Oleinik, Alexander
2019-07-19 18:52 ` [Qemu-devel] [PATCH 1/2] net: assert that tx packets have nonzero size Oleinik, Alexander
2019-07-22 7:17 ` Stefan Hajnoczi [this message]
2019-07-23 3:38 ` Jason Wang
2019-07-26 14:42 ` Oleinik, Alexander
2019-07-19 18:52 ` [Qemu-devel] [PATCH 2/2] virtio-net: check that tx packet has positive size Oleinik, Alexander
2019-07-22 7:22 ` Stefan Hajnoczi
2019-07-20 1:00 ` [Qemu-devel] [PATCH 0/2] Avoid sending zero-size packets no-reply
2019-07-22 10:47 ` Philippe Mathieu-Daudé
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=20190722071706.GA22361@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=jasowang@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.
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 NNTP newsgroup(s).