From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by dpdk.org (Postfix) with ESMTP id 200195A9C for ; Mon, 9 Mar 2015 03:23:25 +0100 (CET) Received: by padet14 with SMTP id et14so44867729pad.11 for ; Sun, 08 Mar 2015 19:23:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=oWMw/CFAs5qDDDsaVXW7OGNuqPu/VtObB64LCYLJuOM=; b=WPqnD6zvVg1guG512nvHYMYo28AVHNUdui0T1GS+gzIlmixXx6/ABMHyDJuS/lGc81 X8MuKEAzy/2tIFqyBaAy9PXBnSNWD1sTZs+NdeVT1+qBnzzZww6mTn5xDUF6JjElWgdw 0XpCayuLV/QgXa1sNbo9LCE+wlS4HlO6+/qu0IOvBOEg66/KtJeGK4ZD64TzwZQxq48o fmUaAKhljy252eMBoFC5ghoXK51SFF5WiY7vOyNGr0zPW6V7mvf5UA2aMYK1/zIoFIRu dbw+k7y7sTs12BAkNWLgLv1MVa3jH0Vxu5eN4ne5Nq7T9bW32HxrPKKpCKAHpUwlMXa8 qgCQ== X-Gm-Message-State: ALoCoQmCUm5Jg7WlUaIgg4fUojncuuLb/uMSyfCrX/oEVG4aab26ORHgJQYcbgWdluhOS/qOVIZs X-Received: by 10.70.88.41 with SMTP id bd9mr20761787pdb.41.1425867804502; Sun, 08 Mar 2015 19:23:24 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id ng17sm16201627pdb.91.2015.03.08.19.23.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Mar 2015 19:23:24 -0700 (PDT) Message-ID: <54FD041B.9000000@igel.co.jp> Date: Mon, 09 Mar 2015 11:23:23 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Huawei Xie , dev@dpdk.org References: <1425638358-26523-1-git-send-email-huawei.xie@intel.com> In-Reply-To: <1425638358-26523-1-git-send-email-huawei.xie@intel.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] lib/librte_vhost: exchange kickfd and callfd to avoid confusion 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: Mon, 09 Mar 2015 02:23:26 -0000 On 2015/03/06 19:39, Huawei Xie wrote: > Previous vhost implementation wrongly name kickfd as callfd and callfd as kickfd. > It is functional correct, but causes confusion. > > Signed-off-by: Huawei Xie > --- > examples/vhost/main.c | 6 +++--- > lib/librte_vhost/rte_virtio_net.h | 4 ++-- > lib/librte_vhost/vhost_rxtx.c | 6 +++--- > lib/librte_vhost/vhost_user/virtio-net-user.c | 12 ++++++------ > lib/librte_vhost/virtio-net.c | 12 ++++++------ > 5 files changed, 20 insertions(+), 20 deletions(-) > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index 334e2fe..61ea671 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -1434,7 +1434,7 @@ put_desc_to_used_list_zcp(struct vhost_virtqueue *vq, uint16_t desc_idx) > > /* Kick the guest if necessary. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > - eventfd_write((int)vq->kickfd, 1); > + eventfd_write((int)vq->callfd, 1); > } > > /* > @@ -1627,7 +1627,7 @@ txmbuf_clean_zcp(struct virtio_net *dev, struct vpool *vpool) > > /* Kick guest if required. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > - eventfd_write((int)vq->kickfd, 1); > + eventfd_write((int)vq->callfd, 1); > > return 0; > } > @@ -1775,7 +1775,7 @@ virtio_dev_rx_zcp(struct virtio_net *dev, struct rte_mbuf **pkts, > > /* Kick the guest if necessary. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > - eventfd_write((int)vq->kickfd, 1); > + eventfd_write((int)vq->callfd, 1); > > return count; > } > diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h > index 611a3d4..2fc1c44 100644 > --- a/lib/librte_vhost/rte_virtio_net.h > +++ b/lib/librte_vhost/rte_virtio_net.h > @@ -86,8 +86,8 @@ struct vhost_virtqueue { > uint16_t vhost_hlen; /**< Vhost header length (varies depending on RX merge buffers. */ > volatile uint16_t last_used_idx; /**< Last index used on the available ring */ > volatile uint16_t last_used_idx_res; /**< Used for multiple devices reserving buffers. */ > - eventfd_t callfd; /**< Currently unused as polling mode is enabled. */ > - eventfd_t kickfd; /**< Used to notify the guest (trigger interrupt). */ > + eventfd_t callfd; /**< Used to notify the guest (trigger interrupt). */ > + eventfd_t kickfd; /**< Currently unused as polling mode is enabled. */ > struct buf_vector buf_vec[BUF_VECTOR_MAX]; /**< for scatter RX. */ > } __rte_cache_aligned; > > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c > index c7c9550..535c7a1 100644 > --- a/lib/librte_vhost/vhost_rxtx.c > +++ b/lib/librte_vhost/vhost_rxtx.c > @@ -180,7 +180,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id, > > /* Kick the guest if necessary. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > - eventfd_write((int)vq->kickfd, 1); > + eventfd_write((int)vq->callfd, 1); > return count; > } > > @@ -507,7 +507,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, > > /* Kick the guest if necessary. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > - eventfd_write((int)vq->kickfd, 1); > + eventfd_write((int)vq->callfd, 1); > } > > return count; > @@ -725,6 +725,6 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, > vq->used->idx += entry_success; > /* Kick guest if required. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > - eventfd_write((int)vq->kickfd, 1); > + eventfd_write((int)vq->callfd, 1); > return entry_success; > } > diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c > index 97c5177..e0c7394 100644 > --- a/lib/librte_vhost/vhost_user/virtio-net-user.c > +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c > @@ -286,13 +286,13 @@ user_get_vring_base(struct vhost_device_ctx ctx, > * sent and only sent in vhost_vring_stop. > * TODO: cleanup the vring, it isn't usable since here. > */ > - if (((int)dev->virtqueue[VIRTIO_RXQ]->callfd) >= 0) { > - close(dev->virtqueue[VIRTIO_RXQ]->callfd); > - dev->virtqueue[VIRTIO_RXQ]->callfd = (eventfd_t)-1; > + if (((int)dev->virtqueue[VIRTIO_RXQ]->kickfd) >= 0) { > + close(dev->virtqueue[VIRTIO_RXQ]->kickfd); > + dev->virtqueue[VIRTIO_RXQ]->kickfd = (eventfd_t)-1; > } > - if (((int)dev->virtqueue[VIRTIO_TXQ]->callfd) >= 0) { > - close(dev->virtqueue[VIRTIO_TXQ]->callfd); > - dev->virtqueue[VIRTIO_TXQ]->callfd = (eventfd_t)-1; > + if (((int)dev->virtqueue[VIRTIO_TXQ]->kickfd) >= 0) { > + close(dev->virtqueue[VIRTIO_TXQ]->kickfd); > + dev->virtqueue[VIRTIO_TXQ]->kickfd = (eventfd_t)-1; > } > > return 0; > diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c > index 20567ff..6917fcf 100644 > --- a/lib/librte_vhost/virtio-net.c > +++ b/lib/librte_vhost/virtio-net.c > @@ -595,10 +595,10 @@ set_vring_call(struct vhost_device_ctx ctx, struct vhost_vring_file *file) > /* file->index refers to the queue index. The txq is 1, rxq is 0. */ > vq = dev->virtqueue[file->index]; > > - if ((int)vq->kickfd >= 0) > - close((int)vq->kickfd); > + if ((int)vq->callfd >= 0) > + close((int)vq->callfd); > > - vq->kickfd = file->fd; > + vq->callfd = file->fd; > > return 0; > } > @@ -621,10 +621,10 @@ set_vring_kick(struct vhost_device_ctx ctx, struct vhost_vring_file *file) > /* file->index refers to the queue index. The txq is 1, rxq is 0. */ > vq = dev->virtqueue[file->index]; > > - if ((int)vq->callfd >= 0) > - close((int)vq->callfd); > + if ((int)vq->kickfd >= 0) > + close((int)vq->kickfd); > > - vq->callfd = file->fd; > + vq->kickfd = file->fd; > > return 0; > } Acked-by: Tetsuya Mukawa