All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David L Stevens <dlstevens@us.ibm.com>
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.osdl.org
Subject: Re: [PATCH] [resend] fix non-mergeable buffers packet too large error handling
Date: Tue, 18 May 2010 04:53:34 +0300	[thread overview]
Message-ID: <20100518015334.GA22478@redhat.com> (raw)
In-Reply-To: <1274130996.8492.7.camel@w-dls.beaverton.ibm.com>

On Mon, May 17, 2010 at 02:16:36PM -0700, David L Stevens wrote:
> This patch enforces single-buffer allocation when
> mergeable rx buffers is not enabled.
> 
> Reported-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: David L Stevens <dlstevens@us.ibm.com>

Thanks! Why are you resending?

> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 309c570..c346304 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -361,13 +361,21 @@ static void handle_rx(struct vhost_net *net)
>  			break;
>  		}
>  		/* TODO: Should check and handle checksum. */
> -		if (vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF) &&
> -		    memcpy_toiovecend(vq->hdr, (unsigned char *)&headcount,
> -				      offsetof(typeof(hdr), num_buffers),
> -				      sizeof hdr.num_buffers)) {
> -			vq_err(vq, "Failed num_buffers write");
> +		if (vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF)) {
> +			if (memcpy_toiovecend(vq->hdr,
> +					      (unsigned char *)&headcount,
> +					      offsetof(typeof(hdr),
> +					      num_buffers),
> +					      sizeof hdr.num_buffers)) {
> +				vq_err(vq, "Failed num_buffers write");
> +				vhost_discard_desc(vq, headcount);
> +				break;
> +			}
> +		} else if (headcount > 1) {
> +			vq_err(vq, "rx packet too large (%d) for guest",
> +			       sock_len);
>  			vhost_discard_desc(vq, headcount);
> -			break;
> +			continue;
>  		}
>  		vhost_add_used_and_signal_n(&net->dev, vq, vq->heads,
>  					    headcount);
> 

  reply	other threads:[~2010-05-18  1:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 21:16 [PATCH] [resend] fix non-mergeable buffers packet too large error handling David L Stevens
2010-05-18  1:53 ` Michael S. Tsirkin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-05-18  3:12 Michael S. Tsirkin
2010-05-18  4:14 ` David Miller

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=20100518015334.GA22478@redhat.com \
    --to=mst@redhat.com \
    --cc=dlstevens@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.