Message ID | 1457590462-3680-1-git-send-email-mukawa@igel.co.jp (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 3694A2934; Thu, 10 Mar 2016 07:14:34 +0100 (CET) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id 0BDF72931 for <dev@dpdk.org>; Thu, 10 Mar 2016 07:14:33 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id fe3so43280426pab.1 for <dev@dpdk.org>; Wed, 09 Mar 2016 22:14:32 -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=UIwVKsc/9kM7kjhfcxYvrlJD0xdxjAjXZFr3iEQXxoc=; b=A80RfKJZ+1F6bWe3k6yZtpQ7bBOA5dTECcdLf92/ugGFNhuYQN2RNON3bDAWB7GFeb WsGJCZ1LFNFUVJFba6wuw0MpxAkxmaS/+xAi4pBpqOfmCOIr9pnOzAKyuAwgRbLL6Fpu 3Fk57vg1ZnxGfPFlpqxDfj4l1NlUhaIWy+1Yimyqnn2HZEZ8EMTxf5IjrgMVhOV0+Lcq goGg0Faw4iKZXye8gA2P0nsdFBRE1UBVIv6sFJuspizQIajJO1taIa3f0SfnQNE3hc+v K7Ogn3EY5jPTU29iNyLgizF8dcqsmTDbv44H7b5mEQ62ONkY0t2juYbSja5bQ061uX7m 65cQ== 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=UIwVKsc/9kM7kjhfcxYvrlJD0xdxjAjXZFr3iEQXxoc=; b=XeGPshY+TMn2CWqQiI2ECfoUo7OFHpROREQQ125XjfqXaBjJl0yzjm/yfeXK8BGmuR eCRtGM6ffB3h9ozB0sIuMqZSy5F9NhD6+vA7x84g8OS2G/Or5cGO47XZc99BvqtB+iMV w+YJigG1zuF2IHqaVcfzBprHZTFnOSQfnKWIXn0NEqtw8Dl5b/8kjtKezrvrLeFIp5LL iU7T4uftHuKTe190APaNpZGrL2FpHZWPZyh8kixZF2BfRLB2KmKGX373YHrVLNvenan6 eNJk5wRakt/CPzX0bB3baNRMTDDXT4YVfhXTBkyL7ojzYDy3uVbMLiDDSQyeg2Vf2DXg Ok0w== X-Gm-Message-State: AD7BkJIe693r2wJfGUcGrKNduhOITG2XAYQABdKKI+TRJ/uccMj4oOrtReWb0OVzVk36Pg== X-Received: by 10.66.249.41 with SMTP id yr9mr2545643pac.86.1457590472307; Wed, 09 Mar 2016 22:14:32 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id yh5sm2409546pab.13.2016.03.09.22.14.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Mar 2016 22:14:31 -0800 (PST) From: Tetsuya Mukawa <mukawa@igel.co.jp> To: dev@dpdk.org Date: Thu, 10 Mar 2016 15:14:22 +0900 Message-Id: <1457590462-3680-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] vhost: Fix default value of kickfd and callfd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Tetsuya Mukawa
March 10, 2016, 6:14 a.m. UTC
Currently, default value of kickfd and callfd is -1.
If the value is -1, current code guess kickfd and callfd hasn't been
initialized yet. And vhost library will guess the virtqueue isn't ready
for processing.
But callfd and kickfd will be set as -1 when "--enable-kvm"
isn't specified in QEMU command line. It means we cannot treat -1 as
uninitialized state. The patch changes default value to -2. And the
patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD.
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
lib/librte_vhost/rte_virtio_net.h | 1 +
lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ++++---
lib/librte_vhost/virtio-net.c | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
Comments
On 3/10/2016 2:14 PM, Tetsuya Mukawa wrote: > Currently, default value of kickfd and callfd is -1. > If the value is -1, current code guess kickfd and callfd hasn't been > initialized yet. And vhost library will guess the virtqueue isn't ready > for processing. > But callfd and kickfd will be set as -1 when "--enable-kvm" > isn't specified in QEMU command line. It means we cannot treat -1 as > uninitialized state. The patch changes default value to -2. And the > patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD. > > Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> > --- > lib/librte_vhost/rte_virtio_net.h | 1 + > lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ++++--- > lib/librte_vhost/virtio-net.c | 4 ++-- > 3 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h > index 7d1fde2..d745707 100644 > --- a/lib/librte_vhost/rte_virtio_net.h > +++ b/lib/librte_vhost/rte_virtio_net.h > @@ -89,6 +89,7 @@ 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. */ > +#define VIRTIO_UNINITIALIZED_EVENTFD (-2) > int callfd; /**< Used to notify the guest (trigger interrupt). */ > int kickfd; /**< Currently unused as polling mode is enabled. */ > int enabled; > diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c > index 65b5652..591f9bf 100644 > --- a/lib/librte_vhost/vhost_user/virtio-net-user.c > +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c > @@ -225,8 +225,8 @@ static int > vq_is_ready(struct vhost_virtqueue *vq) > { > return vq && vq->desc && > - vq->kickfd != -1 && > - vq->callfd != -1; > + vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD && > + vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD; > } > > static int > @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx, > */ > if (dev->virtqueue[state->index]->kickfd >= 0) { > close(dev->virtqueue[state->index]->kickfd); Then -1 will be a valid value, need to check if it's not -1 to close()? Nevertheless, close(-1) brings no big problem. Thanks, Jianfeng > - dev->virtqueue[state->index]->kickfd = -1; > + dev->virtqueue[state->index]->kickfd = > + VIRTIO_UNINITIALIZED_EVENTFD; > } > > return 0; > diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c > index fe1a77e..3498e9d 100644 > --- a/lib/librte_vhost/virtio-net.c > +++ b/lib/librte_vhost/virtio-net.c > @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int qp_idx) > { > memset(vq, 0, sizeof(struct vhost_virtqueue)); > > - vq->kickfd = -1; > - vq->callfd = -1; > + vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; > + vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; > > /* Backends are set to -1 indicating an inactive device. */ > vq->backend = -1;
On 2016/03/10 15:25, Tan, Jianfeng wrote: > > > On 3/10/2016 2:14 PM, Tetsuya Mukawa wrote: >> Currently, default value of kickfd and callfd is -1. >> If the value is -1, current code guess kickfd and callfd hasn't been >> initialized yet. And vhost library will guess the virtqueue isn't ready >> for processing. >> But callfd and kickfd will be set as -1 when "--enable-kvm" >> isn't specified in QEMU command line. It means we cannot treat -1 as >> uninitialized state. The patch changes default value to -2. And the >> patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD. >> >> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> >> --- >> lib/librte_vhost/rte_virtio_net.h | 1 + >> lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ++++--- >> lib/librte_vhost/virtio-net.c | 4 ++-- >> 3 files changed, 7 insertions(+), 5 deletions(-) >> >> diff --git a/lib/librte_vhost/rte_virtio_net.h >> b/lib/librte_vhost/rte_virtio_net.h >> index 7d1fde2..d745707 100644 >> --- a/lib/librte_vhost/rte_virtio_net.h >> +++ b/lib/librte_vhost/rte_virtio_net.h >> @@ -89,6 +89,7 @@ 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. */ >> +#define VIRTIO_UNINITIALIZED_EVENTFD (-2) >> int callfd; /**< Used to notify the guest >> (trigger interrupt). */ >> int kickfd; /**< Currently unused as >> polling mode is enabled. */ >> int enabled; >> diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c >> b/lib/librte_vhost/vhost_user/virtio-net-user.c >> index 65b5652..591f9bf 100644 >> --- a/lib/librte_vhost/vhost_user/virtio-net-user.c >> +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c >> @@ -225,8 +225,8 @@ static int >> vq_is_ready(struct vhost_virtqueue *vq) >> { >> return vq && vq->desc && >> - vq->kickfd != -1 && >> - vq->callfd != -1; >> + vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD && >> + vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD; >> } >> static int >> @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx, >> */ >> if (dev->virtqueue[state->index]->kickfd >= 0) { >> close(dev->virtqueue[state->index]->kickfd); > > Then -1 will be a valid value, need to check if it's not -1 to > close()? Nevertheless, close(-1) brings no big problem. > We did it in above 'if' condition checking, then close(-1) will not be called. Thanks, Tetsuya > Thanks, > Jianfeng > >> - dev->virtqueue[state->index]->kickfd = -1; >> + dev->virtqueue[state->index]->kickfd = >> + VIRTIO_UNINITIALIZED_EVENTFD; >> } >> return 0; >> diff --git a/lib/librte_vhost/virtio-net.c >> b/lib/librte_vhost/virtio-net.c >> index fe1a77e..3498e9d 100644 >> --- a/lib/librte_vhost/virtio-net.c >> +++ b/lib/librte_vhost/virtio-net.c >> @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int >> qp_idx) >> { >> memset(vq, 0, sizeof(struct vhost_virtqueue)); >> - vq->kickfd = -1; >> - vq->callfd = -1; >> + vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; >> + vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; >> /* Backends are set to -1 indicating an inactive device. */ >> vq->backend = -1; >
On 3/10/2016 2:34 PM, Tetsuya Mukawa wrote: > On 2016/03/10 15:25, Tan, Jianfeng wrote: >> >> On 3/10/2016 2:14 PM, Tetsuya Mukawa wrote: >>> Currently, default value of kickfd and callfd is -1. >>> If the value is -1, current code guess kickfd and callfd hasn't been >>> initialized yet. And vhost library will guess the virtqueue isn't ready >>> for processing. >>> But callfd and kickfd will be set as -1 when "--enable-kvm" >>> isn't specified in QEMU command line. It means we cannot treat -1 as >>> uninitialized state. The patch changes default value to -2. And the >>> patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD. >>> >>> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> >>> --- >>> lib/librte_vhost/rte_virtio_net.h | 1 + >>> lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ++++--- >>> lib/librte_vhost/virtio-net.c | 4 ++-- >>> 3 files changed, 7 insertions(+), 5 deletions(-) >>> >>> diff --git a/lib/librte_vhost/rte_virtio_net.h >>> b/lib/librte_vhost/rte_virtio_net.h >>> index 7d1fde2..d745707 100644 >>> --- a/lib/librte_vhost/rte_virtio_net.h >>> +++ b/lib/librte_vhost/rte_virtio_net.h >>> @@ -89,6 +89,7 @@ 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. */ >>> +#define VIRTIO_UNINITIALIZED_EVENTFD (-2) >>> int callfd; /**< Used to notify the guest >>> (trigger interrupt). */ >>> int kickfd; /**< Currently unused as >>> polling mode is enabled. */ >>> int enabled; >>> diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c >>> b/lib/librte_vhost/vhost_user/virtio-net-user.c >>> index 65b5652..591f9bf 100644 >>> --- a/lib/librte_vhost/vhost_user/virtio-net-user.c >>> +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c >>> @@ -225,8 +225,8 @@ static int >>> vq_is_ready(struct vhost_virtqueue *vq) >>> { >>> return vq && vq->desc && >>> - vq->kickfd != -1 && >>> - vq->callfd != -1; >>> + vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD && >>> + vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD; >>> } >>> static int >>> @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx, >>> */ >>> if (dev->virtqueue[state->index]->kickfd >= 0) { >>> close(dev->virtqueue[state->index]->kickfd); >> Then -1 will be a valid value, need to check if it's not -1 to >> close()? Nevertheless, close(-1) brings no big problem. >> > We did it in above 'if' condition checking, then close(-1) will not be > called. Sorry, missed that. So when kickfd == -1, need to be set to VIRTIO_UNINITIALIZED_EVENTFD? Thanks, Jianfeng > > Thanks, > Tetsuya > >> Thanks, >> Jianfeng >> >>> - dev->virtqueue[state->index]->kickfd = -1; >>> + dev->virtqueue[state->index]->kickfd = >>> + VIRTIO_UNINITIALIZED_EVENTFD; >>> } >>> return 0; >>> diff --git a/lib/librte_vhost/virtio-net.c >>> b/lib/librte_vhost/virtio-net.c >>> index fe1a77e..3498e9d 100644 >>> --- a/lib/librte_vhost/virtio-net.c >>> +++ b/lib/librte_vhost/virtio-net.c >>> @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int >>> qp_idx) >>> { >>> memset(vq, 0, sizeof(struct vhost_virtqueue)); >>> - vq->kickfd = -1; >>> - vq->callfd = -1; >>> + vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; >>> + vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; >>> /* Backends are set to -1 indicating an inactive device. */ >>> vq->backend = -1;
On 2016/03/10 15:39, Tan, Jianfeng wrote: > > On 3/10/2016 2:34 PM, Tetsuya Mukawa wrote: >> On 2016/03/10 15:25, Tan, Jianfeng wrote: >>> >>> On 3/10/2016 2:14 PM, Tetsuya Mukawa wrote: >>>> Currently, default value of kickfd and callfd is -1. >>>> If the value is -1, current code guess kickfd and callfd hasn't been >>>> initialized yet. And vhost library will guess the virtqueue isn't >>>> ready >>>> for processing. >>>> But callfd and kickfd will be set as -1 when "--enable-kvm" >>>> isn't specified in QEMU command line. It means we cannot treat -1 as >>>> uninitialized state. The patch changes default value to -2. And the >>>> patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD. >>>> >>>> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> >>>> --- >>>> lib/librte_vhost/rte_virtio_net.h | 1 + >>>> lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ++++--- >>>> lib/librte_vhost/virtio-net.c | 4 ++-- >>>> 3 files changed, 7 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/lib/librte_vhost/rte_virtio_net.h >>>> b/lib/librte_vhost/rte_virtio_net.h >>>> index 7d1fde2..d745707 100644 >>>> --- a/lib/librte_vhost/rte_virtio_net.h >>>> +++ b/lib/librte_vhost/rte_virtio_net.h >>>> @@ -89,6 +89,7 @@ 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. */ >>>> +#define VIRTIO_UNINITIALIZED_EVENTFD (-2) >>>> int callfd; /**< Used to notify the guest >>>> (trigger interrupt). */ >>>> int kickfd; /**< Currently unused as >>>> polling mode is enabled. */ >>>> int enabled; >>>> diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c >>>> b/lib/librte_vhost/vhost_user/virtio-net-user.c >>>> index 65b5652..591f9bf 100644 >>>> --- a/lib/librte_vhost/vhost_user/virtio-net-user.c >>>> +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c >>>> @@ -225,8 +225,8 @@ static int >>>> vq_is_ready(struct vhost_virtqueue *vq) >>>> { >>>> return vq && vq->desc && >>>> - vq->kickfd != -1 && >>>> - vq->callfd != -1; >>>> + vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD && >>>> + vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD; >>>> } >>>> static int >>>> @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx, >>>> */ >>>> if (dev->virtqueue[state->index]->kickfd >= 0) { >>>> close(dev->virtqueue[state->index]->kickfd); >>> Then -1 will be a valid value, need to check if it's not -1 to >>> close()? Nevertheless, close(-1) brings no big problem. >>> >> We did it in above 'if' condition checking, then close(-1) will not be >> called. > > Sorry, missed that. So when kickfd == -1, need to be set to > VIRTIO_UNINITIALIZED_EVENTFD? > Aha, I've got it. Will change it. Thanks, Tetsuya > Thanks, > Jianfeng > >> >> Thanks, >> Tetsuya >> >>> Thanks, >>> Jianfeng >>> >>>> - dev->virtqueue[state->index]->kickfd = -1; >>>> + dev->virtqueue[state->index]->kickfd = >>>> + VIRTIO_UNINITIALIZED_EVENTFD; >>>> } >>>> return 0; >>>> diff --git a/lib/librte_vhost/virtio-net.c >>>> b/lib/librte_vhost/virtio-net.c >>>> index fe1a77e..3498e9d 100644 >>>> --- a/lib/librte_vhost/virtio-net.c >>>> +++ b/lib/librte_vhost/virtio-net.c >>>> @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int >>>> qp_idx) >>>> { >>>> memset(vq, 0, sizeof(struct vhost_virtqueue)); >>>> - vq->kickfd = -1; >>>> - vq->callfd = -1; >>>> + vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; >>>> + vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; >>>> /* Backends are set to -1 indicating an inactive device. */ >>>> vq->backend = -1; >
diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h index 7d1fde2..d745707 100644 --- a/lib/librte_vhost/rte_virtio_net.h +++ b/lib/librte_vhost/rte_virtio_net.h @@ -89,6 +89,7 @@ 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. */ +#define VIRTIO_UNINITIALIZED_EVENTFD (-2) int callfd; /**< Used to notify the guest (trigger interrupt). */ int kickfd; /**< Currently unused as polling mode is enabled. */ int enabled; diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c index 65b5652..591f9bf 100644 --- a/lib/librte_vhost/vhost_user/virtio-net-user.c +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c @@ -225,8 +225,8 @@ static int vq_is_ready(struct vhost_virtqueue *vq) { return vq && vq->desc && - vq->kickfd != -1 && - vq->callfd != -1; + vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD && + vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD; } static int @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx, */ if (dev->virtqueue[state->index]->kickfd >= 0) { close(dev->virtqueue[state->index]->kickfd); - dev->virtqueue[state->index]->kickfd = -1; + dev->virtqueue[state->index]->kickfd = + VIRTIO_UNINITIALIZED_EVENTFD; } return 0; diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index fe1a77e..3498e9d 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int qp_idx) { memset(vq, 0, sizeof(struct vhost_virtqueue)); - vq->kickfd = -1; - vq->callfd = -1; + vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; + vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; /* Backends are set to -1 indicating an inactive device. */ vq->backend = -1;