netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] [resend] fix non-mergeable buffers packet too large error handling
@ 2010-05-18  3:12 Michael S. Tsirkin
  2010-05-18  4:14 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2010-05-18  3:12 UTC (permalink / raw)
  To: David L Stevens; +Cc: netdev, kvm, virtualization, davem

DaveM, just to clarify, this patch is on top of the series
we are working on with David L Stevens. It's not for your net tree.

-- 
MST

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [resend] fix non-mergeable buffers packet too large error handling
  2010-05-18  3:12 [PATCH] [resend] fix non-mergeable buffers packet too large error handling Michael S. Tsirkin
@ 2010-05-18  4:14 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-05-18  4:14 UTC (permalink / raw)
  To: mst; +Cc: dlstevens, netdev, kvm, virtualization

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Tue, 18 May 2010 06:12:52 +0300

> DaveM, just to clarify, this patch is on top of the series
> we are working on with David L Stevens. It's not for your net tree.

Understood.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [resend] fix non-mergeable buffers packet too large error handling
  2010-05-17 21:16 David L Stevens
@ 2010-05-18  1:53 ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2010-05-18  1:53 UTC (permalink / raw)
  To: David L Stevens; +Cc: netdev, kvm, virtualization

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);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] [resend] fix non-mergeable buffers packet too large error handling
@ 2010-05-17 21:16 David L Stevens
  2010-05-18  1:53 ` Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: David L Stevens @ 2010-05-17 21:16 UTC (permalink / raw)
  To: mst; +Cc: netdev, kvm, virtualization

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>

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);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-18  4:14 UTC | newest]

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

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).