From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2A6581B49A for ; Thu, 22 Nov 2018 17:52:39 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C8C631256CE; Thu, 22 Nov 2018 16:52:38 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98C1D60E3F; Thu, 22 Nov 2018 16:52:36 +0000 (UTC) From: Kevin Traynor To: Naga Suresh Somarowthu Cc: Ferruh Yigit , dpdk stable Date: Thu, 22 Nov 2018 16:49:31 +0000 Message-Id: <20181122164957.13003-39-ktraynor@redhat.com> In-Reply-To: <20181122164957.13003-1-ktraynor@redhat.com> References: <20181122164957.13003-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 22 Nov 2018 16:52:38 +0000 (UTC) Subject: [dpdk-stable] patch 'test/kni: check module dependency' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2018 16:52:39 -0000 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 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 Acked-by: Ferruh Yigit --- 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 #include +#include #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 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@dpdk.org Signed-off-by: Naga Suresh Somarowthu Acked-by: Ferruh Yigit @@ -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);