From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 1B5752B8D for ; Mon, 16 Jan 2017 15:46:32 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 16 Jan 2017 06:46:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,239,1477983600"; d="scan'208";a="1094752938" Received: from dpdk06.sh.intel.com ([10.239.129.195]) by fmsmga001.fm.intel.com with ESMTP; 16 Jan 2017 06:46:31 -0800 From: Jianfeng Tan To: dev@dpdk.org Cc: yuanhan.liu@linux.intel.com, stephen@networkplumber.org, lei.a.yao@intel.com, Jianfeng Tan Date: Mon, 16 Jan 2017 14:46:59 +0000 Message-Id: <1484578022-92705-8-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484578022-92705-1-git-send-email-jianfeng.tan@intel.com> References: <1480810702-114815-1-git-send-email-jianfeng.tan@intel.com> <1484578022-92705-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [PATCH v3 07/10] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 14:46:33 -0000 When virtio devices get stopped, 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 --- drivers/net/virtio/virtio_ethdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index e870125..5030ed5 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1652,6 +1652,15 @@ virtio_dev_start(struct rte_eth_dev *dev) PMD_DRV_LOG(ERR, "link status not supported by host"); return -ENOTSUP; } + } + + /* Enable uio/vfio intr/eventfd mapping: althrough we already did that + * in device configure, but it could be unmapped when device is + * stopped. + */ + if (dev->data->dev_conf.intr_conf.lsc || + dev->data->dev_conf.intr_conf.rxq) { + rte_intr_disable(dev->intr_handle); if (rte_intr_enable(dev->intr_handle) < 0) { PMD_DRV_LOG(ERR, "interrupt enable failed"); @@ -1746,10 +1755,11 @@ 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; PMD_INIT_LOG(DEBUG, "stop"); - if (dev->data->dev_conf.intr_conf.lsc) + if (intr_conf->lsc || intr_conf->rxq) rte_intr_disable(dev->intr_handle); memset(&link, 0, sizeof(link)); -- 2.7.4