From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by dpdk.org (Postfix) with ESMTP id A5C41591E for ; Thu, 19 Nov 2015 07:23:39 +0100 (CET) Received: by padhx2 with SMTP id hx2so70612003pad.1 for ; Wed, 18 Nov 2015 22:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=0fHr4WenuJOv4USbv9hXoJ1g98SQY6bvMb9h+zaV3XM=; b=x9zM43llpUEltnLMIFOeJoX8PJ80kE5tOU+kIaeFiOc7r6bZpl/SvTG9P9bPWBR8x+ Imo99HOKanHOj6K5qJfDMSntvQAu7jkVvYRJY84VVr4vPNWDzTsA/KPCxMqnJCF73/oA tC7EdDIq5Z+ZCO74suTmhWXvwlTvrXKp2dxJxBts6rjNODDksVdSPaygofWqOwipBd5Q EwOrMWoc1Cn1XBhor4DQs440QWsC9G1AesUa0YMcni46ip1MZfFKPf2x/B4V4qYbREIV VLR25r1ipSYiLPagUnjwBAazKt2vFYzaqeykc1aaZusI2kgfAGSkk47LlByk0lolE6+t vHqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0fHr4WenuJOv4USbv9hXoJ1g98SQY6bvMb9h+zaV3XM=; b=aHih1szKyEBB6FSMgaU//ahzl7hDZm07wtxoFDB3pLca5YLYrrWKe8K1mveY3OYInM 1JYsMXX2tncsHMdXSulPjK23tv87ce6SViPf/ROR5gleyZr9f/OGdi6W2qpyFHe8hDRj fV23Y/WVwnwKHIdq+Dyi/rsVKJK2q0QaSU1wyNMjIlXVb3vcJLlljXCiiMj2nPjb0R49 nAxu8cQYABLr+6pnJi/+rS35IPvcZPD7SYwiKvNKqx1lsz7OEJ5BBHcZL1c31ErvkNCS 52i93TfDreu1WPQAIVR3GqAPvKWQ4x5QNMBbJmLF7PflF0ggmtqEsk1C2glvoL1Y0h0K HT2Q== X-Gm-Message-State: ALoCoQlyNhmtDADrSBs1v/ZcC95jSpToW+l6rRHpO+gsslAaf0go70GT9o6jleBIEB0+JXs5Pp+a X-Received: by 10.68.234.166 with SMTP id uf6mr8094478pbc.126.1447914219079; Wed, 18 Nov 2015 22:23:39 -0800 (PST) Received: from eris.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id ju7sm7896253pbc.83.2015.11.18.22.23.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Nov 2015 22:23:38 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org, yuanhan.liu@linux.intel.com Date: Thu, 19 Nov 2015 15:23:26 +0900 Message-Id: <1447914206-18369-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 Cc: ann.zhuangyanying@huawei.com Subject: [dpdk-dev] [PATCH] vhost: Fix reset_owner message handling not to clear callfd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2015 06:23:40 -0000 The patch fixes reset_owner message handling not to clear callfd, because callfd will be valid while connection is establihed. Signed-off-by: Tetsuya Mukawa --- lib/librte_vhost/virtio-net.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index 886c104..ae1e4bd 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -322,6 +322,25 @@ init_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx) init_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx); } +static void +reset_vring_queue(struct vhost_virtqueue *vq, int qp_idx) +{ + int callfd; + + callfd = vq->callfd; + init_vring_queue(vq, qp_idx); + vq->callfd = callfd; +} + +static void +reset_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx) +{ + uint32_t base_idx = qp_idx * VIRTIO_QNUM; + + reset_vring_queue(dev->virtqueue[base_idx + VIRTIO_RXQ], qp_idx); + reset_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx); +} + static int alloc_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx) { @@ -362,7 +381,7 @@ reset_device(struct virtio_net *dev) dev->flags = 0; for (i = 0; i < dev->virt_qp_nb; i++) - init_vring_queue_pair(dev, i); + reset_vring_queue_pair(dev, i); } /* -- 2.1.4