[v5,2/9] net/ring: build on Windows

Message ID 20230309213128.34146-3-stephen@networkplumber.org (mailing list archive)
State Rejected, archived
Delegated to: David Marchand
Headers
Series Enable building more libraries on Windows |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger March 9, 2023, 9:31 p.m. UTC
  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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 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(-)
  

Patch

diff --git a/app/test/meson.build b/app/test/meson.build
index 2db5ccf4ff93..5d788148780c 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -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'
diff --git a/drivers/net/ring/meson.build b/drivers/net/ring/meson.build
index 72792e26b05a..3534a3cc2287 100644
--- a/drivers/net/ring/meson.build
+++ b/drivers/net/ring/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_eth_ring.c')
 headers = files('rte_eth_ring.h')
 pmd_supports_disable_iova_as_pa = true
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index bd5a47dd9017..564d6a726403 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -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;
 };