From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2CE1E41E23;
	Thu,  9 Mar 2023 22:32:13 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7085042B8B;
	Thu,  9 Mar 2023 22:31:41 +0100 (CET)
Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com
 [209.85.214.176])
 by mails.dpdk.org (Postfix) with ESMTP id C5BC242B71
 for <dev@dpdk.org>; Thu,  9 Mar 2023 22:31:37 +0100 (CET)
Received: by mail-pl1-f176.google.com with SMTP id a9so3427478plh.11
 for <dev@dpdk.org>; Thu, 09 Mar 2023 13:31:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1678397497;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Q+2LMm2qM2K/Ta11c8MBPFxaHrlAUusvY9Oj5YBBCfQ=;
 b=kVhusxfQw//FK8cS4f2FU9yP0q33n6ZDx1TBLuGWzZ4ClHON9OBaKks4kL0Ah2f6Wm
 7cclbvyWLRwi7fIGJeOzJhpuroGSLz5F7euslK4XVjvSIQ0CkK+CMJV7QrynWgO6vGeD
 Rm0ua0iQ7J4D4Gg8NIYvrPA/KBIQNzNCwnP1DAY/kW7JdqnnBSGV0kYvjz6mBMHvJi/G
 161MS4u2SfGsB3NlgboTmRZVs1d/LwsjBpnoyvh+q6alb8V/y9HUGs3qTYE9HOBKOEZp
 cc1LzinAn++aHCo2lcovenylwwXXma8ghcGMOae2s4OIft28biJ0IvK9LoB63pPL0I9A
 hfpQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678397497;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Q+2LMm2qM2K/Ta11c8MBPFxaHrlAUusvY9Oj5YBBCfQ=;
 b=mGjn2QrcGXcCrL66pxUkDbFsnavkksR+WyMtNQNaiuQShCeFAytBqu8mFIx4r1HgbV
 zqktiP7TzQ7dHeKqMZdwZ3UhaQMrod7Wj3CplFEyrTIKGY1ZKimwRTQDCPeGWnn1RTbF
 XVhvgLHSLFhQ+hNEvKz81458EEqnrJA4mL8KgdY9jXehSFEAQo28cC62+YmchBqc+wCj
 S/zFBKcW01QlOcdvbMPncJEmUQYS6OwCxs/ePaDTMNpTUqLuE0AcLbXvMcBZ9pVhI5sr
 dBIJbYTMFuL2k8j83K6vPeDtaH/q96wzz1+y51TnWeVijEwdTVxpFgGbKhxMR/RZEW6s
 gvmA==
X-Gm-Message-State: AO0yUKWFRHQJcxpITwooMomt8iDCNAPSHydZguG8RXwYTWotn/8E1OxH
 KnEY3hRbGpOJvbDSRW8jgOtg2bWFn62CdkDXmc73GQ==
X-Google-Smtp-Source: AK7set9bvadhzDQKaCr6Zpy8LRBvODHlZQxrs0w3aYSqUYZxYVokpnanqbqrQWKPpcsjl0+c+mVrhQ==
X-Received: by 2002:a05:6a20:4283:b0:c6:bb08:a7ab with SMTP id
 o3-20020a056a20428300b000c6bb08a7abmr32699pzj.28.1678397496698; 
 Thu, 09 Mar 2023 13:31:36 -0800 (PST)
Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218])
 by smtp.gmail.com with ESMTPSA id
 q3-20020a63cc43000000b00502e4015ff7sm64225pgi.23.2023.03.09.13.31.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 09 Mar 2023 13:31:36 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v5 7/9] fib: enable on Windows
Date: Thu,  9 Mar 2023 13:31:26 -0800
Message-Id: <20230309213128.34146-8-stephen@networkplumber.org>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20230309213128.34146-1-stephen@networkplumber.org>
References: <20221201014440.11896-1-stephen@networkplumber.org>
 <20230309213128.34146-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

The FIB library builds on Windows as long as sys/queue.h is defined.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_fib.c       | 22 +---------------------
 app/test/test_fib6.c      | 24 ++----------------------
 app/test/test_fib6_perf.c | 15 +--------------
 app/test/test_fib_perf.c  | 19 +++----------------
 lib/fib/meson.build       |  6 ------
 lib/fib/rte_fib.c         |  1 +
 lib/fib/rte_fib6.c        |  1 +
 7 files changed, 9 insertions(+), 79 deletions(-)

diff --git a/app/test/test_fib.c b/app/test/test_fib.c
index a2d1ea8f3abc..eb69d6e2fd4c 100644
--- a/app/test/test_fib.c
+++ b/app/test/test_fib.c
@@ -9,28 +9,10 @@
 
 #include <rte_ip.h>
 #include <rte_log.h>
