Skip to contentSkip to conversation

Enable building more on Windows

PATCH Superseded Stephen Hemminger 5 participants 66 messages Dec 1, 2022 – Mar 10, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Enable building more on Windows

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

This patchset enables build them.
Tested with MingW cross build.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatability

 app/test/meson.build         |  2 +-
 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 ++----------
 app/test/test_ipfrag.c       | 12 --------
 app/test/test_lpm.c          | 15 +--------
 app/test/test_lpm6.c         | 12 --------
 app/test/test_lpm6_data.h    |  3 +-
 app/test/test_lpm6_perf.c    | 14 +--------
 app/test/test_lpm_perf.c     | 39 ++++++++----------------
 app/test/test_reorder.c      | 11 -------
 app/test/test_rib.c          | 19 ------------
 app/test/test_rib6.c         | 24 ++-------------
 drivers/net/null/meson.build |  6 ----
 drivers/net/ring/meson.build |  6 ----
 lib/fib/meson.build          |  6 ----
 lib/fib/rte_fib.c            |  1 +
 lib/fib/rte_fib6.c           |  1 +
 lib/ip_frag/ip_frag_common.h |  2 ++
 lib/ip_frag/meson.build      |  6 ----
 lib/lpm/meson.build          |  6 ----
 lib/pcapng/meson.build       |  6 ----
 lib/pcapng/rte_pcapng.c      | 59 ++++++++++++++++++++++++++++++++++--
 lib/reorder/meson.build      |  6 ----
 lib/reorder/rte_reorder.c    |  1 +
 lib/rib/meson.build          |  6 ----
 lib/rib/rte_rib.c            |  1 +
 lib/rib/rte_rib6.c           |  1 +
 29 files changed, 90 insertions(+), 255 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/8 net/null: build null PMD on Windows

Builds fine with current code, no changes needed.

---
 drivers/net/null/meson.build | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/null/meson.build +0 -6
index 4a483955a7a9..a51f8f5211b0 100644
@@ -1,11 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_null.c')
 pmd_supports_disable_iova_as_pa = true
Signature · 1 line
2.35.1
#3 lore raw

PATCH 2/8 net/ring: build on Windows

In reply to Stephen Hemminger

This driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---
 app/test/meson.build         | 2 +-
 drivers/net/ring/meson.build | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)
app/test/meson.build +1 -1
index f34d19e3c3cb..a713f0382280 100644
@@ -390,7 +390,7 @@ if dpdk_conf.has('RTE_NET_BOND')
         driver_test_names += 'link_bonding_mode4_autotest'
     endif
 endif
-if dpdk_conf.has('RTE_NET_RING')
+if dpdk_conf.has('RTE_LIB_EVENTDEV') and dpdk_conf.has('RTE_NET_RING')
     test_deps += 'net_ring'
     test_sources += 'test_pmd_ring_perf.c'
     test_sources += 'test_pmd_ring.c'
drivers/net/ring/meson.build +0 -6
index 72792e26b05a..3534a3cc2287 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
Signature · 1 line
2.35.1
#5 lore raw

Re: [PATCH 2/8] net/ring: build on Windows

In reply to Stephen Hemminger

Hi Stephen,

Thanks for enabling this support.

Quoted 5 lines · Stephen Hemminger

This driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---

There is still a build error with clang compiler on Windows as mentioned by Dmitry:

../drivers/net/ring/rte_eth_ring.c:542:12: error: use of undeclared identifier 'PATH_MAX'

        char name[PATH_MAX];
                  ^

#include <rte_os_shim.h> is missing

Quoted 1 line
#6 lore raw

Re: [PATCH 2/8] net/ring: build on Windows

Quoted 11 lines · Pallavi

Hi Stephen,

Thanks for enabling this support.

Quoted 5 lines · Stephen Hemminger

This driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---

Quoted 9 lines

There is still a build error with clang compiler on Windows as mentioned by Dmitry:

../drivers/net/ring/rte_eth_ring.c:542:12: error: use of undeclared identifier 'PATH_MAX'

         char name[PATH_MAX];
                   ^

#include <rte_os_shim.h> is missing

Quoted 1 line

It is in the mingw version but not other compilers.

#7 lore raw

Re: [PATCH 2/8] net/ring: build on Windows

Quoted 17 lines · Stephen Hemminger
Quoted 14 lines · Pallavi

Hi Stephen,

Thanks for enabling this support.

Quoted 5 lines · Stephen Hemminger

This driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---

There is still a build error with clang compiler on Windows as mentioned by Dmitry:

Quoted 8 lines
Quoted 6 lines

../drivers/net/ring/rte_eth_ring.c:542:12: error: use of undeclared identifier 'PATH_MAX'

         char name[PATH_MAX];
                   ^

#include <rte_os_shim.h> is missing

Quoted 1 line

It is in the mingw version but not other compilers.

not sure if it helps but in the sludge of my memory i think you can use MAX_PATH.

so maybe a little
#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
#endif

in the os shim?

#8 lore raw

Re: [PATCH 2/8] net/ring: build on Windows

2022-12-15 09:48 (UTC-0800), Tyler Retzlaff:

Quoted 3 lines · Stephen Hemminger
Quoted 2 lines

On Wed, 14 Dec 2022 15:18:08 -0800
"Kadam, Pallavi" <[email protected]> wrote:

[...]

Quoted 15 lines
Quoted 11 lines
Quoted 9 lines

There is still a build error with clang compiler on Windows as mentioned by Dmitry:

../drivers/net/ring/rte_eth_ring.c:542:12: error: use of undeclared identifier 'PATH_MAX'

         char name[PATH_MAX];
                   ^

#include <rte_os_shim.h> is missing

Quoted 1 line

It is in the mingw version but not other compilers.

not sure if it helps but in the sludge of my memory i think you can use MAX_PATH.

Quoted 6 lines

so maybe a little
#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
#endif

in the os shim?

It is in rte_os_shim.h already (for MinGW), just needs to be included.

#9 lore raw

PATCH 3/8 lpm: enable on Windows

In reply to Stephen Hemminger

This builds on Windows without changes.

---
 app/test/test_lpm.c       | 15 +--------------
 app/test/test_lpm6.c      | 12 ------------
 app/test/test_lpm6_data.h |  3 ++-
 app/test/test_lpm6_perf.c | 14 +-------------
 app/test/test_lpm_perf.c  | 39 ++++++++++++---------------------------
 lib/lpm/meson.build       |  6 ------
 6 files changed, 16 insertions(+), 73 deletions(-)
