From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id B35FE58E8 for ; Fri, 13 Jun 2014 02:31:11 +0200 (CEST) Received: from [2001:470:8:a08:215:ff:fecc:4872] (helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1WvFM7-0000OH-7t; Thu, 12 Jun 2014 20:29:08 -0400 Date: Thu, 12 Jun 2014 20:28:15 -0400 From: Neil Horman To: "Carew, Alan" Message-ID: <20140613002815.GA16153@localhost.localdomain> References: <20140606235028.189345212@networkplumber.org> <20140606235115.248804518@networkplumber.org> <20140608153704.GA27652@localhost.localdomain> <0E29434AEE0C3A4180987AB476A6F630593A63AB@IRSMSX101.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0E29434AEE0C3A4180987AB476A6F630593A63AB@IRSMSX101.ger.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v2 09/10] igbuio: show irq mode in sysfs 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: Fri, 13 Jun 2014 00:31:11 -0000 On Wed, Jun 11, 2014 at 06:27:35PM +0000, Carew, Alan wrote: > > -----Original Message----- > > From: Neil Horman [mailto:nhorman@tuxdriver.com] > > Sent: Sunday, June 08, 2014 4:37 PM > > To: Stephen Hemminger > > Cc: Carew, Alan; dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 09/10] igbuio: show irq mode in sysfs > > > > On Fri, Jun 06, 2014 at 04:50:37PM -0700, Stephen Hemminger wrote: > > > Since irq mode is determined dynamically on a per-device > > > basis, and virtio needs to know if using intx or msi-x, > > > make it a sysfs attribute. > > > > > > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > > @@ -43,6 +43,10 @@ > > > IGBUIO_MSIX_INTR_MODE > > > }; > > > > > > +static const char *igbuio_intr_modes[] = { > > > + "legacy", "msi", "msix" > > > +}; > > > + > > > /** > > > * A structure describing the private information for a uio device. > > > */ > > > @@ -128,8 +132,20 @@ > > > } > > > > > > static DEVICE_ATTR(max_vfs, S_IRUGO | S_IWUSR, show_max_vfs, > > store_max_vfs); > > > + > > > +static ssize_t irq_mode_show(struct device *dev, > > > + struct device_attribute *attr, char *buf) > > > +{ > > > + struct uio_info *info = pci_get_drvdata(to_pci_dev(dev)); > > > + struct rte_uio_pci_dev *udev = igbuio_get_uio_pci_dev(info); > > > + > > > + return sprintf(buf, "%s\n", igbuio_intr_modes[udev->mode]); > > > +} > > > +static DEVICE_ATTR(irq_mode, S_IRUGO, irq_mode_show, NULL); > > > + > > > static struct attribute *dev_attrs[] = { > > > &dev_attr_max_vfs.attr, > > > + &dev_attr_irq_mode.attr, > > > NULL, > > > }; > > > > > > > > > > > Do you really need this attribute? The pci bus sysfs tree already exports irq > > mode information for each device allocated already in > > /sys/bus/pci/device/msi_irqs > > > > Neil > > Hi Neil, > > After some digging around, I now realise what you mean, it is a good suggestion. thanks. > /sys/bus/pci/devices//msi_irqs//mode, where "msi_irqs" directory only exists for msi/msix and not for int-x. Also the "mode" file contains string of configured interrupt mode. Yes, thats correct (although the file layout is slightly different in later kernels, as the mode is contained in a file that is named after the irq vector). For int-x interrupts you can query the /sys/bus/pci/devices/ > Thanks, > Alan >