From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Tyler Retzlaff <roretzla@linux.microsoft.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Subject: [PATCH v2 3/8] lpm: enable on Windows
Date: Mon, 6 Feb 2023 16:19:32 -0800 [thread overview]
Message-ID: <20230207001937.875608-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20230207001937.875608-1-stephen@networkplumber.org>
This builds on Windows without changes.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
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(-)
diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c
index bceb9ae743d7..37b460af3a96 100644
--- a/app/test/test_lpm.c
+++ b/app/test/test_lpm.c
@@ -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);
diff --git a/app/test/test_lpm6.c b/app/test/test_lpm6.c
index 1f44392db739..b6b6f8615ea5 100644
--- a/app/test/test_lpm6.c
+++ b/app/test/test_lpm6.c
@@ -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);
diff --git a/app/test/test_lpm6_data.h b/app/test/test_lpm6_data.h
index da9b161f20e5..3a1fa25f8433 100644
--- a/app/test/test_lpm6_data.h
+++ b/app/test/test_lpm6_data.h
@@ -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++) {
diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
index aaf2773b6fac..5b684686a687 100644
--- a/app/test/test_lpm6_perf.c
+++ b/app/test/test_lpm6_perf.c
@@ -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);
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index e858716f909b..e72437ba3850 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -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);
diff --git a/lib/lpm/meson.build b/lib/lpm/meson.build
index 6b47361fcec0..4cd48886fc41 100644
--- a/lib/lpm/meson.build
+++ b/lib/lpm/meson.build
@@ -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
--
2.39.1
next prev parent reply other threads:[~2023-02-07 0:20 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 1:44 [PATCH 0/8] Enable building more " Stephen Hemminger
2022-12-01 1:44 ` [PATCH 1/8] net/null: build null PMD " Stephen Hemminger
2022-12-01 23:51 ` Tyler Retzlaff
2022-12-01 1:44 ` [PATCH 2/8] net/ring: build " Stephen Hemminger
2022-12-01 23:52 ` Tyler Retzlaff
2022-12-14 23:18 ` Kadam, Pallavi
2022-12-15 3:22 ` Stephen Hemminger
2022-12-15 17:48 ` Tyler Retzlaff
2022-12-15 18:09 ` Dmitry Kozlyuk
2022-12-01 1:44 ` [PATCH 3/8] lpm: enable " Stephen Hemminger
2022-12-01 23:53 ` Tyler Retzlaff
2022-12-01 1:44 ` [PATCH 4/8] reorder: build " Stephen Hemminger
2022-12-01 23:53 ` Tyler Retzlaff
2022-12-01 1:44 ` [PATCH 5/8] ip_frag: enable " Stephen Hemminger
2022-12-01 23:54 ` Tyler Retzlaff
2022-12-01 1:44 ` [PATCH 6/8] rib: enable " Stephen Hemminger
2022-12-01 23:54 ` Tyler Retzlaff
2022-12-01 1:44 ` [PATCH 7/8] fib: " Stephen Hemminger
2022-12-01 23:54 ` Tyler Retzlaff
2022-12-01 1:44 ` [PATCH 8/8] pcapng: windows compatability Stephen Hemminger
2022-12-01 23:55 ` Tyler Retzlaff
2023-02-07 0:19 ` [PATCH v2 0/8] Enable building more libraries on Windows Stephen Hemminger
2023-02-07 0:19 ` [PATCH v2 1/8] net/null: build null PMD " Stephen Hemminger
2023-02-07 0:19 ` [PATCH v2 2/8] net/ring: build " Stephen Hemminger
2023-02-07 0:19 ` Stephen Hemminger [this message]
2023-02-07 0:19 ` [PATCH v2 4/8] reorder: " Stephen Hemminger
2023-02-07 0:19 ` [PATCH v2 5/8] ip_frag: enable " Stephen Hemminger
2023-02-07 0:19 ` [PATCH v2 6/8] rib: enable " Stephen Hemminger
2023-02-07 0:19 ` [PATCH v2 7/8] fib: " Stephen Hemminger
2023-02-07 0:19 ` [PATCH v2 8/8] pcapng: windows compatibility Stephen Hemminger
2023-02-07 22:13 ` [PATCH v2 0/8] Enable building more libraries on Windows Dmitry Kozlyuk
2023-02-09 9:16 ` David Marchand
2023-02-19 17:50 ` [PATCH v3 " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 1/8] net/null: build null PMD " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 2/8] net/ring: build " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 3/8] lpm: enable " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 4/8] reorder: build " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 5/8] ip_frag: enable " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 6/8] rib: enable " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 7/8] fib: " Stephen Hemminger
2023-02-19 17:50 ` [PATCH v3 8/8] pcapng: windows compatibility Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 0/9] Enable building more libraries on Windows Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 1/9] net/null: build null PMD " Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 2/9] net/ring: build " Stephen Hemminger
2023-03-09 21:10 ` David Marchand
2023-03-09 21:21 ` Stephen Hemminger
2023-03-10 9:34 ` David Marchand
2023-02-19 23:14 ` [PATCH v4 3/9] lpm: enable " Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 4/9] reorder: build " Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 5/9] ip_frag: enable " Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 6/9] rib: enable " Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 7/9] fib: " Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 8/9] pcapng: windows compatibility Stephen Hemminger
2023-02-19 23:14 ` [PATCH v4 9/9] table: enable build on Windows Stephen Hemminger
2023-03-06 21:07 ` Tyler Retzlaff
2023-03-10 14:06 ` [PATCH v4 0/9] Enable building more libraries " David Marchand
2023-03-09 21:31 ` [PATCH v5 " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 1/9] net/null: build null PMD " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 2/9] net/ring: build " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 3/9] lpm: enable " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 4/9] reorder: build " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 5/9] ip_frag: enable " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 6/9] rib: enable " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 7/9] fib: " Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 8/9] pcapng: windows compatibility Stephen Hemminger
2023-03-09 21:31 ` [PATCH v5 9/9] table: enable build on Windows Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230207001937.875608-4-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=roretzla@linux.microsoft.com \
--cc=vladimir.medvedkin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).