From patchwork Thu Jul 23 05:38:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Fu X-Patchwork-Id: 74630 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 889C9A0526; Thu, 23 Jul 2020 07:40:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE45B1BF94; Thu, 23 Jul 2020 07:40:37 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id A4CF01BE90 for ; Thu, 23 Jul 2020 07:40:36 +0200 (CEST) IronPort-SDR: LeP8qf1M+1nyqDqK6LDZHzIKt3slcChSGdPubOzLEf4a27YZbEK6BhU2DCoRtZEfXl1+MR8Dol OYNZMdANUQug== X-IronPort-AV: E=McAfee;i="6000,8403,9690"; a="137967597" X-IronPort-AV: E=Sophos;i="5.75,385,1589266800"; d="scan'208";a="137967597" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 22:40:34 -0700 IronPort-SDR: uzRNZ/k0dG6JZ1erY51FxC5KrW1tBN6ReQAxMQ4iWm9Nbv+GtCnLwudtK0wJybsM4nAG0kh7ts fHQQUyJ2XJHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,385,1589266800"; d="scan'208";a="302189972" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2020 22:40:33 -0700 From: patrick.fu@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: Patrick Fu Date: Thu, 23 Jul 2020 13:38:01 +0800 Message-Id: <20200723053801.3616928-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 Subject: [dpdk-dev] [PATCH v1] vhost: fix vring disable fail in async transfer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Patrick Fu Async inflight packets is checked when front end virtio requests to disable vring. If inflight packets exists, vring disabling will fail. However, there is no good way for application to get notified before vring is disabled and properly complete inflight packets. This patch moves the inflight packets check from vring disabling time to the vring enabling time, so that applications have chances to drain out pending packets. Fixes: 78639d54563a ("vhost: introduce async enqueue registration API") Signed-off-by: Patrick Fu --- lib/librte_vhost/vhost_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 9ddeae362..36da1380a 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -2038,9 +2038,9 @@ vhost_user_set_vring_enable(struct virtio_net **pdev, "set queue enable: %d to qp idx: %d\n", enable, index); - if (!enable && dev->virtqueue[index]->async_registered) { + if (enable && dev->virtqueue[index]->async_registered) { if (dev->virtqueue[index]->async_pkts_inflight_n) { - VHOST_LOG_CONFIG(ERR, "failed to disable vring. " + VHOST_LOG_CONFIG(ERR, "failed to enable vring. " "async inflight packets must be completed first\n"); return RTE_VHOST_MSG_RESULT_ERR; }