From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jianfeng.tan@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id 579783777
 for <dev@dpdk.org>; Thu, 29 Dec 2016 08:30:13 +0100 (CET)
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by orsmga101.jf.intel.com with ESMTP; 28 Dec 2016 23:30:13 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.33,425,1477983600"; d="scan'208";a="44228337"
Received: from dpdk06.sh.intel.com ([10.239.129.195])
 by orsmga004.jf.intel.com with ESMTP; 28 Dec 2016 23:30:11 -0800
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: yuanhan.liu@linux.intel.com, stephen@networkplumber.org,
 Jianfeng Tan <jianfeng.tan@intel.com>
Date: Thu, 29 Dec 2016 07:30:40 +0000
Message-Id: <1482996643-113253-7-git-send-email-jianfeng.tan@intel.com>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1482996643-113253-1-git-send-email-jianfeng.tan@intel.com>
References: <1480810702-114815-1-git-send-email-jianfeng.tan@intel.com>
 <1482996643-113253-1-git-send-email-jianfeng.tan@intel.com>
Subject: [dpdk-dev] [PATCH v2 6/9] net/virtio: unbind intr/eventfd when stop
	device
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <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>
X-List-Received-Date: Thu, 29 Dec 2016 07:30:13 -0000

When virtio devices get stopped, we just tell the kernel to unbind
the mapping between interrupts and eventfds.

Note: it behaves differently from other NICs which close eventfds,
free struct. In virtio, we do those things when close device in
following patch.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 082346b..0754ba0 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1686,11 +1686,13 @@ static void
 virtio_dev_stop(struct rte_eth_dev *dev)
 {
 	struct rte_eth_link link;
+	struct rte_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf;
+	struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;
 
 	PMD_INIT_LOG(DEBUG, "stop");
 
-	if (dev->data->dev_conf.intr_conf.lsc)
-		rte_intr_disable(&dev->pci_dev->intr_handle);
+	if (intr_conf->lsc || intr_conf->rxq)
+		rte_intr_disable(intr_handle);
 
 	memset(&link, 0, sizeof(link));
 	virtio_dev_atomic_write_link_status(dev, &link);
-- 
2.7.4