From: Anthony Liguori <anthony@codemonkey.ws>
To: Mark McLoughlin <markmc@redhat.com>
Cc: Avi Kivity <avi@redhat.com>,
kvm@vger.kernel.org, Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH 2/3] kvm: qemu: handle link status in qemu_sendv_packet()
Date: Tue, 09 Dec 2008 08:57:33 -0600 [thread overview]
Message-ID: <493E875D.3010803@codemonkey.ws> (raw)
In-Reply-To: <1228821613-28724-3-git-send-email-markmc@redhat.com>
Mark McLoughlin wrote:
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> ---
> qemu/net.c | 18 +++++++++++++++++-
> 1 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/qemu/net.c b/qemu/net.c
> index 16a0990..f23a17f 100644
> --- a/qemu/net.c
> +++ b/qemu/net.c
> @@ -400,6 +400,17 @@ static ssize_t vc_sendv_compat(VLANClientState *vc, const struct iovec *iov,
> return offset;
> }
>
> +static ssize_t calc_iov_length(const struct iovec *iov, int iovcnt)
> +{
> + size_t offset = 0;
> + int i;
> +
> + for (i = 0; i < iovcnt; i++)
> + offset += iov[i].iov_len;
> +
> + return offset;
> +}
> +
> ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov,
> int iovcnt)
> {
> @@ -407,13 +418,18 @@ ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov,
> VLANClientState *vc;
> ssize_t max_len = 0;
>
> + if (vc1->link_down)
> + return calc_iov_length(iov, iovcnt);
> +
> for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
> ssize_t len = 0;
>
> if (vc == vc1)
> continue;
>
> - if (vc->fd_readv)
> + if (vc->link_down)
> + len = calc_iov_length(iov, iovcnt);
>
Instead of returning a success and silently dropping the packet, maybe
it would be better to return an error and let the card deal with
dropping the packet.
In real hardware, the link down would mean the TX queue would fill up
because packets aren't able to be sent.
Regards,
Anthony Liguori
> + else if (vc->fd_readv)
> len = vc->fd_readv(vc->opaque, iov, iovcnt);
> else if (vc->fd_read)
> len = vc_sendv_compat(vc, iov, iovcnt);
>
next prev parent reply other threads:[~2008-12-09 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 11:20 [PATCH 0/3] Implement link status for virtio_net Mark McLoughlin
2008-12-09 11:20 ` [PATCH 1/3] kvm: qemu: fix qemu_send_packet Mark McLoughlin
2008-12-09 11:20 ` [PATCH 2/3] kvm: qemu: handle link status in qemu_sendv_packet() Mark McLoughlin
2008-12-09 11:20 ` [PATCH 3/3] kvm: qemu: virtio-net: implement link status Mark McLoughlin
2008-12-09 14:57 ` Anthony Liguori [this message]
2009-01-08 18:37 ` [PATCH 2/3] kvm: qemu: handle link status in qemu_sendv_packet() Mark McLoughlin
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=493E875D.3010803@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=markmc@redhat.com \
--cc=rusty@rustcorp.com.au \
/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).