Since we now have a list of interrupt modes for sysfs,
use that to match module param values. This also allows msi
to be selected as a preferred mode.

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
@@ -605,21 +605,24 @@
 static int
 igbuio_config_intr_mode(char *intr_str)
 {
+       unsigned int i;
+
        if (!intr_str) {
                pr_info("Use MSIX interrupt by default\n");
                return 0;
        }

-       if (!strcmp(intr_str, "msix")) {
-               igbuio_intr_mode_preferred = IGBUIO_MSIX_INTR_MODE;
-               pr_info("Use MSIX interrupt\n");
-       } else if (!strcmp(intr_str, "legacy")) {
-               igbuio_intr_mode_preferred = IGBUIO_LEGACY_INTR_MODE;
-               pr_info("Use legacy interrupt\n");
-       } else {
-               pr_info("Error: bad parameter - %s\n", intr_str);
-               return -EINVAL;
-       }
+       for (i = 0; i < ARRAY_SIZE(igbuio_intr_modes); i++) {
+               const char *mode = igbuio_intr_modes[i];
+               if (!strcmp(intr_str, mode)) {
+                       pr_info("Use %s interrupt mode\n", mode);
+                       igbuio_intr_mode_preferred = i;
+                       return 0;
+               }
+       }
+
+       pr_warn("bad interrupt mode parameter %s\n", intr_str);
+       return -EINVAL;

        return 0;
 }
@@ -656,6 +659,7 @@
 MODULE_PARM_DESC(intr_mode,
 "igb_uio interrupt mode (default=msix):\n"
 "    msix       Use MSIX interrupt\n"
+"    msi       Use MSI interrupt\n"
 "    legacy     Use Legacy interrupt\n"
 "\n");


Reply via email to