From fe8fc6b0b7eaf9078d804d57221000a494753997 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 14 Jun 2019 11:39:15 +0200 Subject: [PATCH] kni: abort when IOVA is not PA 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 --- lib/librte_kni/rte_kni.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 00104a35d2..e60de2cdb0 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -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); -- 2.20.1