[dpdk-dev] [PATCH v2] app/test-pmd: enable testpmd on windows
Tal Shnaiderman
talshn at nvidia.com
Thu Apr 1 10:44:31 CEST 2021
> Subject: [dpdk-dev] [PATCH v2] app/test-pmd: enable testpmd on windows
>
> From: Jie Zhou <jizh at microsoft.com>
>
> This patch is to enable testpmd on windows. It mainly includes:
> - Enable building libraries on Windows that TestPMD depends on
> - Enable building testpmd on Windows
> - Resolve name collisions with Windows types
> - Add clock_gettime_monotic for testpmd on Windows
> - Make printf format work for both Linux and Windows
> - Add missing macros
> - Add missing IPPROTO_RAW to in.h
> - Replace htons with RTE_BE16
> - Replace inet_aton with inet_pton
> - Fix parse_fec_mode to return fec_capa to remove compilation warning
> - ...
Hi Jie,
I think each topic above deserves it's own patch, some can be squashed together, e.g - one patch for all missing macros.
>
> Issue under active investigation:
> - Recent DPDK upstream change "eal: detach memsegs on cleanup" exposed
> failure at eal exit with "EAL: Could not unmap memory: No Error".
> Investigating KERNELBASE!UnmapViewOfFile. The issue will cause system
> crash. Currently temporarily remove cleanup at exit on Windows.
> Will revert after issue root caused and fixed
>
> Future work:
> - Some issues discovered at validation which need further investigations
> * Perf inconsistency issues: TPUT fluctuated significantly from runs
> * After traffic stop, port stats shows pps being 0 while bps not
> * Currently mempool allocation only succeed with native. Other methods
> failed at rte_mem_lock/VirtualLock. Thus currently only allow native
> - Hot-plug not supported yet
>
> Signed-off-by: Jie Zhou <jizh at linux.microsoft.com>
> Signed-off-by: Jie Zhou <jizh at microsoft.com>
>
> ---
> V2 changes:
> - Fix commit message log long line issue
> - Fix coding style issues of pointer location
> - Fix indentation issue
> - Fix FreeBSD2101 compilation issue of AF_INET undeclared
> ---
> app/meson.build | 15 +-
> app/test-pmd/cmdline.c | 12 +-
> app/test-pmd/cmdline_flow.c | 440 ++++++++++----------
> app/test-pmd/config.c | 37 +-
> app/test-pmd/csumonly.c | 4 +
> app/test-pmd/icmpecho.c | 4 +-
> app/test-pmd/ieee1588fwd.c | 10 +-
> app/test-pmd/parameters.c | 18 +-
> app/test-pmd/testpmd.c | 38 +-
> app/test-pmd/testpmd.h | 6 +-
> lib/librte_eal/windows/include/netinet/in.h | 1 +
> lib/librte_eal/windows/include/rte_os.h | 8 +
> lib/meson.build | 7 +
> 13 files changed, 352 insertions(+), 248 deletions(-)
>
> diff --git a/app/meson.build b/app/meson.build
> index 87fc195db..00622933e 100644
> --- a/app/meson.build
> +++ b/app/meson.build
> @@ -1,10 +1,6 @@
> # SPDX-License-Identifier: BSD-3-Clause
> # Copyright(c) 2017-2019 Intel Corporation
>
> -if is_windows
> - subdir_done()
> -endif
> -
> apps = [
> 'pdump',
> 'proc-info',
> @@ -21,6 +17,11 @@ apps = [
> 'test-regex',
> 'test-sad']
>
> +if is_windows
> + apps = [
> + 'test-pmd']
> +endif
> +
Please disable each unsupported app instead of adding this part, see how it was done in the PMDs enablement [b9d60b5434e9df46f5 ("drivers/net: build i40e and mlx5 on Windows")].
> # for BSD only
> lib_execinfo = cc.find_library('execinfo', required: false)
>
> @@ -73,5 +74,7 @@ foreach app:apps
> endif
> endforeach
>
> -# special case the autotests
> -subdir('test')
> +if not(is_windows)
> + # special case the autotests
> + subdir('test')
> +endif
Same, disable in ..\app\test\meson.build
<snip>
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
> index 6b4df335f..0fb03b9f9 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -696,7 +696,11 @@ pkt_copy_split(const struct rte_mbuf *pkt)
> mp = current_fwd_lcore()->mbp;
>
> if (tx_pkt_split == TX_PKT_SPLIT_RND)
> +#ifndef RTE_EXEC_ENV_WINDOWS
> nb_seg = random() % tx_pkt_nb_segs + 1;
> +#else
> + nb_seg = rand() % tx_pkt_nb_segs + 1;
> +#endif
Can we use a common function for both OSs instead? Rte_rand()?
> else
> nb_seg = tx_pkt_nb_segs;
>
<snip>
> -
> +#ifndef RTE_EXEC_ENV_WINDOWS
> if (hot_plug) {
> ret = rte_dev_event_monitor_stop();
> if (ret) {
> @@ -3096,6 +3118,7 @@ pmd_test_exit(void)
> return;
> }
> }
> +#endif
I think it's better to add stubs for Windows instead of ifndefs in the code if possible.
> for (i = 0 ; i < RTE_DIM(mempools) ; i++) {
> if (mempools[i])
> rte_mempool_free(mempools[i]);
> @@ -3259,6 +3282,7 @@ register_eth_event_callback(void)
> return 0;
> }
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> /* This function is used by the interrupt thread */
> static void
> dev_event_callback(const char *device_name, enum rte_dev_event_type
> type,
> @@ -3308,6 +3332,7 @@ dev_event_callback(const char *device_name,
> enum rte_dev_event_type type,
> break;
> }
> }
> +#endif
>
> static void
> rxtx_port_config(struct rte_port *port)
> @@ -3759,7 +3784,9 @@ signal_handler(int signum)
> f_quit = 1;
> /* exit with the expected status */
> signal(signum, SIG_DFL);
> +#ifndef RTE_EXEC_ENV_WINDOWS
> kill(getpid(), signum);
> +#endif
> }
> }
>
> @@ -3834,10 +3861,12 @@ main(int argc, char** argv)
> if (argc > 1)
> launch_args_parse(argc, argv);
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> if (do_mlockall && mlockall(MCL_CURRENT | MCL_FUTURE)) {
> TESTPMD_LOG(NOTICE, "mlockall() failed with error
> \"%s\"\n",
> strerror(errno));
> }
> +#endif
>
> if (tx_first && interactive)
> rte_exit(EXIT_FAILURE, "--tx-first cannot be used on "
> @@ -3859,6 +3888,7 @@ main(int argc, char** argv)
>
> init_config();
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> if (hot_plug) {
> ret = rte_dev_hotplug_handle_enable();
> if (ret) {
> @@ -3882,6 +3912,7 @@ main(int argc, char** argv)
> return -1;
> }
> }
> +#endif
Same as above.
>
> if (!no_device_start && start_port(RTE_PORT_ALL) != 0)
> rte_exit(EXIT_FAILURE, "Start ports failed\n");
> @@ -3969,10 +4000,11 @@ main(int argc, char** argv)
> return 1;
> }
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> ret = rte_eal_cleanup();
> if (ret != 0)
> rte_exit(EXIT_FAILURE,
> "EAL cleanup failed: %s\n", strerror(-ret));
> -
> +#endif
> return EXIT_SUCCESS;
> }
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index af4085917..c56c813d6 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -761,7 +761,7 @@ inc_tx_burst_stats(struct fwd_stream *fs, uint16_t
> nb_tx)
> }
>
> /* Prototypes */
> -unsigned int parse_item_list(char* str, const char* item_name,
> +unsigned int parse_item_list(const char *str, const char *item_name,
> unsigned int max_items,
> unsigned int *parsed_items, int
> check_unique_values);
> void launch_args_parse(int argc, char** argv);
> @@ -881,7 +881,7 @@ void show_tx_pkt_segments(void);
> void set_tx_pkt_times(unsigned int *tx_times);
> void show_tx_pkt_times(void);
> void set_tx_pkt_split(const char *name);
> -int parse_fec_mode(const char *name, enum rte_eth_fec_mode *mode);
> +int parse_fec_mode(const char *name, uint32_t *fec_capa);
> void show_fec_capability(uint32_t num, struct rte_eth_fec_capa
> *speed_fec_capa);
> void set_nb_pkt_per_burst(uint16_t pkt_burst);
> char *list_pkt_forwarding_modes(void);
> @@ -936,7 +936,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf,
> uint16_t rate,
>
> void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
> void port_rss_hash_key_update(portid_t port_id, char rss_type[],
> - uint8_t *hash_key, uint hash_key_len);
> + uint8_t *hash_key, unsigned int hash_key_len);
> int rx_queue_id_is_invalid(queueid_t rxq_id);
> int tx_queue_id_is_invalid(queueid_t txq_id);
> void setup_gro(const char *onoff, portid_t port_id);
> diff --git a/lib/librte_eal/windows/include/netinet/in.h
> b/lib/librte_eal/windows/include/netinet/in.h
> index 6455b9ba5..38268cf80 100644
> --- a/lib/librte_eal/windows/include/netinet/in.h
> +++ b/lib/librte_eal/windows/include/netinet/in.h
> @@ -24,6 +24,7 @@
> #define IPPROTO_NONE 59
> #define IPPROTO_DSTOPTS 60
> #define IPPROTO_SCTP 132
> +#define IPPROTO_RAW 255
>
> #define INET6_ADDRSTRLEN 46
>
> diff --git a/lib/librte_eal/windows/include/rte_os.h
> b/lib/librte_eal/windows/include/rte_os.h
> index 7ef38ff06..f318a66b8 100644
> --- a/lib/librte_eal/windows/include/rte_os.h
> +++ b/lib/librte_eal/windows/include/rte_os.h
> @@ -25,6 +25,14 @@ extern "C" {
> #define PATH_MAX _MAX_PATH
> #endif
>
> +#define strcasecmp _stricmp
> +#define open _open
> +#define read _read
> +
> +#ifndef S_ISREG
> +#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
> +#endif
> +
> #ifndef sleep
> #define sleep(x) Sleep(1000 * (x))
> #endif
> diff --git a/lib/meson.build b/lib/meson.build
> index 7712aa497..295976a4d 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -46,6 +46,13 @@ if is_windows
> 'cmdline',
> 'hash',
> 'cfgfile',
> + 'metrics',
> + 'timer',
> + 'gro',
> + 'gso',
> + 'pdump',
> + 'bitratestats',
> + 'latencystats',
> ] # only supported libraries for windows
> endif
>
> --
> 2.30.0.vfs.0.2
More information about the dev
mailing list