Since only one MSI-X entry is ever defined, there is no need to
put it as an array in the driver private data structure. One msix_entry
can just be put on the stack and initialized there.

Also remove the unused backport defines related to MSI-X.
I suspect this code was just inherited from some other project and
never cleaned up.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>


--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -36,21 +36,6 @@
 #include <xen/xen.h>
 #endif

-/**
- * MSI-X related macros, copy from linux/pci_regs.h in kernel 2.6.39,
- * but none of them in kernel 2.6.35.
- */
-#ifndef PCI_MSIX_ENTRY_SIZE
-#define PCI_MSIX_ENTRY_SIZE             16
-#define PCI_MSIX_ENTRY_LOWER_ADDR       0
-#define PCI_MSIX_ENTRY_UPPER_ADDR       4
-#define PCI_MSIX_ENTRY_DATA             8
-#define PCI_MSIX_ENTRY_VECTOR_CTRL      12
-#define PCI_MSIX_ENTRY_CTRL_MASKBIT     1
-#endif
-
-#define IGBUIO_NUM_MSI_VECTORS 1
-
 /* interrupt mode */
 enum igbuio_intr_mode {
        IGBUIO_LEGACY_INTR_MODE = 0,
@@ -67,8 +52,6 @@
        struct pci_dev *pdev;
        spinlock_t lock; /* spinlock for accessing PCI config space or msix 
data in multi tasks/isr */
        enum igbuio_intr_mode mode;
-       struct msix_entry \
-               msix_entries[IGBUIO_NUM_MSI_VECTORS]; /* pointer to the msix 
vectors to be allocated later */
 };

 static char *intr_mode;
@@ -526,17 +509,16 @@

        /* check if it need to try msix first */
        if (igbuio_intr_mode_preferred == IGBUIO_MSIX_INTR_MODE) {
-               int vector;
-
-               for (vector = 0; vector < IGBUIO_NUM_MSI_VECTORS; vector ++)
-                       udev->msix_entries[vector].entry = vector;
+               /* only one MSIX vector needed */
+               struct msix_entry msix_entry = {
+                       .entry = 0,
+               };

-               if (pci_enable_msix(udev->pdev, udev->msix_entries, 
IGBUIO_NUM_MSI_VECTORS) == 0) {
+               if (pci_enable_msix(udev->pdev, &msix_entry, 1) == 0) {
                        udev->mode = IGBUIO_MSIX_INTR_MODE;
-               }
-               else {
-                       pci_disable_msix(udev->pdev);
-                       pr_info("fail to enable pci msix, or not enough msix 
entries\n");
+               } else {
+                       pr_err("failed to enable pci msix, or not enough msix 
entries\n");
+                       udev->mode = IGBUIO_LEGACY_INTR_MODE;
                }
        }
        switch (udev->mode) {

Reply via email to