diff options
| -rw-r--r-- | drivers/vhost/net.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 8e9dc554b1ef..831eb4fd197d 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -363,6 +363,13 @@ static void handle_tx(struct vhost_net *net) | |||
| 363 | if (zcopy) | 363 | if (zcopy) |
| 364 | vhost_zerocopy_signal_used(net, vq); | 364 | vhost_zerocopy_signal_used(net, vq); |
| 365 | 365 | ||
| 366 | /* If more outstanding DMAs, queue the work. | ||
| 367 | * Handle upend_idx wrap around | ||
| 368 | */ | ||
| 369 | if (unlikely((nvq->upend_idx + vq->num - VHOST_MAX_PEND) | ||
| 370 | % UIO_MAXIOV == nvq->done_idx)) | ||
| 371 | break; | ||
| 372 | |||
| 366 | head = vhost_get_vq_desc(&net->dev, vq, vq->iov, | 373 | head = vhost_get_vq_desc(&net->dev, vq, vq->iov, |
| 367 | ARRAY_SIZE(vq->iov), | 374 | ARRAY_SIZE(vq->iov), |
| 368 | &out, &in, | 375 | &out, &in, |
| @@ -372,17 +379,6 @@ static void handle_tx(struct vhost_net *net) | |||
| 372 | break; | 379 | break; |
| 373 | /* Nothing new? Wait for eventfd to tell us they refilled. */ | 380 | /* Nothing new? Wait for eventfd to tell us they refilled. */ |
| 374 | if (head == vq->num) { | 381 | if (head == vq->num) { |
| 375 | int num_pends; | ||
| 376 | |||
| 377 | /* If more outstanding DMAs, queue the work. | ||
| 378 | * Handle upend_idx wrap around | ||
| 379 | */ | ||
| 380 | num_pends = likely(nvq->upend_idx >= nvq->done_idx) ? | ||
| 381 | (nvq->upend_idx - nvq->done_idx) : | ||
| 382 | (nvq->upend_idx + UIO_MAXIOV - | ||
| 383 | nvq->done_idx); | ||
| 384 | if (unlikely(num_pends > VHOST_MAX_PEND)) | ||
| 385 | break; | ||
| 386 | if (unlikely(vhost_enable_notify(&net->dev, vq))) { | 382 | if (unlikely(vhost_enable_notify(&net->dev, vq))) { |
| 387 | vhost_disable_notify(&net->dev, vq); | 383 | vhost_disable_notify(&net->dev, vq); |
| 388 | continue; | 384 | continue; |