+#include <rte_fib.h>
 
 #include "test.h"
 
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_fib(void)
-{
-	printf("fib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_fib(void)
-{
-	printf("slow_fib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
-#include <rte_fib.h>
-
 typedef int32_t (*rte_fib_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -433,7 +415,5 @@ test_slow_fib(void)
 	return unit_test_suite_runner(&fib_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(fib_autotest, test_fib);
 REGISTER_TEST_COMMAND(fib_slow_autotest, test_slow_fib);
diff --git a/app/test/test_fib6.c b/app/test/test_fib6.c
index cd971e6ecdfb..15ad09178ae2 100644
--- a/app/test/test_fib6.c
+++ b/app/test/test_fib6.c
@@ -9,29 +9,11 @@
 
 #include <rte_memory.h>
 #include <rte_log.h>
-
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_fib6(void)
-{
-	printf("fib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_fib6(void)
-{
-	printf("slow_fib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_rib6.h>
 #include <rte_fib6.h>
 
+#include "test.h"
+
 typedef int32_t (*rte_fib6_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -442,7 +424,5 @@ test_slow_fib6(void)
 	return unit_test_suite_runner(&fib6_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(fib6_autotest, test_fib6);
 REGISTER_TEST_COMMAND(fib6_slow_autotest, test_slow_fib6);
diff --git a/app/test/test_fib6_perf.c b/app/test/test_fib6_perf.c
index 21d2b65318e9..add20c2331b1 100644
--- a/app/test/test_fib6_perf.c
+++ b/app/test/test_fib6_perf.c
@@ -10,21 +10,10 @@
 #include <rte_cycles.h>
 #include <rte_random.h>
 #include <rte_memory.h>
+#include <rte_fib6.h>
 
 #include "test.h"
 
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_fib6_perf(void)
-{
-	printf("fib6_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
-#include <rte_fib6.h>
-
 #include "test_lpm6_data.h"
 
 #define TEST_FIB_ASSERT(cond) do {				\
@@ -167,6 +156,4 @@ test_fib6_perf(void)
 	return 0;
 }
 
-#endif /*ifdef RTE_EXEC_ENV_WINDOWS*/
-
 REGISTER_TEST_COMMAND(fib6_perf_autotest, test_fib6_perf);
diff --git a/app/test/test_fib_perf.c b/app/test/test_fib_perf.c
index 9787874cc9b7..b56293e64f41 100644
--- a/app/test/test_fib_perf.c
+++ b/app/test/test_fib_perf.c
@@ -12,22 +12,11 @@
 #include <rte_random.h>
 #include <rte_branch_prediction.h>
 #include <rte_ip.h>
+#include <rte_fib.h>
 
 #include "test.h"
 #include "test_xmmt_ops.h"
 
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_fib_perf(void)
-{
-	printf("fib_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
-#include <rte_fib.h>
-
 #define TEST_FIB_ASSERT(cond) do {				\
 	if (!(cond)) {						\
 		printf("Error at line %d:\n", __LINE__);	\
@@ -246,7 +235,7 @@ static void generate_random_rule_prefix(uint32_t ip_class, uint8_t depth)
 	/* Only generate rest bits except the most significant
 	 * fixed bits for IP address class
 	 */
-	start = lrand48() & mask;
+	start = rte_rand() & mask;
 	ptr_rule = &large_route_table[num_route_entries];
 	for (k = 0; k < rule_num; k++) {
 		ptr_rule->ip = (start << (RTE_FIB_MAX_DEPTH - depth))
@@ -265,7 +254,7 @@ static void insert_rule_in_random_pos(uint32_t ip, uint8_t depth)
 	struct route_rule tmp;
 
 	do {
-		pos = lrand48();
+		pos = rte_rand();
 		try_count++;
 	} while ((try_count < 10) && (pos > num_route_entries));
 
@@ -420,6 +409,4 @@ test_fib_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(fib_perf_autotest, test_fib_perf);
diff --git a/lib/fib/meson.build b/lib/fib/meson.build
index 9b848d08417c..ddcae0617a73 100644
--- a/lib/fib/meson.build
+++ b/lib/fib/meson.build
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <medvedkinv@gmail.com>
 # Copyright(c) 2019 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_fib.c', 'rte_fib6.c', 'dir24_8.c', 'trie.c')
 headers = files('rte_fib.h', 'rte_fib6.h')
 deps += ['rib']
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 8af4c4091908..0c3b20e00a5a 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 4b8e22b142b9..28c69b38999f 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
-- 
2.39.2