From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 2ABE15A6D for ; Wed, 28 Jan 2015 17:18:24 +0100 (CET) Received: by mail-wg0-f44.google.com with SMTP id z12so21577024wgg.3 for ; Wed, 28 Jan 2015 08:18:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=vw/YeYbksao93cWydFlEEtQ1/eoJaZVJ38AaI9IPCT4=; b=jdwPukC95bi3ZDfe5uzQP7mZ+3kd9pWxmu0RLGRSTRNQKEP/P2fj8YNvuKHG6LD2T8 mPGHu/O8kBcSLaB+zE5qHlPc0odVVaFv8gmIj6aKeo8kU74gwJIqrRaHyUHnYmMpAQtb v+MTSOUh6S60FxJuVDCqLKOVFYXt7d0eaCiIZVCeI4kQALZh12Vb1TpSFVAI231My5Jh QIlo+99mZfe1AalVQf3mx0EKKlkqTR3u/6cIT3YPStI9A1WKHEKRMh/9pRGRepXLl1Y+ R5d0ReSh9sZKmY3h2GdKLA9jUKoYoDH5oWhzul0CuZPzrcfIXGJ1O0BV6eKw+0dSkgij hBVQ== X-Gm-Message-State: ALoCoQm5sa85H77cgCNfAP/pN2N+b6Z+IF0mn/TNMMpwHJId9KYHn+0Xf3JFXbd2QGwDzxCMQGRo X-Received: by 10.180.211.176 with SMTP id nd16mr8401862wic.23.1422461902435; Wed, 28 Jan 2015 08:18:22 -0800 (PST) Received: from uryu.home.lan ([109.231.227.156]) by mx.google.com with ESMTPSA id i13sm6736843wjr.7.2015.01.28.08.18.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jan 2015 08:18:21 -0800 (PST) Date: Wed, 28 Jan 2015 15:11:40 +0000 From: Stephen Hemminger To: "Ouyang, Changchun" Message-ID: <20150128151140.590d0582@uryu.home.lan> In-Reply-To: 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> <20150127100006.007fbf8c@uryu.home.lan> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 16:18:24 -0000 On Wed, 28 Jan 2015 03:03:32 +0000 "Ouyang, Changchun" wrote: > Hi Stephen, > > > -----Original Message----- > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Tuesday, January 27, 2015 6:00 PM > > To: Xie, Huawei > > Cc: Ouyang, Changchun; dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link State > > interrupt > > > > On Tue, 27 Jan 2015 09:04:07 +0000 > > "Xie, Huawei" wrote: > > > > > > -----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 interrupt > > > > > > > > Virtio has link state interrupt which can be used. > > > > > > > > Signed-off-by: Stephen Hemminger > > > > Signed-off-by: Changchun Ouyang > > > > --- > > > > 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(-) > > > > > > > > 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_device *pci_dev __rte_unused) #endif > > > > > > > > /* > > > > + * 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 = param; > > > > + struct virtio_hw *hw = > > > > + VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > > > + uint8_t isr; > > > > + > > > > + /* Read interrupt status which clears interrupt */ > > > > + isr = vtpci_isr(hw); > > > > + PMD_DRV_LOG(INFO, "interrupt status = %#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? > > > > The UIO framework handles IRQ's via posix thread that is reading fd, then > > calling this code. Therefore it is always single threaded. > > Even if it is under UIO framework, and always single threaded, > How about move rte_intr_enable after the virtio_dev_link_update() and _rte_eth_dev_callback_process is called. > This make it more like interrupt handler in linux kernel. > What do you think of it? I ordered the interrupt handling to match what happens in e1000/igb handler. My concern is that interrupt was level (not edge triggered) and another link transisition could occur and be missed.