[dpdk-stable] patch 'test/kni: check module dependency' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Thu Nov 22 17:49:31 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/28/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 43258358b40e4f6ed077a550d37c5fb2be022be2 Mon Sep 17 00:00:00 2001
From: Naga Suresh Somarowthu <naga.sureshx.somarowthu at intel.com>
Date: Fri, 14 Sep 2018 14:57:02 +0100
Subject: [PATCH] test/kni: check module dependency

[ upstream commit ee1caebc4dea6ae59ef60d2e3cc75338c213207d ]

Check the prerequisites to run the test
1.checked whether the rte_kni module is loaded, if not fail testcase
2.checked whether the rte_kni module is loaded with loop back mode,
  if not skip packet forwarding testcase and log
3.Disabled the test in freebsd as test is not supported

Fixes: 5233e5924a ("app/test: update kni")

Signed-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu at intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 test/test/test_kni.c | 49 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 11 deletions(-)

diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index 1b876719a..6c1420a16 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -8,8 +8,9 @@
 #include <string.h>
 #include <sys/wait.h>
+#include <dirent.h>
 
 #include "test.h"
 
-#ifndef RTE_LIBRTE_KNI
+#if !defined(RTE_EXEC_ENV_LINUXAPP) || !defined(RTE_LIBRTE_KNI)
 
 static int
@@ -41,4 +42,6 @@ test_kni(void)
 #define IFCONFIG      "/sbin/ifconfig "
 #define TEST_KNI_PORT "test_kni_port"
+#define KNI_MODULE_PATH "/sys/module/rte_kni"
+#define KNI_MODULE_PARAM_LO KNI_MODULE_PATH"/parameters/lo_mode"
 #define KNI_TEST_MAX_PORTS 4
 /* The threshold number of mbufs to be transmitted or received. */
@@ -463,5 +466,5 @@ test_kni(void)
 {
 	int ret = -1;
-	uint16_t nb_ports, port_id;
+	uint16_t port_id;
 	struct rte_kni *kni;
 	struct rte_mempool *mp;
@@ -471,4 +474,18 @@ test_kni(void)
 	const struct rte_pci_device *pci_dev;
 	const struct rte_bus *bus;
+	FILE *fd;
+	DIR *dir;
+	char buf[16];
+
+	dir = opendir(KNI_MODULE_PATH);
+	if (!dir) {
+		if (errno == ENOENT) {
+			printf("Cannot run UT due to missing rte_kni module\n");
+			return -1;
+		}
+		printf("opendir: %s", strerror(errno));
+		return -1;
+	}
+	closedir(dir);
 
 	/* Initialize KNI subsytem */
@@ -486,10 +503,4 @@ test_kni(void)
 	}
 
-	nb_ports = rte_eth_dev_count_avail();
-	if (nb_ports == 0) {
-		printf("no supported nic port found\n");
-		return -1;
-	}
-
 	/* configuring port 0 for the test is enough */
 	port_id = 0;
@@ -520,7 +531,23 @@ test_kni(void)
 
 	/* basic test of kni processing */
-	ret = test_kni_processing(port_id, mp);
-	if (ret < 0)
-		goto fail;
+	fd = fopen(KNI_MODULE_PARAM_LO, "r");
+	if (fd == NULL) {
+		printf("fopen: %s", strerror(errno));
+		return -1;
+	}
+	memset(&buf, 0, sizeof(buf));
+	if (fgets(buf, sizeof(buf), fd)) {
+		if (!strncmp(buf, "lo_mode_fifo", strlen("lo_mode_fifo")) ||
+			!strncmp(buf, "lo_mode_fifo_skb",
+				  strlen("lo_mode_fifo_skb"))) {
+			ret = test_kni_processing(port_id, mp);
+			if (ret < 0) {
+				fclose(fd);
+				goto fail;
+			}
+		} else
+			printf("test_kni_processing skipped because of missing rte_kni module lo_mode argument\n");
+	}
+	fclose(fd);
 
 	/* test of allocating KNI with NULL mempool pointer */
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-22 16:47:33.272394906 +0000
+++ 0039-test-kni-check-module-dependency.patch	2018-11-22 16:47:32.000000000 +0000
@@ -1,8 +1,10 @@
-From ee1caebc4dea6ae59ef60d2e3cc75338c213207d Mon Sep 17 00:00:00 2001
+From 43258358b40e4f6ed077a550d37c5fb2be022be2 Mon Sep 17 00:00:00 2001
 From: Naga Suresh Somarowthu <naga.sureshx.somarowthu at intel.com>
 Date: Fri, 14 Sep 2018 14:57:02 +0100
 Subject: [PATCH] test/kni: check module dependency
 
+[ upstream commit ee1caebc4dea6ae59ef60d2e3cc75338c213207d ]
+
 Check the prerequisites to run the test
 1.checked whether the rte_kni module is loaded, if not fail testcase
 2.checked whether the rte_kni module is loaded with loop back mode,
@@ -10,7 +12,6 @@
 3.Disabled the test in freebsd as test is not supported
 
 Fixes: 5233e5924a ("app/test: update kni")
-Cc: stable at dpdk.org
 
 Signed-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu at intel.com>
 Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
@@ -19,7 +20,7 @@
  1 file changed, 38 insertions(+), 11 deletions(-)
 
 diff --git a/test/test/test_kni.c b/test/test/test_kni.c
-index e38206905..f3c19b5a0 100644
+index 1b876719a..6c1420a16 100644
 --- a/test/test/test_kni.c
 +++ b/test/test/test_kni.c
 @@ -8,8 +8,9 @@
@@ -40,14 +41,14 @@
 +#define KNI_MODULE_PARAM_LO KNI_MODULE_PATH"/parameters/lo_mode"
  #define KNI_TEST_MAX_PORTS 4
  /* The threshold number of mbufs to be transmitted or received. */
-@@ -531,5 +534,5 @@ test_kni(void)
+@@ -463,5 +466,5 @@ test_kni(void)
  {
  	int ret = -1;
 -	uint16_t nb_ports, port_id;
 +	uint16_t port_id;
  	struct rte_kni *kni;
  	struct rte_mempool *mp;
-@@ -539,4 +542,18 @@ test_kni(void)
+@@ -471,4 +474,18 @@ test_kni(void)
  	const struct rte_pci_device *pci_dev;
  	const struct rte_bus *bus;
 +	FILE *fd;
@@ -66,7 +67,7 @@
 +	closedir(dir);
  
  	/* Initialize KNI subsytem */
-@@ -554,10 +571,4 @@ test_kni(void)
+@@ -486,10 +503,4 @@ test_kni(void)
  	}
  
 -	nb_ports = rte_eth_dev_count_avail();
@@ -77,7 +78,7 @@
 -
  	/* configuring port 0 for the test is enough */
  	port_id = 0;
-@@ -588,7 +599,23 @@ test_kni(void)
+@@ -520,7 +531,23 @@ test_kni(void)
  
  	/* basic test of kni processing */
 -	ret = test_kni_processing(port_id, mp);


More information about the stable mailing list