app/test/test_lpm.c +1 -14
index bceb9ae743d7..37b460af3a96 100644
@@ -2,18 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm(void)
-{
-	printf("lpm not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -22,6 +10,7 @@ test_lpm(void)
 #include <rte_lpm.h>
 #include <rte_malloc.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -1595,6 +1584,4 @@ test_lpm(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_autotest, test_lpm);
app/test/test_lpm6.c +0 -12
index 1f44392db739..b6b6f8615ea5 100644
@@ -10,16 +10,6 @@
 #include <string.h>
 
 #include <rte_memory.h>
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6(void)
-{
-	printf("lpm6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_lpm6.h>
 
 #include "test_lpm6_data.h"
@@ -1803,6 +1793,4 @@ test_lpm6(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_autotest, test_lpm6);
app/test/test_lpm6_data.h +2 -1
index da9b161f20e5..3a1fa25f8433 100644
@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <rte_random.h>
 
 struct rules_tbl_entry {
 	uint8_t ip[16];
@@ -1129,7 +1130,7 @@ static void generate_large_ips_table(int gen_expected_next_hop)
 
 	for (i = 0; i < NUM_IPS_ENTRIES; i++) {
 		for (j = 0; j < 16; j++)
-			large_ips_table[i].ip[j] = lrand48();
+			large_ips_table[i].ip[j] = rte_rand();
 	}
 
 	for (k = j = 0, i = 0; i < NUM_IPS_ENTRIES; i++) {
app/test/test_lpm6_perf.c +1 -13
index aaf2773b6fac..5b684686a687 100644
@@ -2,17 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6_perf(void)
-{
-	printf("lpm6_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 
 #include <stdio.h>
 #include <stdint.h>
@@ -24,6 +13,7 @@ test_lpm6_perf(void)
 #include <rte_memory.h>
 #include <rte_lpm6.h>
 
+#include "test.h"
 #include "test_lpm6_data.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -171,6 +161,4 @@ test_lpm6_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf);
app/test/test_lpm_perf.c +12 -27
index e858716f909b..e72437ba3850 100644
@@ -3,17 +3,6 @@
  * Copyright(c) 2020 Arm Limited
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm_perf(void)
-{
-	printf("lpm_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -25,7 +14,9 @@ test_lpm_perf(void)
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_lpm.h>
+#include <rte_spinlock.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 struct rte_lpm *lpm;
@@ -34,8 +25,9 @@ static volatile uint8_t writer_done;
 static volatile uint32_t thr_id;
 static uint64_t gwrite_cycles;
 static uint32_t num_writers;
-/* LPM APIs are not thread safe, use mutex to provide thread safety */
-static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* LPM APIs are not thread safe, use spinlock */
+static rte_spinlock_t lpm_lock = RTE_SPINLOCK_INITIALIZER;
 
 /* Report quiescent state interval every 1024 lookups. Larger critical
  * sections in reader will result in writer polling multiple times.
@@ -267,7 +259,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];
 	ptr_ldepth_rule = &large_ldepth_route_table[num_ldepth_route_entries];
 	for (k = 0; k < rule_num; k++) {
@@ -296,7 +288,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));
 
@@ -452,8 +444,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	for (i = 0; i < RCU_ITERATIONS; i++) {
 		/* Add all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_add(lpm, large_ldepth_route_table[j].ip,
 					large_ldepth_route_table[j].depth,
 					next_hop_add) != 0) {
@@ -461,22 +452,19 @@ test_lpm_rcu_qsbr_writer(void *arg)
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 
 		/* Delete all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_delete(lpm, large_ldepth_route_table[j].ip,
 				large_ldepth_route_table[j].depth) != 0) {
 				printf("Failed to delete iteration %d, route# %d\n",
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 	}
 
@@ -487,8 +475,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	return 0;
 
 error:
-	if (num_writers > 1)
-		pthread_mutex_unlock(&lpm_mutex);
+	rte_spinlock_unlock(&lpm_lock);
 	return -1;
 }
 
@@ -773,6 +760,4 @@ test_lpm_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_perf_autotest, test_lpm_perf);
lib/lpm/meson.build +0 -6
index 6b47361fcec0..4cd48886fc41 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_lpm.c', 'rte_lpm6.c')
 headers = files('rte_lpm.h', 'rte_lpm6.h')
 # since header files have different names, we can install all vector headers
Signature · 1 line
2.35.1
#11 lore raw

PATCH 4/8 reorder: build on Windows

In reply to Stephen Hemminger

This builds on Windows if sys/queue.h is included.

---
 app/test/test_reorder.c   | 11 -----------
 lib/reorder/meson.build   |  6 ------
 lib/reorder/rte_reorder.c |  1 +
 3 files changed, 1 insertion(+), 17 deletions(-)
app/test/test_reorder.c +0 -11
index f0714a5c18a3..9ebd91477536 100644
@@ -11,16 +11,6 @@
 #include <rte_cycles.h>
 #include <rte_errno.h>
 #include <rte_mbuf.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_reorder(void)
-{
-	printf("reorder not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_reorder.h>
 #include <rte_lcore.h>
 #include <rte_malloc.h>
@@ -395,6 +385,5 @@ test_reorder(void)
 	return unit_test_suite_runner(&reorder_test_suite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(reorder_autotest, test_reorder);
lib/reorder/meson.build +0 -6
index 621c1f350103..03aed53d9007 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_reorder.c')
 headers = files('rte_reorder.h')
 deps += ['mbuf']
lib/reorder/rte_reorder.c +1 -0
index 385ee479da42..00e2cf043e04 100644
@@ -3,6 +3,7 @@
  */
 
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
Signature · 1 line
2.35.1
#13 lore raw

PATCH 5/8 ip_frag: enable build on Windows

In reply to Stephen Hemminger

This build works on Windows if sys/queue.h is included.

---
 app/test/test_ipfrag.c       | 12 ------------
 lib/ip_frag/ip_frag_common.h |  2 ++
 lib/ip_frag/meson.build      |  6 ------
 3 files changed, 2 insertions(+), 18 deletions(-)
app/test/test_ipfrag.c +0 -12
index 88cc4cdeea8d..402ce361c1a2 100644
@@ -10,17 +10,6 @@
 #include <rte_cycles.h>
 #include <rte_hexdump.h>
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_ipfrag(void)
-{
-	printf("ipfrag not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_ip_frag.h>
 #include <rte_mbuf.h>
 #include <rte_random.h>
@@ -520,6 +509,5 @@ test_ipfrag(void)
 	return unit_test_suite_runner(&ipfrag_testsuite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(ipfrag_autotest, test_ipfrag);
lib/ip_frag/ip_frag_common.h +2 -0
index 9c0dbdeb6eb9..0f4ad72a90d9 100644
@@ -8,6 +8,8 @@
 #include "rte_ip_frag.h"
 #include "ip_reassembly.h"
 
+#include <sys/queue.h>
+
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
 #define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, USER1, fmt, ##args)
lib/ip_frag/meson.build +0 -6
index 3a252bdaf6a4..ea2de09f7528 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_ipv4_fragmentation.c',
         'rte_ipv6_fragmentation.c',
Signature · 1 line
2.35.1
#15 lore raw

PATCH 6/8 rib: enable on Windows

In reply to Stephen Hemminger

The RIB library builds on Windows as long as sys/queue.h is included

---
 app/test/test_rib.c  | 19 -------------------
 app/test/test_rib6.c | 24 ++----------------------
 lib/rib/meson.build  |  6 ------
 lib/rib/rte_rib.c    |  1 +
 lib/rib/rte_rib6.c   |  1 +
 5 files changed, 4 insertions(+), 47 deletions(-)
app/test/test_rib.c +0 -19
index 06058f8f7c52..65b685641094 100644
@@ -10,23 +10,6 @@
 #include <stdlib.h>
 
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib(void)
-{
-	printf("rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib(void)
-{
-	printf("slow_rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib.h>
 
 typedef int32_t (*rte_rib_test)(void);
@@ -380,7 +363,5 @@ test_slow_rib(void)
 	return unit_test_suite_runner(&rib_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib_autotest, test_rib);
 REGISTER_TEST_COMMAND(rib_slow_autotest, test_slow_rib);
app/test/test_rib6.c +2 -22
index ba79aedea5f7..336b779d2e1e 100644
@@ -3,32 +3,14 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "test.h"
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
-
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib6(void)
-{
-	printf("rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib6(void)
-{
-	printf("slow_rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib6.h>
 
+#include "test.h"
+
 typedef int32_t (*rte_rib6_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -385,7 +367,5 @@ test_slow_rib6(void)
 	return unit_test_suite_runner(&rib6_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib6_autotest, test_rib6);
 REGISTER_TEST_COMMAND(rib6_slow_autotest, test_slow_rib6);
lib/rib/meson.build +0 -6
index bda7f576e976..7bacbb453592 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # Copyright(c) 2019 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_rib.c', 'rte_rib6.c')
 headers = files('rte_rib.h', 'rte_rib6.h')
 deps += ['mempool']
lib/rib/rte_rib.c +1 -0
index b0794edf66f5..812a2597d117 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/rib/rte_rib6.c +1 -0
index 19e4ff97c479..ae44281ae105 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
Signature · 1 line
2.35.1
#17 lore raw

PATCH 7/8 fib: enable on Windows

In reply to Stephen Hemminger

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

---
 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(-)
app/test/test_fib.c +1 -21
index a2d1ea8f3abc..eb69d6e2fd4c 100644
@@ -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);
app/test/test_fib6.c +2 -22
index cd971e6ecdfb..15ad09178ae2 100644
@@ -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);
app/test/test_fib6_perf.c +1 -14
index 21d2b65318e9..add20c2331b1 100644
@@ -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);
app/test/test_fib_perf.c +3 -16
index 9787874cc9b7..b56293e64f41 100644
@@ -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);
lib/fib/meson.build +0 -6
index 9b848d08417c..ddcae0617a73 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # 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']
lib/fib/rte_fib.c +1 -0
index 8af4c4091908..0c3b20e00a5a 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/fib/rte_fib6.c +1 -0
index 4b8e22b142b9..28c69b38999f 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
Signature · 1 line
2.35.1
#19 lore raw

PATCH 8/8 pcapng: windows compatability

In reply to Stephen Hemminger

Allow building on Windows, need to provide some compatability wrappers for writev() and if_nametoindex.

---
 lib/pcapng/meson.build  |  6 -----
 lib/pcapng/rte_pcapng.c | 59 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 8 deletions(-)
lib/pcapng/meson.build +0 -6
index da938bbcb733..4549925d41b6 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Microsoft Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_pcapng.c')
 headers = files('rte_pcapng.h')
 
lib/pcapng/rte_pcapng.c +57 -2

84 lines not on this page · raw message

Signature · 1 line
2.35.1
#21 lore raw

v2 cover Enable building more libraries on Windows

In reply to Stephen Hemminger

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

v2 - fix unnecessary PATH_MAX in net/ring driver

 app/test/meson.build            |  2 +-
 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 ++---------
 app/test/test_ipfrag.c          | 12 -------
 app/test/test_lpm.c             | 15 +--------
 app/test/test_lpm6.c            | 12 -------
 app/test/test_lpm6_data.h       |  3 +-
 app/test/test_lpm6_perf.c       | 14 +-------
 app/test/test_lpm_perf.c        | 39 +++++++---------------
 app/test/test_reorder.c         | 11 ------
 app/test/test_rib.c             | 19 -----------
 app/test/test_rib6.c            | 24 ++------------
 drivers/net/null/meson.build    |  6 ----
 drivers/net/ring/meson.build    |  6 ----
 drivers/net/ring/rte_eth_ring.c |  3 +-
 lib/fib/meson.build             |  6 ----
 lib/fib/rte_fib.c               |  1 +
 lib/fib/rte_fib6.c              |  1 +
 lib/ip_frag/ip_frag_common.h    |  2 ++
 lib/ip_frag/meson.build         |  6 ----
 lib/lpm/meson.build             |  6 ----
 lib/pcapng/meson.build          |  6 ----
 lib/pcapng/rte_pcapng.c         | 59 +++++++++++++++++++++++++++++++--
 lib/reorder/meson.build         |  6 ----
 lib/reorder/rte_reorder.c       |  1 +
 lib/rib/meson.build             |  6 ----
 lib/rib/rte_rib.c               |  1 +
 lib/rib/rte_rib6.c              |  1 +
 30 files changed, 92 insertions(+), 256 deletions(-)
Signature · 1 line
2.39.1
#22 lore raw

PATCH v2 1/8 net/null: build null PMD on Windows

Builds fine with current code, no changes needed.

---
 drivers/net/null/meson.build | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/null/meson.build +0 -6
index 4a483955a7a9..a51f8f5211b0 100644
@@ -1,11 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_null.c')
 pmd_supports_disable_iova_as_pa = true
Signature · 1 line
2.39.1
#23 lore raw

PATCH v2 2/8 net/ring: build on Windows

In reply to Stephen Hemminger

The command line arguments are stored in node_action_pair and the name[] was sized to PATH_MAX which does not exist on Windows. Since the name is either "CREATE" or "ATTACH" it is not related to PATH_MAX (4096).

With this fix driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---
 app/test/meson.build            | 2 +-
 drivers/net/ring/meson.build    | 6 ------
 drivers/net/ring/rte_eth_ring.c | 3 ++-
 3 files changed, 3 insertions(+), 8 deletions(-)
app/test/meson.build +1 -1
index f34d19e3c3cb..a713f0382280 100644
@@ -390,7 +390,7 @@ if dpdk_conf.has('RTE_NET_BOND')
         driver_test_names += 'link_bonding_mode4_autotest'
     endif
 endif
-if dpdk_conf.has('RTE_NET_RING')
+if dpdk_conf.has('RTE_LIB_EVENTDEV') and dpdk_conf.has('RTE_NET_RING')
     test_deps += 'net_ring'
     test_sources += 'test_pmd_ring_perf.c'
     test_sources += 'test_pmd_ring.c'
drivers/net/ring/meson.build +0 -6
index 72792e26b05a..3534a3cc2287 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
drivers/net/ring/rte_eth_ring.c +2 -1
index bd5a47dd9017..564d6a726403 100644
@@ -17,6 +17,7 @@
 #define ETH_RING_NUMA_NODE_ACTION_ARG	"nodeaction"
 #define ETH_RING_ACTION_CREATE		"CREATE"
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
+#define ETH_RING_ACTION_MAX_LEN		8 /* CREATE | ACTION */
 #define ETH_RING_INTERNAL_ARG		"internal"
 #define ETH_RING_INTERNAL_ARG_MAX_LEN	19 /* "0x..16chars..\0" */
 
@@ -539,7 +540,7 @@ eth_dev_ring_create(const char *name,
 }
 
 struct node_action_pair {
-	char name[PATH_MAX];
+	char name[ETH_RING_ACTION_MAX_LEN];
 	unsigned int node;
 	enum dev_action action;
 };
Signature · 1 line
2.39.1
#24 lore raw

PATCH v2 3/8 lpm: enable on Windows

In reply to Stephen Hemminger

This builds on Windows without changes.

---
 app/test/test_lpm.c       | 15 +--------------
 app/test/test_lpm6.c      | 12 ------------
 app/test/test_lpm6_data.h |  3 ++-
 app/test/test_lpm6_perf.c | 14 +-------------
 app/test/test_lpm_perf.c  | 39 ++++++++++++---------------------------
 lib/lpm/meson.build       |  6 ------
 6 files changed, 16 insertions(+), 73 deletions(-)
app/test/test_lpm.c +1 -14
index bceb9ae743d7..37b460af3a96 100644
@@ -2,18 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm(void)
-{
-	printf("lpm not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -22,6 +10,7 @@ test_lpm(void)
 #include <rte_lpm.h>
 #include <rte_malloc.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -1595,6 +1584,4 @@ test_lpm(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_autotest, test_lpm);
app/test/test_lpm6.c +0 -12
index 1f44392db739..b6b6f8615ea5 100644
@@ -10,16 +10,6 @@
 #include <string.h>
 
 #include <rte_memory.h>
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6(void)
-{
-	printf("lpm6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_lpm6.h>
 
 #include "test_lpm6_data.h"
@@ -1803,6 +1793,4 @@ test_lpm6(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_autotest, test_lpm6);
app/test/test_lpm6_data.h +2 -1
index da9b161f20e5..3a1fa25f8433 100644
@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <rte_random.h>
 
 struct rules_tbl_entry {
 	uint8_t ip[16];
@@ -1129,7 +1130,7 @@ static void generate_large_ips_table(int gen_expected_next_hop)
 
 	for (i = 0; i < NUM_IPS_ENTRIES; i++) {
 		for (j = 0; j < 16; j++)
-			large_ips_table[i].ip[j] = lrand48();
+			large_ips_table[i].ip[j] = rte_rand();
 	}
 
 	for (k = j = 0, i = 0; i < NUM_IPS_ENTRIES; i++) {
app/test/test_lpm6_perf.c +1 -13
index aaf2773b6fac..5b684686a687 100644
@@ -2,17 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6_perf(void)
-{
-	printf("lpm6_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 
 #include <stdio.h>
 #include <stdint.h>
@@ -24,6 +13,7 @@ test_lpm6_perf(void)
 #include <rte_memory.h>
 #include <rte_lpm6.h>
 
+#include "test.h"
 #include "test_lpm6_data.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -171,6 +161,4 @@ test_lpm6_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf);
app/test/test_lpm_perf.c +12 -27
index e858716f909b..e72437ba3850 100644
@@ -3,17 +3,6 @@
  * Copyright(c) 2020 Arm Limited
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm_perf(void)
-{
-	printf("lpm_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -25,7 +14,9 @@ test_lpm_perf(void)
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_lpm.h>
+#include <rte_spinlock.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 struct rte_lpm *lpm;
@@ -34,8 +25,9 @@ static volatile uint8_t writer_done;
 static volatile uint32_t thr_id;
 static uint64_t gwrite_cycles;
 static uint32_t num_writers;
-/* LPM APIs are not thread safe, use mutex to provide thread safety */
-static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* LPM APIs are not thread safe, use spinlock */
+static rte_spinlock_t lpm_lock = RTE_SPINLOCK_INITIALIZER;
 
 /* Report quiescent state interval every 1024 lookups. Larger critical
  * sections in reader will result in writer polling multiple times.
@@ -267,7 +259,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];
 	ptr_ldepth_rule = &large_ldepth_route_table[num_ldepth_route_entries];
 	for (k = 0; k < rule_num; k++) {
@@ -296,7 +288,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));
 
@@ -452,8 +444,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	for (i = 0; i < RCU_ITERATIONS; i++) {
 		/* Add all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_add(lpm, large_ldepth_route_table[j].ip,
 					large_ldepth_route_table[j].depth,
 					next_hop_add) != 0) {
@@ -461,22 +452,19 @@ test_lpm_rcu_qsbr_writer(void *arg)
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 
 		/* Delete all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_delete(lpm, large_ldepth_route_table[j].ip,
 				large_ldepth_route_table[j].depth) != 0) {
 				printf("Failed to delete iteration %d, route# %d\n",
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 	}
 
@@ -487,8 +475,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	return 0;
 
 error:
-	if (num_writers > 1)
-		pthread_mutex_unlock(&lpm_mutex);
+	rte_spinlock_unlock(&lpm_lock);
 	return -1;
 }
 
@@ -773,6 +760,4 @@ test_lpm_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_perf_autotest, test_lpm_perf);
lib/lpm/meson.build +0 -6
index 6b47361fcec0..4cd48886fc41 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_lpm.c', 'rte_lpm6.c')
 headers = files('rte_lpm.h', 'rte_lpm6.h')
 # since header files have different names, we can install all vector headers
Signature · 1 line
2.39.1
#25 lore raw

PATCH v2 4/8 reorder: build on Windows

In reply to Stephen Hemminger

This builds on Windows if sys/queue.h is included.

---
 app/test/test_reorder.c   | 11 -----------
 lib/reorder/meson.build   |  6 ------
 lib/reorder/rte_reorder.c |  1 +
 3 files changed, 1 insertion(+), 17 deletions(-)
app/test/test_reorder.c +0 -11
index f0714a5c18a3..9ebd91477536 100644
@@ -11,16 +11,6 @@
 #include <rte_cycles.h>
 #include <rte_errno.h>
 #include <rte_mbuf.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_reorder(void)
-{
-	printf("reorder not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_reorder.h>
 #include <rte_lcore.h>
 #include <rte_malloc.h>
@@ -395,6 +385,5 @@ test_reorder(void)
 	return unit_test_suite_runner(&reorder_test_suite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(reorder_autotest, test_reorder);
lib/reorder/meson.build +0 -6
index 621c1f350103..03aed53d9007 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_reorder.c')
 headers = files('rte_reorder.h')
 deps += ['mbuf']
lib/reorder/rte_reorder.c +1 -0
index 385ee479da42..00e2cf043e04 100644
@@ -3,6 +3,7 @@
  */
 
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
Signature · 1 line
2.39.1
#26 lore raw

PATCH v2 5/8 ip_frag: enable build on Windows

In reply to Stephen Hemminger

This build works on Windows if sys/queue.h is included.

---
 app/test/test_ipfrag.c       | 12 ------------
 lib/ip_frag/ip_frag_common.h |  2 ++
 lib/ip_frag/meson.build      |  6 ------
 3 files changed, 2 insertions(+), 18 deletions(-)
app/test/test_ipfrag.c +0 -12
index 88cc4cdeea8d..402ce361c1a2 100644
@@ -10,17 +10,6 @@
 #include <rte_cycles.h>
 #include <rte_hexdump.h>
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_ipfrag(void)
-{
-	printf("ipfrag not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_ip_frag.h>
 #include <rte_mbuf.h>
 #include <rte_random.h>
@@ -520,6 +509,5 @@ test_ipfrag(void)
 	return unit_test_suite_runner(&ipfrag_testsuite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(ipfrag_autotest, test_ipfrag);
lib/ip_frag/ip_frag_common.h +2 -0
index 9c0dbdeb6eb9..0f4ad72a90d9 100644
@@ -8,6 +8,8 @@
 #include "rte_ip_frag.h"
 #include "ip_reassembly.h"
 
+#include <sys/queue.h>
+
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
 #define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, USER1, fmt, ##args)
lib/ip_frag/meson.build +0 -6
index 3a252bdaf6a4..ea2de09f7528 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_ipv4_fragmentation.c',
         'rte_ipv6_fragmentation.c',
Signature · 1 line
2.39.1
#27 lore raw

PATCH v2 6/8 rib: enable on Windows

In reply to Stephen Hemminger

The RIB library builds on Windows as long as sys/queue.h is included

---
 app/test/test_rib.c  | 19 -------------------
 app/test/test_rib6.c | 24 ++----------------------
 lib/rib/meson.build  |  6 ------
 lib/rib/rte_rib.c    |  1 +
 lib/rib/rte_rib6.c   |  1 +
 5 files changed, 4 insertions(+), 47 deletions(-)
app/test/test_rib.c +0 -19
index 06058f8f7c52..65b685641094 100644
@@ -10,23 +10,6 @@
 #include <stdlib.h>
 
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib(void)
-{
-	printf("rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib(void)
-{
-	printf("slow_rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib.h>
 
 typedef int32_t (*rte_rib_test)(void);
@@ -380,7 +363,5 @@ test_slow_rib(void)
 	return unit_test_suite_runner(&rib_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib_autotest, test_rib);
 REGISTER_TEST_COMMAND(rib_slow_autotest, test_slow_rib);
app/test/test_rib6.c +2 -22
index ba79aedea5f7..336b779d2e1e 100644
@@ -3,32 +3,14 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "test.h"
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
-
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib6(void)
-{
-	printf("rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib6(void)
-{
-	printf("slow_rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib6.h>
 
+#include "test.h"
+
 typedef int32_t (*rte_rib6_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -385,7 +367,5 @@ test_slow_rib6(void)
 	return unit_test_suite_runner(&rib6_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib6_autotest, test_rib6);
 REGISTER_TEST_COMMAND(rib6_slow_autotest, test_slow_rib6);
lib/rib/meson.build +0 -6
index bda7f576e976..7bacbb453592 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # Copyright(c) 2019 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_rib.c', 'rte_rib6.c')
 headers = files('rte_rib.h', 'rte_rib6.h')
 deps += ['mempool']
lib/rib/rte_rib.c +1 -0
index b0794edf66f5..812a2597d117 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/rib/rte_rib6.c +1 -0
index 19e4ff97c479..ae44281ae105 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
Signature · 1 line
2.39.1
#28 lore raw

PATCH v2 7/8 fib: enable on Windows

In reply to Stephen Hemminger

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

---
 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(-)
app/test/test_fib.c +1 -21
index a2d1ea8f3abc..eb69d6e2fd4c 100644
@@ -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);
app/test/test_fib6.c +2 -22
index cd971e6ecdfb..15ad09178ae2 100644
@@ -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);
app/test/test_fib6_perf.c +1 -14
index 21d2b65318e9..add20c2331b1 100644
@@ -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);
app/test/test_fib_perf.c +3 -16
index 9787874cc9b7..b56293e64f41 100644
@@ -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);
lib/fib/meson.build +0 -6
index 9b848d08417c..ddcae0617a73 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # 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']
lib/fib/rte_fib.c +1 -0
index 8af4c4091908..0c3b20e00a5a 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/fib/rte_fib6.c +1 -0
index 4b8e22b142b9..28c69b38999f 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
Signature · 1 line
2.39.1
#29 lore raw

PATCH v2 8/8 pcapng: windows compatibility

In reply to Stephen Hemminger

Allow building on Windows, need to provide some comparability wrappers for writev() and if_nametoindex.

---
 lib/pcapng/meson.build  |  6 -----
 lib/pcapng/rte_pcapng.c | 59 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 8 deletions(-)
lib/pcapng/meson.build +0 -6
index da938bbcb733..4549925d41b6 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Microsoft Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_pcapng.c')
 headers = files('rte_pcapng.h')
 
lib/pcapng/rte_pcapng.c +57 -2

84 lines not on this page · raw message

Signature · 1 line
2.39.1
Acked-by on the v2 series
#30 lore raw

Re: [PATCH v2 0/8] Enable building more libraries on Windows

In reply to Stephen Hemminger

2023-02-06 16:19 (UTC-0800), Stephen Hemminger:

Quoted 14 lines

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

Quoted 1 line

v2 - fix unnecessary PATH_MAX in net/ring driver

Looks like #include <rte_os_shim.h> is still needed in rte_eth_ring.h to avoid the fatal warning about strdup() with clang (MS CRT, actually). For the series,

#31 lore raw

Re: [PATCH v2 0/8] Enable building more libraries on Windows

Hello Stephen,

Quoted 16 lines · Dmitry Kozlyuk

2023-02-06 16:19 (UTC-0800), Stephen Hemminger:

Quoted 14 lines

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

Quoted 4 lines
Quoted 1 line

v2 - fix unnecessary PATH_MAX in net/ring driver

Looks like #include <rte_os_shim.h> is still needed in rte_eth_ring.h to avoid the fatal warning about strdup() with clang (MS CRT, actually).

We need a new revision.
Thanks.

Signature · 1 line
David Marchand
#32 lore raw

v3 cover Enable building more libraries on Windows

In reply to Stephen Hemminger

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

v3 - add rte_os_shim.h to rte_ring to fix use of
strdup() breaking with stricter MS compiler

v2 - fix unnecessary PATH_MAX in net/ring driver

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

 app/test/meson.build            |  2 +-
 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 ++---------
 app/test/test_ipfrag.c          | 12 -------
 app/test/test_lpm.c             | 15 +--------
 app/test/test_lpm6.c            | 12 -------
 app/test/test_lpm6_data.h       |  3 +-
 app/test/test_lpm6_perf.c       | 14 +-------
 app/test/test_lpm_perf.c        | 39 +++++++---------------
 app/test/test_reorder.c         | 11 ------
 app/test/test_rib.c             | 19 -----------
 app/test/test_rib6.c            | 24 ++------------
 drivers/net/null/meson.build    |  6 ----
 drivers/net/ring/meson.build    |  6 ----
 drivers/net/ring/rte_eth_ring.c |  4 ++-
 lib/fib/meson.build             |  6 ----
 lib/fib/rte_fib.c               |  1 +
 lib/fib/rte_fib6.c              |  1 +
 lib/ip_frag/ip_frag_common.h    |  2 ++
 lib/ip_frag/meson.build         |  6 ----
 lib/lpm/meson.build             |  6 ----
 lib/pcapng/meson.build          |  6 ----
 lib/pcapng/rte_pcapng.c         | 59 +++++++++++++++++++++++++++++++--
 lib/reorder/meson.build         |  6 ----
 lib/reorder/rte_reorder.c       |  1 +
 lib/rib/meson.build             |  6 ----
 lib/rib/rte_rib.c               |  1 +
 lib/rib/rte_rib6.c              |  1 +
 30 files changed, 93 insertions(+), 256 deletions(-)
Signature · 1 line
2.39.1
#33 lore raw

PATCH v3 1/8 net/null: build null PMD on Windows

Builds fine with current code, no changes needed.

---
 drivers/net/null/meson.build | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/null/meson.build +0 -6
index 4a483955a7a9..a51f8f5211b0 100644
@@ -1,11 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_null.c')
 pmd_supports_disable_iova_as_pa = true
Signature · 1 line
2.39.1
#34 lore raw

PATCH v3 2/8 net/ring: build on Windows

In reply to Stephen Hemminger

The command line arguments are stored in node_action_pair and the name[] was sized to PATH_MAX which does not exist on Windows. Since the name is either "CREATE" or "ATTACH" it is not related to PATH_MAX (4096).

With this fix driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---
 app/test/meson.build            | 2 +-
 drivers/net/ring/meson.build    | 6 ------
 drivers/net/ring/rte_eth_ring.c | 4 +++-
 3 files changed, 4 insertions(+), 8 deletions(-)
app/test/meson.build +1 -1
index f34d19e3c3cb..a713f0382280 100644
@@ -390,7 +390,7 @@ if dpdk_conf.has('RTE_NET_BOND')
         driver_test_names += 'link_bonding_mode4_autotest'
     endif
 endif
-if dpdk_conf.has('RTE_NET_RING')
+if dpdk_conf.has('RTE_LIB_EVENTDEV') and dpdk_conf.has('RTE_NET_RING')
     test_deps += 'net_ring'
     test_sources += 'test_pmd_ring_perf.c'
     test_sources += 'test_pmd_ring.c'
drivers/net/ring/meson.build +0 -6
index 72792e26b05a..3534a3cc2287 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
drivers/net/ring/rte_eth_ring.c +3 -1
index bd5a47dd9017..e8bc9b627102 100644
@@ -9,6 +9,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_os_shim.h>
 #include <rte_string_fns.h>
 #include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
@@ -17,6 +18,7 @@
 #define ETH_RING_NUMA_NODE_ACTION_ARG	"nodeaction"
 #define ETH_RING_ACTION_CREATE		"CREATE"
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
+#define ETH_RING_ACTION_MAX_LEN		8 /* CREATE | ACTION */
 #define ETH_RING_INTERNAL_ARG		"internal"
 #define ETH_RING_INTERNAL_ARG_MAX_LEN	19 /* "0x..16chars..\0" */
 
@@ -539,7 +541,7 @@ eth_dev_ring_create(const char *name,
 }
 
 struct node_action_pair {
-	char name[PATH_MAX];
+	char name[ETH_RING_ACTION_MAX_LEN];
 	unsigned int node;
 	enum dev_action action;
 };
Signature · 1 line
2.39.1
#35 lore raw

PATCH v3 3/8 lpm: enable on Windows

In reply to Stephen Hemminger

This builds on Windows without changes.

---
 app/test/test_lpm.c       | 15 +--------------
 app/test/test_lpm6.c      | 12 ------------
 app/test/test_lpm6_data.h |  3 ++-
 app/test/test_lpm6_perf.c | 14 +-------------
 app/test/test_lpm_perf.c  | 39 ++++++++++++---------------------------
 lib/lpm/meson.build       |  6 ------
 6 files changed, 16 insertions(+), 73 deletions(-)
app/test/test_lpm.c +1 -14
index bceb9ae743d7..37b460af3a96 100644
@@ -2,18 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm(void)
-{
-	printf("lpm not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -22,6 +10,7 @@ test_lpm(void)
 #include <rte_lpm.h>
 #include <rte_malloc.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -1595,6 +1584,4 @@ test_lpm(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_autotest, test_lpm);
app/test/test_lpm6.c +0 -12
index 1f44392db739..b6b6f8615ea5 100644
@@ -10,16 +10,6 @@
 #include <string.h>
 
 #include <rte_memory.h>
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6(void)
-{
-	printf("lpm6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_lpm6.h>
 
 #include "test_lpm6_data.h"
@@ -1803,6 +1793,4 @@ test_lpm6(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_autotest, test_lpm6);
app/test/test_lpm6_data.h +2 -1
index da9b161f20e5..3a1fa25f8433 100644
@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <rte_random.h>
 
 struct rules_tbl_entry {
 	uint8_t ip[16];
@@ -1129,7 +1130,7 @@ static void generate_large_ips_table(int gen_expected_next_hop)
 
 	for (i = 0; i < NUM_IPS_ENTRIES; i++) {
 		for (j = 0; j < 16; j++)
-			large_ips_table[i].ip[j] = lrand48();
+			large_ips_table[i].ip[j] = rte_rand();
 	}
 
 	for (k = j = 0, i = 0; i < NUM_IPS_ENTRIES; i++) {
app/test/test_lpm6_perf.c +1 -13
index aaf2773b6fac..5b684686a687 100644
@@ -2,17 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6_perf(void)
-{
-	printf("lpm6_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 
 #include <stdio.h>
 #include <stdint.h>
@@ -24,6 +13,7 @@ test_lpm6_perf(void)
 #include <rte_memory.h>
 #include <rte_lpm6.h>
 
+#include "test.h"
 #include "test_lpm6_data.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -171,6 +161,4 @@ test_lpm6_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf);
app/test/test_lpm_perf.c +12 -27
index e858716f909b..e72437ba3850 100644
@@ -3,17 +3,6 @@
  * Copyright(c) 2020 Arm Limited
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm_perf(void)
-{
-	printf("lpm_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -25,7 +14,9 @@ test_lpm_perf(void)
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_lpm.h>
+#include <rte_spinlock.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 struct rte_lpm *lpm;
@@ -34,8 +25,9 @@ static volatile uint8_t writer_done;
 static volatile uint32_t thr_id;
 static uint64_t gwrite_cycles;
 static uint32_t num_writers;
-/* LPM APIs are not thread safe, use mutex to provide thread safety */
-static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* LPM APIs are not thread safe, use spinlock */
+static rte_spinlock_t lpm_lock = RTE_SPINLOCK_INITIALIZER;
 
 /* Report quiescent state interval every 1024 lookups. Larger critical
  * sections in reader will result in writer polling multiple times.
@@ -267,7 +259,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];
 	ptr_ldepth_rule = &large_ldepth_route_table[num_ldepth_route_entries];
 	for (k = 0; k < rule_num; k++) {
@@ -296,7 +288,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));
 
@@ -452,8 +444,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	for (i = 0; i < RCU_ITERATIONS; i++) {
 		/* Add all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_add(lpm, large_ldepth_route_table[j].ip,
 					large_ldepth_route_table[j].depth,
 					next_hop_add) != 0) {
@@ -461,22 +452,19 @@ test_lpm_rcu_qsbr_writer(void *arg)
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 
 		/* Delete all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_delete(lpm, large_ldepth_route_table[j].ip,
 				large_ldepth_route_table[j].depth) != 0) {
 				printf("Failed to delete iteration %d, route# %d\n",
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 	}
 
@@ -487,8 +475,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	return 0;
 
 error:
-	if (num_writers > 1)
-		pthread_mutex_unlock(&lpm_mutex);
+	rte_spinlock_unlock(&lpm_lock);
 	return -1;
 }
 
@@ -773,6 +760,4 @@ test_lpm_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_perf_autotest, test_lpm_perf);
lib/lpm/meson.build +0 -6
index 6b47361fcec0..4cd48886fc41 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_lpm.c', 'rte_lpm6.c')
 headers = files('rte_lpm.h', 'rte_lpm6.h')
 # since header files have different names, we can install all vector headers
Signature · 1 line
2.39.1
#36 lore raw

PATCH v3 4/8 reorder: build on Windows

In reply to Stephen Hemminger

This builds on Windows if sys/queue.h is included.

---
 app/test/test_reorder.c   | 11 -----------
 lib/reorder/meson.build   |  6 ------
 lib/reorder/rte_reorder.c |  1 +
 3 files changed, 1 insertion(+), 17 deletions(-)
app/test/test_reorder.c +0 -11
index f0714a5c18a3..9ebd91477536 100644
@@ -11,16 +11,6 @@
 #include <rte_cycles.h>
 #include <rte_errno.h>
 #include <rte_mbuf.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_reorder(void)
-{
-	printf("reorder not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_reorder.h>
 #include <rte_lcore.h>
 #include <rte_malloc.h>
@@ -395,6 +385,5 @@ test_reorder(void)
 	return unit_test_suite_runner(&reorder_test_suite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(reorder_autotest, test_reorder);
lib/reorder/meson.build +0 -6
index 621c1f350103..03aed53d9007 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_reorder.c')
 headers = files('rte_reorder.h')
 deps += ['mbuf']
lib/reorder/rte_reorder.c +1 -0
index 385ee479da42..00e2cf043e04 100644
@@ -3,6 +3,7 @@
  */
 
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
Signature · 1 line
2.39.1
#37 lore raw

PATCH v3 5/8 ip_frag: enable build on Windows

In reply to Stephen Hemminger

This build works on Windows if sys/queue.h is included.

---
 app/test/test_ipfrag.c       | 12 ------------
 lib/ip_frag/ip_frag_common.h |  2 ++
 lib/ip_frag/meson.build      |  6 ------
 3 files changed, 2 insertions(+), 18 deletions(-)
app/test/test_ipfrag.c +0 -12
index 88cc4cdeea8d..402ce361c1a2 100644
@@ -10,17 +10,6 @@
 #include <rte_cycles.h>
 #include <rte_hexdump.h>
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_ipfrag(void)
-{
-	printf("ipfrag not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_ip_frag.h>
 #include <rte_mbuf.h>
 #include <rte_random.h>
@@ -520,6 +509,5 @@ test_ipfrag(void)
 	return unit_test_suite_runner(&ipfrag_testsuite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(ipfrag_autotest, test_ipfrag);
lib/ip_frag/ip_frag_common.h +2 -0
index 9c0dbdeb6eb9..0f4ad72a90d9 100644
@@ -8,6 +8,8 @@
 #include "rte_ip_frag.h"
 #include "ip_reassembly.h"
 
+#include <sys/queue.h>
+
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
 #define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, USER1, fmt, ##args)
lib/ip_frag/meson.build +0 -6
index 3a252bdaf6a4..ea2de09f7528 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_ipv4_fragmentation.c',
         'rte_ipv6_fragmentation.c',
Signature · 1 line
2.39.1
#38 lore raw

PATCH v3 6/8 rib: enable on Windows

In reply to Stephen Hemminger

The RIB library builds on Windows as long as sys/queue.h is included

---
 app/test/test_rib.c  | 19 -------------------
 app/test/test_rib6.c | 24 ++----------------------
 lib/rib/meson.build  |  6 ------
 lib/rib/rte_rib.c    |  1 +
 lib/rib/rte_rib6.c   |  1 +
 5 files changed, 4 insertions(+), 47 deletions(-)
app/test/test_rib.c +0 -19
index 06058f8f7c52..65b685641094 100644
@@ -10,23 +10,6 @@
 #include <stdlib.h>
 
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib(void)
-{
-	printf("rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib(void)
-{
-	printf("slow_rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib.h>
 
 typedef int32_t (*rte_rib_test)(void);
@@ -380,7 +363,5 @@ test_slow_rib(void)
 	return unit_test_suite_runner(&rib_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib_autotest, test_rib);
 REGISTER_TEST_COMMAND(rib_slow_autotest, test_slow_rib);
app/test/test_rib6.c +2 -22
index ba79aedea5f7..336b779d2e1e 100644
@@ -3,32 +3,14 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "test.h"
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
-
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib6(void)
-{
-	printf("rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib6(void)
-{
-	printf("slow_rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib6.h>
 
+#include "test.h"
+
 typedef int32_t (*rte_rib6_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -385,7 +367,5 @@ test_slow_rib6(void)
 	return unit_test_suite_runner(&rib6_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib6_autotest, test_rib6);
 REGISTER_TEST_COMMAND(rib6_slow_autotest, test_slow_rib6);
lib/rib/meson.build +0 -6
index bda7f576e976..7bacbb453592 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # Copyright(c) 2019 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_rib.c', 'rte_rib6.c')
 headers = files('rte_rib.h', 'rte_rib6.h')
 deps += ['mempool']
lib/rib/rte_rib.c +1 -0
index b0794edf66f5..812a2597d117 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/rib/rte_rib6.c +1 -0
index 19e4ff97c479..ae44281ae105 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
Signature · 1 line
2.39.1
#39 lore raw

PATCH v3 7/8 fib: enable on Windows

In reply to Stephen Hemminger

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

---
 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(-)
app/test/test_fib.c +1 -21
index a2d1ea8f3abc..eb69d6e2fd4c 100644
@@ -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);
app/test/test_fib6.c +2 -22
index cd971e6ecdfb..15ad09178ae2 100644
@@ -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);
app/test/test_fib6_perf.c +1 -14
index 21d2b65318e9..add20c2331b1 100644
@@ -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);
app/test/test_fib_perf.c +3 -16
index 9787874cc9b7..b56293e64f41 100644
@@ -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);
lib/fib/meson.build +0 -6
index 9b848d08417c..ddcae0617a73 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # 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']
lib/fib/rte_fib.c +1 -0
index 8af4c4091908..0c3b20e00a5a 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/fib/rte_fib6.c +1 -0
index 4b8e22b142b9..28c69b38999f 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
Signature · 1 line
2.39.1
#40 lore raw

PATCH v3 8/8 pcapng: windows compatibility

In reply to Stephen Hemminger

Allow building on Windows, need to provide some comparability wrappers for writev() and if_nametoindex.

---
 lib/pcapng/meson.build  |  6 -----
 lib/pcapng/rte_pcapng.c | 59 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 8 deletions(-)
lib/pcapng/meson.build +0 -6
index da938bbcb733..4549925d41b6 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Microsoft Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_pcapng.c')
 headers = files('rte_pcapng.h')
 
lib/pcapng/rte_pcapng.c +57 -2

84 lines not on this page · raw message

Signature · 1 line
2.39.1
#41 lore raw

v4 cover Enable building more libraries on Windows

In reply to Stephen Hemminger

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

v4 - fix spelling in commnet
enable build of lib/table as well

v3 - add rte_os_shim.h to rte_ring to fix use of
strdup() breaking with stricter MS compiler

v2 - fix unnecessary PATH_MAX in net/ring driver

Stephen Hemminger (9):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility
table: enable build on Windows

 app/test/meson.build            |  2 +-
 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 ++---------
 app/test/test_ipfrag.c          | 12 -------
 app/test/test_lpm.c             | 15 +--------
 app/test/test_lpm6.c            | 12 -------
 app/test/test_lpm6_data.h       |  3 +-
 app/test/test_lpm6_perf.c       | 14 +-------
 app/test/test_lpm_perf.c        | 39 +++++++---------------
 app/test/test_reorder.c         | 11 ------
 app/test/test_rib.c             | 19 -----------
 app/test/test_rib6.c            | 24 ++------------
 drivers/net/null/meson.build    |  6 ----
 drivers/net/ring/meson.build    |  6 ----
 drivers/net/ring/rte_eth_ring.c |  4 ++-
 lib/fib/meson.build             |  6 ----
 lib/fib/rte_fib.c               |  1 +
 lib/fib/rte_fib6.c              |  1 +
 lib/ip_frag/ip_frag_common.h    |  2 ++
 lib/ip_frag/meson.build         |  6 ----
 lib/lpm/meson.build             |  6 ----
 lib/pcapng/meson.build          |  6 ----
 lib/pcapng/rte_pcapng.c         | 59 +++++++++++++++++++++++++++++++--
 lib/reorder/meson.build         |  6 ----
 lib/reorder/rte_reorder.c       |  1 +
 lib/rib/meson.build             |  6 ----
 lib/rib/rte_rib.c               |  1 +
 lib/rib/rte_rib6.c              |  1 +
 lib/table/meson.build           |  6 ----
 31 files changed, 93 insertions(+), 262 deletions(-)
Signature · 1 line
2.39.1
#42 lore raw

PATCH v4 1/9 net/null: build null PMD on Windows

Builds fine with current code, no changes needed.

---
 drivers/net/null/meson.build | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/null/meson.build +0 -6
index 4a483955a7a9..a51f8f5211b0 100644
@@ -1,11 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_null.c')
 pmd_supports_disable_iova_as_pa = true
Signature · 1 line
2.39.1
#43 lore raw

PATCH v4 2/9 net/ring: build on Windows

In reply to Stephen Hemminger

The command line arguments are stored in node_action_pair and the name[] was sized to PATH_MAX which does not exist on Windows. Since the name is either "CREATE" or "ATTACH" it is not related to PATH_MAX (4096).

With this fix driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---
 app/test/meson.build            | 2 +-
 drivers/net/ring/meson.build    | 6 ------
 drivers/net/ring/rte_eth_ring.c | 4 +++-
 3 files changed, 4 insertions(+), 8 deletions(-)
app/test/meson.build +1 -1
index f34d19e3c3cb..a713f0382280 100644
@@ -390,7 +390,7 @@ if dpdk_conf.has('RTE_NET_BOND')
         driver_test_names += 'link_bonding_mode4_autotest'
     endif
 endif
-if dpdk_conf.has('RTE_NET_RING')
+if dpdk_conf.has('RTE_LIB_EVENTDEV') and dpdk_conf.has('RTE_NET_RING')
     test_deps += 'net_ring'
     test_sources += 'test_pmd_ring_perf.c'
     test_sources += 'test_pmd_ring.c'
drivers/net/ring/meson.build +0 -6
index 72792e26b05a..3534a3cc2287 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
drivers/net/ring/rte_eth_ring.c +3 -1
index bd5a47dd9017..e8bc9b627102 100644
@@ -9,6 +9,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_os_shim.h>
 #include <rte_string_fns.h>
 #include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
@@ -17,6 +18,7 @@
 #define ETH_RING_NUMA_NODE_ACTION_ARG	"nodeaction"
 #define ETH_RING_ACTION_CREATE		"CREATE"
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
+#define ETH_RING_ACTION_MAX_LEN		8 /* CREATE | ACTION */
 #define ETH_RING_INTERNAL_ARG		"internal"
 #define ETH_RING_INTERNAL_ARG_MAX_LEN	19 /* "0x..16chars..\0" */
 
@@ -539,7 +541,7 @@ eth_dev_ring_create(const char *name,
 }
 
 struct node_action_pair {
-	char name[PATH_MAX];
+	char name[ETH_RING_ACTION_MAX_LEN];
 	unsigned int node;
 	enum dev_action action;
 };
Signature · 1 line
2.39.1
#44 lore raw

Re: [PATCH v4 2/9] net/ring: build on Windows

Quoted 52 lines · Stephen Hemminger

The command line arguments are stored in node_action_pair and the name[] was sized to PATH_MAX which does not exist on Windows. Since the name is either "CREATE" or "ATTACH" it is not related to PATH_MAX (4096).

With this fix driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---
 app/test/meson.build            | 2 +-
 drivers/net/ring/meson.build    | 6 ------
 drivers/net/ring/rte_eth_ring.c | 4 +++-
 3 files changed, 4 insertions(+), 8 deletions(-)
app/test/meson.build +1 -1
index f34d19e3c3cb..a713f0382280 100644
@@ -390,7 +390,7 @@ if dpdk_conf.has('RTE_NET_BOND')
         driver_test_names += 'link_bonding_mode4_autotest'
     endif
 endif
-if dpdk_conf.has('RTE_NET_RING')
+if dpdk_conf.has('RTE_LIB_EVENTDEV') and dpdk_conf.has('RTE_NET_RING')
     test_deps += 'net_ring'
     test_sources += 'test_pmd_ring_perf.c'
     test_sources += 'test_pmd_ring.c'
drivers/net/ring/meson.build +0 -6
index 72792e26b05a..3534a3cc2287 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
drivers/net/ring/rte_eth_ring.c +0 -0
index bd5a47dd9017..e8bc9b627102 100644

drivers/net/ring/rte_eth_ring.c line 12

Quoted 4 lines
drivers/net/ring/rte_eth_ring.c +1 -0
@@ -9,6 +9,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_os_shim.h>

Is it still needed, since this patch drops use of PATH_MAX?

Quoted 23 lines
drivers/net/ring/rte_eth_ring.c +2 -2
 #include <rte_string_fns.h>
 #include <bus_vdev_driver.h>
 #include <rte_kvargs.h>
@@ -17,6 +18,7 @@
 #define ETH_RING_NUMA_NODE_ACTION_ARG  "nodeaction"
 #define ETH_RING_ACTION_CREATE         "CREATE"
 #define ETH_RING_ACTION_ATTACH         "ATTACH"
+#define ETH_RING_ACTION_MAX_LEN                8 /* CREATE | ACTION */
 #define ETH_RING_INTERNAL_ARG          "internal"
 #define ETH_RING_INTERNAL_ARG_MAX_LEN  19 /* "0x..16chars..\0" */
 
@@ -539,7 +541,7 @@ eth_dev_ring_create(const char *name,
 }
 
 struct node_action_pair {
-       char name[PATH_MAX];
+       char name[ETH_RING_ACTION_MAX_LEN];
        unsigned int node;
        enum dev_action action;
 };
--

2.39.1

Signature · 1 line
David Marchand
#45 lore raw

Re: [PATCH v4 2/9] net/ring: build on Windows

Quoted 11 lines · On Thu, 9 Mar 2023 22:10:03 +0100 David Marchand <[email protected]>…

drivers/net/ring/rte_eth_ring.c line 12

Quoted 9 lines
drivers/net/ring/rte_eth_ring.c +1 -0
index bd5a47dd9017..e8bc9b627102 100644
@@ -9,6 +9,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_os_shim.h>  

Is it still needed, since this patch drops use of PATH_MAX?

Let me submit a version without, I don't run windows just do cross builds.

#46 lore raw

Re: [PATCH v4 2/9] net/ring: build on Windows

Quoted 16 lines · Stephen Hemminger
Quoted 11 lines · On Thu, 9 Mar 2023 22:10:03 +0100 David Marchand <[email protected]>…

drivers/net/ring/rte_eth_ring.c line 12

Quoted 9 lines
drivers/net/ring/rte_eth_ring.c +1 -0
index bd5a47dd9017..e8bc9b627102 100644
@@ -9,6 +9,7 @@
 #include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_os_shim.h>

Is it still needed, since this patch drops use of PATH_MAX?

Quoted 1 line

Let me submit a version without, I don't run windows just do cross builds.

Good thing you did.

So we still need this include for hack on strdup.
So the v4 series is enough.

If I manage to merge it today..., I'll simply update the commitlog.

libtmp_rte_net_ring.a.p" "-Idrivers" "-I..\drivers" "-Idrivers\net\ring" "-I..\drivers\net\ring" "-Ilib\ethdev" "-I..\lib\ethdev" "-I." "-I.." "-Iconfig" "-I..\config" "-Ilib\eal\include" "-I..\lib\eal\include" "-Ilib\eal\windows\include" "-I..\lib\eal\windows\include" "-Ilib\eal\x86\include" "-I..\lib\eal\x86\include" "-Ilib\eal\common" "-I..\lib\eal\common" "-Ilib\eal" "-I..\lib\eal" "-Ilib\kvargs" "-I..\lib\kvargs" "-Ilib\net" "-I..\lib\net" "-Ilib\mbuf" "-I..\lib\mbuf" "-Ilib\mempool" "-I..\lib\mempool" "-Ilib\ring" "-I..\lib\ring" "-Ilib\metrics" "-I..\lib\metrics" "-Ilib\telemetry" "-I..\lib\telemetry" "-Ilib\meter" "-I..\lib\meter" "-Idrivers\bus\pci" "-I..\drivers\bus\pci" "-I..\drivers\bus\pci\windows" "-Ilib\pci" "-I..\lib\pci" "-Idrivers\bus\vdev" "-I..\drivers\bus\vdev" "-IC:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc" "-Xclang" "-fcolor-diagnostics" "-pipe" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wextra" "-Werror" "-O3" "-include" "rte_config.h" "-Wcast-qual" "-Wdeprecated" "-Wformat" "-Wformat-nonliteral" "-Wformat-security" "-Wmissing-declarations" "-Wmissing-prototypes" "-Wnested-externs" "-Wold-style-definition" "-Wpointer-arith" "-Wsign-compare" "-Wstrict-prototypes" "-Wundef" "-Wwrite-strings" "-Wno-address-of-packed-member" "-Wno-missing-field-initializers" "-D_GNU_SOURCE" "-D_WIN32_WINNT=0x0A00" "-D_CRT_SECURE_NO_WARNINGS" "-march=native" "-DALLOW_EXPERIMENTAL_API" "-DALLOW_INTERNAL_API" "-DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.ring" -MD -MQ drivers/libtmp_rte_net_ring.a.p/net_ring_rte_eth_ring.c.obj -MF "drivers\libtmp_rte_net_ring.a.p\net_ring_rte_eth_ring.c.obj.d" -o drivers/libtmp_rte_net_ring.a.p/net_ring_rte_eth_ring.c.obj "-c" ../drivers/net/ring/rte_eth_ring.c ../drivers/net/ring/rte_eth_ring.c:564:9: error: 'strdup' is
deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. [-Werror,-Wdeprecated-declarations]

        name = strdup(value);
               ^
C:\Program Files (x86)\Windows
Kits\10\Include\10.0.18362.0\ucrt\string.h:535:20: note: 'strdup' has
been explicitly marked deprecated here
    _Check_return_ _CRT_NONSTDC_DEPRECATE(_strdup)
                   ^
C:\Program Files (x86)\Windows
Kits\10\Include\10.0.18362.0\ucrt\corecrt.h:335:50: note: expanded
from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(
           \
                                                 ^
C:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\vcruntime.h:310:47:
note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^

1 error generated

Signature · 1 line
David Marchand
#47 lore raw

PATCH v4 3/9 lpm: enable on Windows

In reply to Stephen Hemminger

This builds on Windows without changes.

---
 app/test/test_lpm.c       | 15 +--------------
 app/test/test_lpm6.c      | 12 ------------
 app/test/test_lpm6_data.h |  3 ++-
 app/test/test_lpm6_perf.c | 14 +-------------
 app/test/test_lpm_perf.c  | 39 ++++++++++++---------------------------
 lib/lpm/meson.build       |  6 ------
 6 files changed, 16 insertions(+), 73 deletions(-)
app/test/test_lpm.c +1 -14
index bceb9ae743d7..37b460af3a96 100644
@@ -2,18 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm(void)
-{
-	printf("lpm not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -22,6 +10,7 @@ test_lpm(void)
 #include <rte_lpm.h>
 #include <rte_malloc.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -1595,6 +1584,4 @@ test_lpm(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_autotest, test_lpm);
app/test/test_lpm6.c +0 -12
index 1f44392db739..b6b6f8615ea5 100644
@@ -10,16 +10,6 @@
 #include <string.h>
 
 #include <rte_memory.h>
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6(void)
-{
-	printf("lpm6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_lpm6.h>
 
 #include "test_lpm6_data.h"
@@ -1803,6 +1793,4 @@ test_lpm6(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_autotest, test_lpm6);
app/test/test_lpm6_data.h +2 -1
index da9b161f20e5..3a1fa25f8433 100644
@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <rte_random.h>
 
 struct rules_tbl_entry {
 	uint8_t ip[16];
@@ -1129,7 +1130,7 @@ static void generate_large_ips_table(int gen_expected_next_hop)
 
 	for (i = 0; i < NUM_IPS_ENTRIES; i++) {
 		for (j = 0; j < 16; j++)
-			large_ips_table[i].ip[j] = lrand48();
+			large_ips_table[i].ip[j] = rte_rand();
 	}
 
 	for (k = j = 0, i = 0; i < NUM_IPS_ENTRIES; i++) {
app/test/test_lpm6_perf.c +1 -13
index aaf2773b6fac..5b684686a687 100644
@@ -2,17 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6_perf(void)
-{
-	printf("lpm6_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 
 #include <stdio.h>
 #include <stdint.h>
@@ -24,6 +13,7 @@ test_lpm6_perf(void)
 #include <rte_memory.h>
 #include <rte_lpm6.h>
 
+#include "test.h"
 #include "test_lpm6_data.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -171,6 +161,4 @@ test_lpm6_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf);
app/test/test_lpm_perf.c +12 -27
index e858716f909b..e72437ba3850 100644
@@ -3,17 +3,6 @@
  * Copyright(c) 2020 Arm Limited
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm_perf(void)
-{
-	printf("lpm_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -25,7 +14,9 @@ test_lpm_perf(void)
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_lpm.h>
+#include <rte_spinlock.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 struct rte_lpm *lpm;
@@ -34,8 +25,9 @@ static volatile uint8_t writer_done;
 static volatile uint32_t thr_id;
 static uint64_t gwrite_cycles;
 static uint32_t num_writers;
-/* LPM APIs are not thread safe, use mutex to provide thread safety */
-static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* LPM APIs are not thread safe, use spinlock */
+static rte_spinlock_t lpm_lock = RTE_SPINLOCK_INITIALIZER;
 
 /* Report quiescent state interval every 1024 lookups. Larger critical
  * sections in reader will result in writer polling multiple times.
@@ -267,7 +259,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];
 	ptr_ldepth_rule = &large_ldepth_route_table[num_ldepth_route_entries];
 	for (k = 0; k < rule_num; k++) {
@@ -296,7 +288,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));
 
@@ -452,8 +444,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	for (i = 0; i < RCU_ITERATIONS; i++) {
 		/* Add all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_add(lpm, large_ldepth_route_table[j].ip,
 					large_ldepth_route_table[j].depth,
 					next_hop_add) != 0) {
@@ -461,22 +452,19 @@ test_lpm_rcu_qsbr_writer(void *arg)
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 
 		/* Delete all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_delete(lpm, large_ldepth_route_table[j].ip,
 				large_ldepth_route_table[j].depth) != 0) {
 				printf("Failed to delete iteration %d, route# %d\n",
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 	}
 
@@ -487,8 +475,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	return 0;
 
 error:
-	if (num_writers > 1)
-		pthread_mutex_unlock(&lpm_mutex);
+	rte_spinlock_unlock(&lpm_lock);
 	return -1;
 }
 
@@ -773,6 +760,4 @@ test_lpm_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_perf_autotest, test_lpm_perf);
lib/lpm/meson.build +0 -6
index 6b47361fcec0..4cd48886fc41 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_lpm.c', 'rte_lpm6.c')
 headers = files('rte_lpm.h', 'rte_lpm6.h')
 # since header files have different names, we can install all vector headers
Signature · 1 line
2.39.1
#48 lore raw

PATCH v4 4/9 reorder: build on Windows

In reply to Stephen Hemminger

This builds on Windows if sys/queue.h is included.

---
 app/test/test_reorder.c   | 11 -----------
 lib/reorder/meson.build   |  6 ------
 lib/reorder/rte_reorder.c |  1 +
 3 files changed, 1 insertion(+), 17 deletions(-)
app/test/test_reorder.c +0 -11
index f0714a5c18a3..9ebd91477536 100644
@@ -11,16 +11,6 @@
 #include <rte_cycles.h>
 #include <rte_errno.h>
 #include <rte_mbuf.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_reorder(void)
-{
-	printf("reorder not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_reorder.h>
 #include <rte_lcore.h>
 #include <rte_malloc.h>
@@ -395,6 +385,5 @@ test_reorder(void)
 	return unit_test_suite_runner(&reorder_test_suite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(reorder_autotest, test_reorder);
lib/reorder/meson.build +0 -6
index 621c1f350103..03aed53d9007 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_reorder.c')
 headers = files('rte_reorder.h')
 deps += ['mbuf']
lib/reorder/rte_reorder.c +1 -0
index 385ee479da42..00e2cf043e04 100644
@@ -3,6 +3,7 @@
  */
 
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
Signature · 1 line
2.39.1
#49 lore raw

PATCH v4 5/9 ip_frag: enable build on Windows

In reply to Stephen Hemminger

This build works on Windows if sys/queue.h is included.

---
 app/test/test_ipfrag.c       | 12 ------------
 lib/ip_frag/ip_frag_common.h |  2 ++
 lib/ip_frag/meson.build      |  6 ------
 3 files changed, 2 insertions(+), 18 deletions(-)
app/test/test_ipfrag.c +0 -12
index 88cc4cdeea8d..402ce361c1a2 100644
@@ -10,17 +10,6 @@
 #include <rte_cycles.h>
 #include <rte_hexdump.h>
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_ipfrag(void)
-{
-	printf("ipfrag not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_ip_frag.h>
 #include <rte_mbuf.h>
 #include <rte_random.h>
@@ -520,6 +509,5 @@ test_ipfrag(void)
 	return unit_test_suite_runner(&ipfrag_testsuite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(ipfrag_autotest, test_ipfrag);
lib/ip_frag/ip_frag_common.h +2 -0
index 9c0dbdeb6eb9..0f4ad72a90d9 100644
@@ -8,6 +8,8 @@
 #include "rte_ip_frag.h"
 #include "ip_reassembly.h"
 
+#include <sys/queue.h>
+
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
 #define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, USER1, fmt, ##args)
lib/ip_frag/meson.build +0 -6
index 3a252bdaf6a4..ea2de09f7528 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_ipv4_fragmentation.c',
         'rte_ipv6_fragmentation.c',
Signature · 1 line
2.39.1
#50 lore raw

PATCH v4 6/9 rib: enable on Windows

In reply to Stephen Hemminger

The RIB library builds on Windows as long as sys/queue.h is included

---
 app/test/test_rib.c  | 19 -------------------
 app/test/test_rib6.c | 24 ++----------------------
 lib/rib/meson.build  |  6 ------
 lib/rib/rte_rib.c    |  1 +
 lib/rib/rte_rib6.c   |  1 +
 5 files changed, 4 insertions(+), 47 deletions(-)
app/test/test_rib.c +0 -19
index 06058f8f7c52..65b685641094 100644
@@ -10,23 +10,6 @@
 #include <stdlib.h>
 
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib(void)
-{
-	printf("rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib(void)
-{
-	printf("slow_rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib.h>
 
 typedef int32_t (*rte_rib_test)(void);
@@ -380,7 +363,5 @@ test_slow_rib(void)
 	return unit_test_suite_runner(&rib_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib_autotest, test_rib);
 REGISTER_TEST_COMMAND(rib_slow_autotest, test_slow_rib);
app/test/test_rib6.c +2 -22
index ba79aedea5f7..336b779d2e1e 100644
@@ -3,32 +3,14 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "test.h"
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
-
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib6(void)
-{
-	printf("rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib6(void)
-{
-	printf("slow_rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib6.h>
 
+#include "test.h"
+
 typedef int32_t (*rte_rib6_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -385,7 +367,5 @@ test_slow_rib6(void)
 	return unit_test_suite_runner(&rib6_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib6_autotest, test_rib6);
 REGISTER_TEST_COMMAND(rib6_slow_autotest, test_slow_rib6);
lib/rib/meson.build +0 -6
index bda7f576e976..7bacbb453592 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # Copyright(c) 2019 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_rib.c', 'rte_rib6.c')
 headers = files('rte_rib.h', 'rte_rib6.h')
 deps += ['mempool']
lib/rib/rte_rib.c +1 -0
index b0794edf66f5..812a2597d117 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/rib/rte_rib6.c +1 -0
index 19e4ff97c479..ae44281ae105 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
Signature · 1 line
2.39.1
#51 lore raw

PATCH v4 7/9 fib: enable on Windows

In reply to Stephen Hemminger

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

---
 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(-)
app/test/test_fib.c +1 -21
index a2d1ea8f3abc..eb69d6e2fd4c 100644
@@ -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);
app/test/test_fib6.c +2 -22
index cd971e6ecdfb..15ad09178ae2 100644
@@ -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);
app/test/test_fib6_perf.c +1 -14
index 21d2b65318e9..add20c2331b1 100644
@@ -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);
app/test/test_fib_perf.c +3 -16
index 9787874cc9b7..b56293e64f41 100644
@@ -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);
lib/fib/meson.build +0 -6
index 9b848d08417c..ddcae0617a73 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # 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']
lib/fib/rte_fib.c +1 -0
index 8af4c4091908..0c3b20e00a5a 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/fib/rte_fib6.c +1 -0
index 4b8e22b142b9..28c69b38999f 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
Signature · 1 line
2.39.1
#52 lore raw

PATCH v4 8/9 pcapng: windows compatibility

In reply to Stephen Hemminger

Allow building on Windows, need to provide some comparability wrappers for writev() and if_nametoindex.

---
 lib/pcapng/meson.build  |  6 -----
 lib/pcapng/rte_pcapng.c | 59 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 8 deletions(-)
lib/pcapng/meson.build +0 -6
index da938bbcb733..4549925d41b6 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Microsoft Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_pcapng.c')
 headers = files('rte_pcapng.h')
 
lib/pcapng/rte_pcapng.c +57 -2

84 lines not on this page · raw message

Signature · 1 line
2.39.1
#53 lore raw

PATCH v4 9/9 table: enable build on Windows

In reply to Stephen Hemminger

There doesn't seem to be anything keeping this from building on Windows.

---
 lib/table/meson.build | 6 ------
 1 file changed, 6 deletions(-)
lib/table/meson.build +0 -6
index 4f826b4b27e8..f8cef24b5918 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_swx_keycmp.c',
         'rte_swx_table_em.c',
Signature · 1 line
2.39.1
#55 lore raw

Re: [PATCH v4 0/9] Enable building more libraries on Windows

In reply to Stephen Hemminger
Quoted 5 lines · Stephen Hemminger

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Quoted 9 lines

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

Tweaked commitlogs and applied.
Thanks.

Signature · 1 line
David Marchand
#56 lore raw

v5 cover Enable building more libraries on Windows

In reply to Stephen Hemminger

While diagnosing some Windows cross build errors; noticed that lots of important DPDK libraries are not being built on Windows.

Stephen Hemminger (8):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility

v5 - remove no longer needed rte_os_shim.h in ring

v4 - fix spelling in commnet
enable build of lib/table as well

v3 - add rte_os_shim.h to rte_ring to fix use of
strdup() breaking with stricter MS compiler

v2 - fix unnecessary PATH_MAX in net/ring driver

Stephen Hemminger (9):
net/null: build null PMD on Windows
net/ring: build on Windows
lpm: enable on Windows
reorder: build on Windows
ip_frag: enable build on Windows
rib: enable on Windows
fib: enable on Windows
pcapng: windows compatibility
table: enable build on Windows

 app/test/meson.build            |  2 +-
 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 ++---------
 app/test/test_ipfrag.c          | 12 -------
 app/test/test_lpm.c             | 15 +--------
 app/test/test_lpm6.c            | 12 -------
 app/test/test_lpm6_data.h       |  3 +-
 app/test/test_lpm6_perf.c       | 14 +-------
 app/test/test_lpm_perf.c        | 39 +++++++---------------
 app/test/test_reorder.c         | 11 ------
 app/test/test_rib.c             | 19 -----------
 app/test/test_rib6.c            | 24 ++------------
 drivers/net/null/meson.build    |  6 ----
 drivers/net/ring/meson.build    |  6 ----
 drivers/net/ring/rte_eth_ring.c |  3 +-
 lib/fib/meson.build             |  6 ----
 lib/fib/rte_fib.c               |  1 +
 lib/fib/rte_fib6.c              |  1 +
 lib/ip_frag/ip_frag_common.h    |  2 ++
 lib/ip_frag/meson.build         |  6 ----
 lib/lpm/meson.build             |  6 ----
 lib/pcapng/meson.build          |  6 ----
 lib/pcapng/rte_pcapng.c         | 59 +++++++++++++++++++++++++++++++--
 lib/reorder/meson.build         |  6 ----
 lib/reorder/rte_reorder.c       |  1 +
 lib/rib/meson.build             |  6 ----
 lib/rib/rte_rib.c               |  1 +
 lib/rib/rte_rib6.c              |  1 +
 lib/table/meson.build           |  6 ----
 31 files changed, 92 insertions(+), 262 deletions(-)
Signature · 1 line
2.39.2
#57 lore raw

PATCH v5 1/9 net/null: build null PMD on Windows

Builds fine with current code, no changes needed.

---
 drivers/net/null/meson.build | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/null/meson.build +0 -6
index 4a483955a7a9..a51f8f5211b0 100644
@@ -1,11 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_null.c')
 pmd_supports_disable_iova_as_pa = true
Signature · 1 line
2.39.2
#58 lore raw

PATCH v5 2/9 net/ring: build on Windows

In reply to Stephen Hemminger

The command line arguments are stored in node_action_pair and the name[] was sized to PATH_MAX which does not exist on Windows. Since the name is either "CREATE" or "ATTACH" it is not related to PATH_MAX (4096).

With this fix driver builds ok on windows, but need to modify the test meson build to skip the eventdev test on Windows.

---
 app/test/meson.build            | 2 +-
 drivers/net/ring/meson.build    | 6 ------
 drivers/net/ring/rte_eth_ring.c | 3 ++-
 3 files changed, 3 insertions(+), 8 deletions(-)
app/test/meson.build +1 -1
index 2db5ccf4ff93..5d788148780c 100644
@@ -391,7 +391,7 @@ if dpdk_conf.has('RTE_NET_BOND')
         driver_test_names += 'link_bonding_mode4_autotest'
     endif
 endif
-if dpdk_conf.has('RTE_NET_RING')
+if dpdk_conf.has('RTE_LIB_EVENTDEV') and dpdk_conf.has('RTE_NET_RING')
     test_deps += 'net_ring'
     test_sources += 'test_pmd_ring_perf.c'
     test_sources += 'test_pmd_ring.c'
drivers/net/ring/meson.build +0 -6
index 72792e26b05a..3534a3cc2287 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
drivers/net/ring/rte_eth_ring.c +2 -1
index bd5a47dd9017..564d6a726403 100644
@@ -17,6 +17,7 @@
 #define ETH_RING_NUMA_NODE_ACTION_ARG	"nodeaction"
 #define ETH_RING_ACTION_CREATE		"CREATE"
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
+#define ETH_RING_ACTION_MAX_LEN		8 /* CREATE | ACTION */
 #define ETH_RING_INTERNAL_ARG		"internal"
 #define ETH_RING_INTERNAL_ARG_MAX_LEN	19 /* "0x..16chars..\0" */
 
@@ -539,7 +540,7 @@ eth_dev_ring_create(const char *name,
 }
 
 struct node_action_pair {
-	char name[PATH_MAX];
+	char name[ETH_RING_ACTION_MAX_LEN];
 	unsigned int node;
 	enum dev_action action;
 };
Signature · 1 line
2.39.2
#59 lore raw

PATCH v5 3/9 lpm: enable on Windows

In reply to Stephen Hemminger

This builds on Windows without changes.

---
 app/test/test_lpm.c       | 15 +--------------
 app/test/test_lpm6.c      | 12 ------------
 app/test/test_lpm6_data.h |  3 ++-
 app/test/test_lpm6_perf.c | 14 +-------------
 app/test/test_lpm_perf.c  | 39 ++++++++++++---------------------------
 lib/lpm/meson.build       |  6 ------
 6 files changed, 16 insertions(+), 73 deletions(-)
app/test/test_lpm.c +1 -14
index bceb9ae743d7..37b460af3a96 100644
@@ -2,18 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm(void)
-{
-	printf("lpm not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -22,6 +10,7 @@ test_lpm(void)
 #include <rte_lpm.h>
 #include <rte_malloc.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -1595,6 +1584,4 @@ test_lpm(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_autotest, test_lpm);
app/test/test_lpm6.c +0 -12
index 1f44392db739..b6b6f8615ea5 100644
@@ -10,16 +10,6 @@
 #include <string.h>
 
 #include <rte_memory.h>
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6(void)
-{
-	printf("lpm6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_lpm6.h>
 
 #include "test_lpm6_data.h"
@@ -1803,6 +1793,4 @@ test_lpm6(void)
 	return global_status;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_autotest, test_lpm6);
app/test/test_lpm6_data.h +2 -1
index da9b161f20e5..3a1fa25f8433 100644
@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <rte_random.h>
 
 struct rules_tbl_entry {
 	uint8_t ip[16];
@@ -1129,7 +1130,7 @@ static void generate_large_ips_table(int gen_expected_next_hop)
 
 	for (i = 0; i < NUM_IPS_ENTRIES; i++) {
 		for (j = 0; j < 16; j++)
-			large_ips_table[i].ip[j] = lrand48();
+			large_ips_table[i].ip[j] = rte_rand();
 	}
 
 	for (k = j = 0, i = 0; i < NUM_IPS_ENTRIES; i++) {
app/test/test_lpm6_perf.c +1 -13
index aaf2773b6fac..5b684686a687 100644
@@ -2,17 +2,6 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm6_perf(void)
-{
-	printf("lpm6_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 
 #include <stdio.h>
 #include <stdint.h>
@@ -24,6 +13,7 @@ test_lpm6_perf(void)
 #include <rte_memory.h>
 #include <rte_lpm6.h>
 
+#include "test.h"
 #include "test_lpm6_data.h"
 
 #define TEST_LPM_ASSERT(cond) do {                                            \
@@ -171,6 +161,4 @@ test_lpm6_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf);
app/test/test_lpm_perf.c +12 -27
index e858716f909b..e72437ba3850 100644
@@ -3,17 +3,6 @@
  * Copyright(c) 2020 Arm Limited
  */
 
-#include "test.h"
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_lpm_perf(void)
-{
-	printf("lpm_perf not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -25,7 +14,9 @@ test_lpm_perf(void)
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_lpm.h>
+#include <rte_spinlock.h>
 
+#include "test.h"
 #include "test_xmmt_ops.h"
 
 struct rte_lpm *lpm;
@@ -34,8 +25,9 @@ static volatile uint8_t writer_done;
 static volatile uint32_t thr_id;
 static uint64_t gwrite_cycles;
 static uint32_t num_writers;
-/* LPM APIs are not thread safe, use mutex to provide thread safety */
-static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* LPM APIs are not thread safe, use spinlock */
+static rte_spinlock_t lpm_lock = RTE_SPINLOCK_INITIALIZER;
 
 /* Report quiescent state interval every 1024 lookups. Larger critical
  * sections in reader will result in writer polling multiple times.
@@ -267,7 +259,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];
 	ptr_ldepth_rule = &large_ldepth_route_table[num_ldepth_route_entries];
 	for (k = 0; k < rule_num; k++) {
@@ -296,7 +288,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));
 
@@ -452,8 +444,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	for (i = 0; i < RCU_ITERATIONS; i++) {
 		/* Add all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_add(lpm, large_ldepth_route_table[j].ip,
 					large_ldepth_route_table[j].depth,
 					next_hop_add) != 0) {
@@ -461,22 +452,19 @@ test_lpm_rcu_qsbr_writer(void *arg)
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 
 		/* Delete all the entries */
 		for (j = si; j < ei; j++) {
-			if (num_writers > 1)
-				pthread_mutex_lock(&lpm_mutex);
+			rte_spinlock_lock(&lpm_lock);
 			if (rte_lpm_delete(lpm, large_ldepth_route_table[j].ip,
 				large_ldepth_route_table[j].depth) != 0) {
 				printf("Failed to delete iteration %d, route# %d\n",
 					i, j);
 				goto error;
 			}
-			if (num_writers > 1)
-				pthread_mutex_unlock(&lpm_mutex);
+			rte_spinlock_unlock(&lpm_lock);
 		}
 	}
 
@@ -487,8 +475,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
 	return 0;
 
 error:
-	if (num_writers > 1)
-		pthread_mutex_unlock(&lpm_mutex);
+	rte_spinlock_unlock(&lpm_lock);
 	return -1;
 }
 
@@ -773,6 +760,4 @@ test_lpm_perf(void)
 	return 0;
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(lpm_perf_autotest, test_lpm_perf);
lib/lpm/meson.build +0 -6
index 6b47361fcec0..4cd48886fc41 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_lpm.c', 'rte_lpm6.c')
 headers = files('rte_lpm.h', 'rte_lpm6.h')
 # since header files have different names, we can install all vector headers
Signature · 1 line
2.39.2
#60 lore raw

PATCH v5 4/9 reorder: build on Windows

In reply to Stephen Hemminger

This builds on Windows if sys/queue.h is included.

---
 app/test/test_reorder.c   | 11 -----------
 lib/reorder/meson.build   |  6 ------
 lib/reorder/rte_reorder.c |  1 +
 3 files changed, 1 insertion(+), 17 deletions(-)
app/test/test_reorder.c +0 -11
index f391597a7836..39e48c3df1fa 100644
@@ -11,16 +11,6 @@
 #include <rte_cycles.h>
 #include <rte_errno.h>
 #include <rte_mbuf.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_reorder(void)
-{
-	printf("reorder not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_reorder.h>
 #include <rte_lcore.h>
 #include <rte_malloc.h>
@@ -557,6 +547,5 @@ test_reorder(void)
 	return unit_test_suite_runner(&reorder_test_suite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(reorder_autotest, test_reorder);
lib/reorder/meson.build +0 -6
index 621c1f350103..03aed53d9007 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_reorder.c')
 headers = files('rte_reorder.h')
 deps += ['mbuf']
lib/reorder/rte_reorder.c +1 -0
index 6e029c9e02fd..9026403ea675 100644
@@ -3,6 +3,7 @@
  */
 
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
Signature · 1 line
2.39.2
#61 lore raw

PATCH v5 5/9 ip_frag: enable build on Windows

In reply to Stephen Hemminger

This build works on Windows if sys/queue.h is included.

---
 app/test/test_ipfrag.c       | 12 ------------
 lib/ip_frag/ip_frag_common.h |  2 ++
 lib/ip_frag/meson.build      |  6 ------
 3 files changed, 2 insertions(+), 18 deletions(-)
app/test/test_ipfrag.c +0 -12
index 88cc4cdeea8d..402ce361c1a2 100644
@@ -10,17 +10,6 @@
 #include <rte_cycles.h>
 #include <rte_hexdump.h>
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_ipfrag(void)
-{
-	printf("ipfrag not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-#else
-
 #include <rte_ip_frag.h>
 #include <rte_mbuf.h>
 #include <rte_random.h>
@@ -520,6 +509,5 @@ test_ipfrag(void)
 	return unit_test_suite_runner(&ipfrag_testsuite);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
 
 REGISTER_TEST_COMMAND(ipfrag_autotest, test_ipfrag);
lib/ip_frag/ip_frag_common.h +2 -0
index 9c0dbdeb6eb9..0f4ad72a90d9 100644
@@ -8,6 +8,8 @@
 #include "rte_ip_frag.h"
 #include "ip_reassembly.h"
 
+#include <sys/queue.h>
+
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
 #define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, USER1, fmt, ##args)
lib/ip_frag/meson.build +0 -6
index 3a252bdaf6a4..ea2de09f7528 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_ipv4_fragmentation.c',
         'rte_ipv6_fragmentation.c',
Signature · 1 line
2.39.2
#62 lore raw

PATCH v5 6/9 rib: enable on Windows

In reply to Stephen Hemminger

The RIB library builds on Windows as long as sys/queue.h is included

---
 app/test/test_rib.c  | 19 -------------------
 app/test/test_rib6.c | 24 ++----------------------
 lib/rib/meson.build  |  6 ------
 lib/rib/rte_rib.c    |  1 +
 lib/rib/rte_rib6.c   |  1 +
 5 files changed, 4 insertions(+), 47 deletions(-)
app/test/test_rib.c +0 -19
index 06058f8f7c52..65b685641094 100644
@@ -10,23 +10,6 @@
 #include <stdlib.h>
 
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib(void)
-{
-	printf("rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib(void)
-{
-	printf("slow_rib not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib.h>
 
 typedef int32_t (*rte_rib_test)(void);
@@ -380,7 +363,5 @@ test_slow_rib(void)
 	return unit_test_suite_runner(&rib_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib_autotest, test_rib);
 REGISTER_TEST_COMMAND(rib_slow_autotest, test_slow_rib);
app/test/test_rib6.c +2 -22
index ba79aedea5f7..336b779d2e1e 100644
@@ -3,32 +3,14 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include "test.h"
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
-
 #include <rte_ip.h>
-
-#ifdef RTE_EXEC_ENV_WINDOWS
-static int
-test_rib6(void)
-{
-	printf("rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-
-static int
-test_slow_rib6(void)
-{
-	printf("slow_rib6 not supported on Windows, skipping test\n");
-	return TEST_SKIPPED;
-}
-#else
-
 #include <rte_rib6.h>
 
+#include "test.h"
+
 typedef int32_t (*rte_rib6_test)(void);
 
 static int32_t test_create_invalid(void);
@@ -385,7 +367,5 @@ test_slow_rib6(void)
 	return unit_test_suite_runner(&rib6_slow_tests);
 }
 
-#endif /* !RTE_EXEC_ENV_WINDOWS */
-
 REGISTER_TEST_COMMAND(rib6_autotest, test_rib6);
 REGISTER_TEST_COMMAND(rib6_slow_autotest, test_slow_rib6);
lib/rib/meson.build +0 -6
index bda7f576e976..7bacbb453592 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # Copyright(c) 2019 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_rib.c', 'rte_rib6.c')
 headers = files('rte_rib.h', 'rte_rib6.h')
 deps += ['mempool']
lib/rib/rte_rib.c +1 -0
index b0794edf66f5..812a2597d117 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/rib/rte_rib6.c +1 -0
index 19e4ff97c479..ae44281ae105 100644
@@ -5,6 +5,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
Signature · 1 line
2.39.2
#63 lore raw

PATCH v5 7/9 fib: enable on Windows

In reply to Stephen Hemminger

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

---
 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(-)
app/test/test_fib.c +1 -21
index a2d1ea8f3abc..eb69d6e2fd4c 100644
@@ -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);
app/test/test_fib6.c +2 -22
index cd971e6ecdfb..15ad09178ae2 100644
@@ -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);
app/test/test_fib6_perf.c +1 -14
index 21d2b65318e9..add20c2331b1 100644
@@ -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);
app/test/test_fib_perf.c +3 -16
index 9787874cc9b7..b56293e64f41 100644
@@ -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);
lib/fib/meson.build +0 -6
index 9b848d08417c..ddcae0617a73 100644
@@ -2,12 +2,6 @@
 # Copyright(c) 2018 Vladimir Medvedkin <[email protected]>
 # 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']
lib/fib/rte_fib.c +1 -0
index 8af4c4091908..0c3b20e00a5a 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
lib/fib/rte_fib6.c +1 -0
index 4b8e22b142b9..28c69b38999f 100644
@@ -5,6 +5,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <sys/queue.h>
 
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
Signature · 1 line
2.39.2
#64 lore raw

PATCH v5 8/9 pcapng: windows compatibility

In reply to Stephen Hemminger

Allow building on Windows, need to provide some comparability wrappers for writev() and if_nametoindex.

---
 lib/pcapng/meson.build  |  6 -----
 lib/pcapng/rte_pcapng.c | 59 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 8 deletions(-)
lib/pcapng/meson.build +0 -6
index da938bbcb733..4549925d41b6 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Microsoft Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files('rte_pcapng.c')
 headers = files('rte_pcapng.h')
 
lib/pcapng/rte_pcapng.c +57 -2

84 lines not on this page · raw message

Signature · 1 line
2.39.2
#65 lore raw

PATCH v5 9/9 table: enable build on Windows

In reply to Stephen Hemminger

There doesn't seem to be anything keeping this from building on Windows.

---
 lib/table/meson.build | 6 ------
 1 file changed, 6 deletions(-)
lib/table/meson.build +0 -6
index 4f826b4b27e8..f8cef24b5918 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'rte_swx_keycmp.c',
         'rte_swx_table_em.c',
Signature · 1 line
2.39.2