On 2019/7/17 下午7:58, huhai wrote:
When get_tx_bufs get descriptor successful, but this descriptor have
some problem, we should inform the guest to recycle this descriptor,
instead of doing nothing.
Signed-off-by: huhai <huhai@xxxxxxxxxx>
---
drivers/vhost/net.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 247e5585af5d..939a2ef9c223 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -620,6 +620,7 @@ static int get_tx_bufs(struct vhost_net *net,
if (*in) {
vq_err(vq, "Unexpected descriptor format for TX: out %d, int %d\n",
*out, *in);
+ vhost_add_used_and_signal(&net->dev, vq, ret, 0);
return -EFAULT;
}
@@ -628,6 +629,7 @@ static int get_tx_bufs(struct vhost_net *net,
if (*len == 0) {
vq_err(vq, "Unexpected header len for TX: %zd expected %zd\n",
*len, nvq->vhost_hlen);
+ vhost_add_used_and_signal(&net->dev, vq, ret, 0);
return -EFAULT;
}
This is usually a hint of driver bug. I believe it's better to fail
explicitly here instead of trying to workaround it.
Thanks