aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2009-05-07 04:28:41 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-06-11 15:04:18 -0400
commit57fbf52c86addd8e25d1975fac0d59d982d1f6ec (patch)
treece8c13b78e34c287ed9cdf3062dad38f64572b9e /drivers/pci/msi.c
parent8e822df700694ca6850d1e0c122fd7004b2778d8 (diff)
PCI MSI: let drivers retry when not enough vectors
pci_enable_msix currently returns -EINVAL if you ask for more vectors than supported by the device, which would typically cause fallback to regular interrupts. It's better to return the table size, making the driver retry MSI-X with less vectors. Reviewed-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 7ffac27d5d4a..f2725710593a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -691,8 +691,8 @@ int pci_msix_table_size(struct pci_dev *dev)
691 * indicates the successful configuration of MSI-X capability structure 691 * indicates the successful configuration of MSI-X capability structure
692 * with new allocated MSI-X irqs. A return of < 0 indicates a failure. 692 * with new allocated MSI-X irqs. A return of < 0 indicates a failure.
693 * Or a return of > 0 indicates that driver request is exceeding the number 693 * Or a return of > 0 indicates that driver request is exceeding the number
694 * of irqs available. Driver should use the returned value to re-send 694 * of irqs or MSI-X vectors available. Driver should use the returned value to
695 * its request. 695 * re-send its request.
696 **/ 696 **/
697int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) 697int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
698{ 698{
@@ -708,7 +708,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
708 708
709 nr_entries = pci_msix_table_size(dev); 709 nr_entries = pci_msix_table_size(dev);
710 if (nvec > nr_entries) 710 if (nvec > nr_entries)
711 return -EINVAL; 711 return nr_entries;
712 712
713 /* Check for any invalid entries */ 713 /* Check for any invalid entries */
714 for (i = 0; i < nvec; i++) { 714 for (i = 0; i < nvec; i++) {