kni: abort when IOVA is not PA
authorDavid Marchand <david.marchand@redhat.com>
Fri, 14 Jun 2019 09:39:15 +0000 (11:39 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 5 Jul 2019 14:54:40 +0000 (16:54 +0200)
If a forced iova-mode has been passed at init, kni is not supposed to
work.

Fixes: 075b182b54ce ("eal: force IOVA to a particular mode")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
lib/librte_kni/rte_kni.c

index 00104a3..e60de2c 100644 (file)
@@ -97,6 +97,11 @@ static volatile int kni_fd = -1;
 int
 rte_kni_init(unsigned int max_kni_ifaces __rte_unused)
 {
+       if (rte_eal_iova_mode() != RTE_IOVA_PA) {
+               RTE_LOG(ERR, KNI, "KNI requires IOVA as PA\n");
+               return -1;
+       }
+
        /* Check FD and open */
        if (kni_fd < 0) {
                kni_fd = open("/dev/" KNI_DEVICE, O_RDWR);