Michael raised the issue of dev->stop() calling pci_disable_msi() on ifconfig down. The rtnl_lock eliminates that problem. Signed-off-by: Vincent Rizza <vinnie@xxxxxxx> Signed-off-by: Brett Grandbois <brettg@xxxxxxx> Signed-off-by: Greg Banks <gnb@xxxxxxx> --- Documentation/ABI/testing/sysfs-bus-pci | 9 +++++++++ drivers/pci/pci-sysfs.c | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index ceddcff..15d48ed 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci @@ -9,3 +9,12 @@ Description: that some devices may have malformatted data. If the underlying VPD has a writable section then the corresponding section of this file will be writable. + +What: /sys/bus/pci/devices/.../msix +Date: October 2008 +Contact: Vincent Rizza <vinnie@xxxxxxx> +Description: + The "msix" file (read only) in the device directory + provides a list of MSI-X IRQs for the given device. + Each line contains a MSI-X IRQ (represented in decimal). + The file is empty if there are no MSI-X IRQs. diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 110022d..7f90989 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -18,6 +18,8 @@ #include <linux/kernel.h> #include <linux/sched.h> #include <linux/pci.h> +#include <linux/msi.h> +#include <linux/rtnetlink.h> #include <linux/stat.h> #include <linux/topology.h> #include <linux/mm.h> @@ -45,6 +47,27 @@ pci_config_attr(subsystem_device, "0x%04x\n"); pci_config_attr(class, "0x%06x\n"); pci_config_attr(irq, "%u\n"); +#ifdef CONFIG_PCI_MSI +static ssize_t msix_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct pci_dev *pdev = to_pci_dev(dev); + struct msi_desc *entry; + u32 total = 0; + + if (pdev->msix_enabled) { + /* netdev interface lock in case someone does an ifdown */ + rtnl_lock(); + list_for_each_entry(entry, &pdev->msi_list, list) { + total += sprintf(buf + total, "%u\n", entry->irq); + } + rtnl_unlock(); + } + + return total; +} +#endif + static ssize_t broken_parity_status_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -217,6 +240,9 @@ struct device_attribute pci_dev_attrs[] = { __ATTR_RO(subsystem_device), __ATTR_RO(class), __ATTR_RO(irq), +#ifdef CONFIG_PCI_MSI + __ATTR_RO(msix), +#endif __ATTR_RO(local_cpus), __ATTR_RO(local_cpulist), __ATTR_RO(modalias), -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html