netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Shirley Ma <mashirle@us.ibm.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, jasowang@redhat.com
Subject: Re: [PATCH net-next]vhost: fix condition check for # of outstanding dma buffers
Date: Tue, 19 Jul 2011 22:09:45 +0300	[thread overview]
Message-ID: <20110719190945.GB8667@redhat.com> (raw)
In-Reply-To: <1311100678.8573.16.camel@localhost.localdomain>

On Tue, Jul 19, 2011 at 11:37:58AM -0700, Shirley Ma wrote:
> Signed-off-by: Shirley Ma <xma@us.ibm.com>
> ---
> 
>  drivers/vhost/net.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 70ac604..83cb738 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -189,8 +189,10 @@ static void handle_tx(struct vhost_net *net)
>  				break;
>  			}
>  			/* If more outstanding DMAs, queue the work */
> -			if (unlikely(vq->upend_idx - vq->done_idx >
> -				     VHOST_MAX_PEND)) {
> +			if (unlikely((vq->upend_idx - vq->done_idx >
> +					VHOST_MAX_PEND) ||
> +				     (vq->upend_idx - vq->done_idx >
> +					 VHOST_MAX_PEND - UIO_MAXIOV))) {

Could you please explain why this makes sense please?
VHOST_MAX_PEND is 128 UIO_MAXIOV is 1024 so
the result is negative?

I thought upend_idx - done_idx is exactly the number
of buffers, so once we get too many we stop until
one gets freed?


>  				tx_poll_start(net, sock);
>  				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
>  				break;
> 

  reply	other threads:[~2011-07-19 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19 18:37 [PATCH net-next]vhost: fix condition check for # of outstanding dma buffers Shirley Ma
2011-07-19 19:09 ` Michael S. Tsirkin [this message]
2011-07-19 20:56   ` Shirley Ma
2011-07-20 10:28     ` Michael S. Tsirkin
2011-07-20 15:43       ` Shirley Ma
2011-07-20 16:17         ` Michael S. Tsirkin
2011-07-20 16:49           ` Shirley Ma

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=20110719190945.GB8667@redhat.com \
    --to=mst@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=mashirle@us.ibm.com \
    --cc=netdev@vger.kernel.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).