[dpdk-dev] [PATCH v2 09/10] igbuio: show irq mode in sysfs

Carew, Alan alan.carew at intel.com
Wed Jun 11 20:27:35 CEST 2014


> -----Original Message-----
> From: Neil Horman [mailto:nhorman at tuxdriver.com]
> Sent: Sunday, June 08, 2014 4:37 PM
> To: Stephen Hemminger
> Cc: Carew, Alan; dev at 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<irq_number>
> 
> Neil

Hi Neil,

After some digging around, I now realise what you mean, it is a good suggestion.
/sys/bus/pci/devices/<D:B:D.F>/msi_irqs/<IRQ>/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.

Thanks,
Alan


More information about the dev mailing list