From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <huawei.xie@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id E35995F17
 for <dev@dpdk.org>; Tue, 27 Jan 2015 10:04:13 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga101.jf.intel.com with ESMTP; 27 Jan 2015 01:04:12 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.09,473,1418112000"; d="scan'208";a="657163354"
Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91])
 by fmsmga001.fm.intel.com with ESMTP; 27 Jan 2015 01:04:11 -0800
Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by
 PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS)
 id 14.3.195.1; Tue, 27 Jan 2015 17:04:09 +0800
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.64]) by
 shsmsx102.ccr.corp.intel.com ([169.254.2.238]) with mapi id 14.03.0195.001;
 Tue, 27 Jan 2015 17:04:08 +0800
From: "Xie, Huawei" <huawei.xie@intel.com>
To: "Ouyang, Changchun" <changchun.ouyang@intel.com>, "dev@dpdk.org"
 <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link State
 interrupt
Thread-Index: AQHQOdpcPcHgLn38/0imnJ4/vXEjjJzTq/IQ
Date: Tue, 27 Jan 2015 09:04:07 +0000
Message-ID: <C37D651A908B024F974696C65296B57B0F361C0C@SHSMSX101.ccr.corp.intel.com>
References: <1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>
 <1422326164-13697-1-git-send-email-changchun.ouyang@intel.com>
 <1422326164-13697-5-git-send-email-changchun.ouyang@intel.com>
In-Reply-To: <1422326164-13697-5-git-send-email-changchun.ouyang@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link
	State	interrupt
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>
X-List-Received-Date: Tue, 27 Jan 2015 09:04:14 -0000



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang Changchun
> Sent: Tuesday, January 27, 2015 10:36 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link State i=
nterrupt
>=20
> Virtio has link state interrupt which can be used.
>=20
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> ---
>  lib/librte_pmd_virtio/virtio_ethdev.c | 78 +++++++++++++++++++++++++++--=
----
> --
>  lib/librte_pmd_virtio/virtio_pci.c    | 22 ++++++++++
>  lib/librte_pmd_virtio/virtio_pci.h    |  4 ++
>  3 files changed, 86 insertions(+), 18 deletions(-)
>=20
> diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c
> b/lib/librte_pmd_virtio/virtio_ethdev.c
> index 5df3b54..ef87ff8 100644
> --- a/lib/librte_pmd_virtio/virtio_ethdev.c
> +++ b/lib/librte_pmd_virtio/virtio_ethdev.c
> @@ -845,6 +845,34 @@ static int virtio_resource_init(struct rte_pci_devic=
e
> *pci_dev __rte_unused)
>  #endif
>=20
>  /*
> + * Process Virtio Config changed interrupt and call the callback
> + * if link state changed.
> + */
> +static void
> +virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
> +			 void *param)
> +{
> +	struct rte_eth_dev *dev =3D param;
> +	struct virtio_hw *hw =3D
> +		VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +	uint8_t isr;
> +
> +	/* Read interrupt status which clears interrupt */
> +	isr =3D vtpci_isr(hw);
> +	PMD_DRV_LOG(INFO, "interrupt status =3D %#x", isr);
> +
> +	if (rte_intr_enable(&dev->pci_dev->intr_handle) < 0)
> +		PMD_DRV_LOG(ERR, "interrupt enable failed");
> +

Is it better to put rte_intr_enable after we have handled the interrupt.
Is there the possibility of interrupt reentrant in uio intr framework?

> +	if (isr & VIRTIO_PCI_ISR_CONFIG) {
> +		if (virtio_dev_link_update(dev, 0) =3D=3D 0)
> +			_rte_eth_dev_callback_process(dev,
> +
> RTE_ETH_EVENT_INTR_LSC);
> +	}
> +
> +}
> +
>=20