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 736B068F7 for ; Thu, 6 Apr 2017 07:22:02 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 05 Apr 2017 22:22:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,282,1488873600"; d="scan'208";a="842507668" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by FMSMGA003.fm.intel.com with ESMTP; 05 Apr 2017 22:22:00 -0700 Date: Thu, 6 Apr 2017 13:19:25 +0800 From: Yuanhan Liu To: Jianfeng Tan Cc: zhiyong.yang@intel.com, stable@dpdk.org, Stephen Hemminger Message-ID: <20170406051925.GN18844@yliu-dev.sh.intel.com> References: <1490683611-72221-1-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1490683611-72221-1-git-send-email-jianfeng.tan@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-stable] [PATCH] net/virtio: fix read isr as MSI is enabled X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2017 05:22:03 -0000 On Tue, Mar 28, 2017 at 06:46:51AM +0000, Jianfeng Tan wrote: > We should not always check isr to know if link status is changed. Did this patch fix a real issue? > Here is how driver should handle interrupt quoted from virtio spec, > > If MSI-X capability is disabled: > – Read the ISR Status field, which will reset it to zero. > – If the lower bit is set: look through the used rings of all > virtqueues for the device, to see if any progress has been made > by the device which requires servicing. > – If the second lower bit is set: re-examine the configuration > space to see what changed. > If MSI-X capability is enabled: > – Look through the used rings of all virtqueues mapped to that > MSI-X vector for the device, to see if any progress has been > made by the device which requires servicing. > – If the MSI-X vector is equal to config_msix_vector, re-examine > the configuration space to see what changed > > Fixes: 8d6d7e5cb3b1 ("virtio: support link state interrupt") > CC: stable@dpdk.org > > CC: Stephen Hemminger > Signed-off-by: Jianfeng Tan > --- > drivers/net/virtio/virtio_ethdev.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 3cf4102..cb30d11 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -1197,20 +1198,23 @@ virtio_interrupt_handler(struct rte_intr_handle *handle, > struct rte_eth_dev *dev = param; > struct virtio_hw *hw = dev->data->dev_private; > uint8_t isr; > + bool check_config; > > - /* Read interrupt status which clears interrupt */ > - isr = vtpci_isr(hw); > - PMD_DRV_LOG(INFO, "interrupt status = %#x", isr); > + /* isr is used only when msix is not enabled */ > + if (!hw->modern && !hw->use_msix) { The comment doesn't quite match the code: the hw->modern part is missing. > + isr = vtpci_isr(hw); /* Read to clears interrupt */ > + PMD_DRV_LOG(INFO, "interrupt status = %#x", isr); > + check_config = (isr & VIRTIO_PCI_ISR_CONFIG) ? true : false; The "? :" is unnecessary. --yliu > + } else { > + check_config = true; > + } > > if (rte_intr_enable(handle) < 0) > PMD_DRV_LOG(ERR, "interrupt enable failed"); > > - if (isr & VIRTIO_PCI_ISR_CONFIG) { > - if (virtio_dev_link_update(dev, 0) == 0) > - _rte_eth_dev_callback_process(dev, > - RTE_ETH_EVENT_INTR_LSC, NULL); > - } > - > + if (check_config && virtio_dev_link_update(dev, 0) == 0) > + _rte_eth_dev_callback_process(dev, > + RTE_ETH_EVENT_INTR_LSC, NULL); > } > > static void > -- > 2.7.4