Author: scottl Date: Tue Nov 13 18:49:43 2018 New Revision: 340403 URL: https://svnweb.freebsd.org/changeset/base/340403
Log: Fix a regression from prior to 11.2 that caused MSI (not MSI-X) interrupt allocation to fail. While here, refactor the code so that it's more clear and less likely to break in the future. This is not an MFC due to the code in 12/head being very different, but it follows the latter's structure more closely than before. Reported by: Harry Schmalzbauer Modified: stable/11/sys/dev/mpr/mpr_pci.c stable/11/sys/dev/mps/mps_pci.c Modified: stable/11/sys/dev/mpr/mpr_pci.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_pci.c Tue Nov 13 18:40:01 2018 (r340402) +++ stable/11/sys/dev/mpr/mpr_pci.c Tue Nov 13 18:49:43 2018 (r340403) @@ -262,12 +262,16 @@ mpr_pci_alloc_interrupts(struct mpr_softc *sc) error = 0; msgs = 0; - if ((sc->disable_msix == 0) && - ((msgs = pci_msix_count(dev)) >= MPR_MSI_COUNT)) - error = mpr_alloc_msix(sc, MPR_MSI_COUNT); - if ((error != 0) && (sc->disable_msi == 0) && - ((msgs = pci_msi_count(dev)) >= MPR_MSI_COUNT)) - error = mpr_alloc_msi(sc, MPR_MSI_COUNT); + if (sc->disable_msix == 0) { + msgs = pci_msix_count(dev); + if (msgs >= MPR_MSI_COUNT) + error = mpr_alloc_msix(sc, MPR_MSI_COUNT); + } + if (((error != 0) || (msgs == 0)) && (sc->disable_msi == 0)) { + msgs = pci_msi_count(dev); + if (msgs >= MPR_MSI_COUNT) + error = mpr_alloc_msi(sc, MPR_MSI_COUNT); + } if (error != 0) msgs = 0; Modified: stable/11/sys/dev/mps/mps_pci.c ============================================================================== --- stable/11/sys/dev/mps/mps_pci.c Tue Nov 13 18:40:01 2018 (r340402) +++ stable/11/sys/dev/mps/mps_pci.c Tue Nov 13 18:49:43 2018 (r340403) @@ -247,12 +247,16 @@ mps_pci_alloc_interrupts(struct mps_softc *sc) error = 0; msgs = 0; - if ((sc->disable_msix == 0) && - ((msgs = pci_msix_count(dev)) >= MPS_MSI_COUNT)) - error = mps_alloc_msix(sc, MPS_MSI_COUNT); - if ((error != 0) && (sc->disable_msi == 0) && - ((msgs = pci_msi_count(dev)) >= MPS_MSI_COUNT)) - error = mps_alloc_msi(sc, MPS_MSI_COUNT); + if (sc->disable_msix == 0) { + msgs = pci_msix_count(dev); + if (msgs >= MPS_MSI_COUNT) + error = mps_alloc_msix(sc, MPS_MSI_COUNT); + } + if (((error != 0) || (msgs == 0)) && (sc->disable_msi == 0)) { + msgs = pci_msi_count(dev); + if (msgs >= MPS_MSI_COUNT) + error = mps_alloc_msi(sc, MPS_MSI_COUNT); + } if (error != 0) msgs = 0; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"