From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99E71A0548; Sat, 3 Apr 2021 00:19:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1453E140E1B; Sat, 3 Apr 2021 00:19:21 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9514E40138 for ; Sat, 3 Apr 2021 00:19:19 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1061) id D54B020ABC3F; Fri, 2 Apr 2021 15:19:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D54B020ABC3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1617401958; bh=B4pq6iKFslJy/jQx2aB1IXCyxjh0b2b5ZqmAwW5XMUI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G7+djzASeQHpNcP2BvMsZjCtv3y5fuBC0ZDVMNfHkMO4fpyOzRQIEy2LX6S6/ruFd TCPZ/RNtbdh+AgIuZqKRTEWTYzze1eufr/Gsbo/6X9h0MnzZdshPeGoAuokq4TTurU +IZcgmuT9vwyAH0gcXbiAaxZMZv5EbBvHfZEPbXI= Date: Fri, 2 Apr 2021 15:19:18 -0700 From: Jie Zhou To: Tal Shnaiderman Cc: "dev@dpdk.org" , "dmitry.kozliuk@gmail.com" , "xiaoyun.li@intel.com" , "roretzla@microsoft.com" , "pallavi.kadam@intel.com" , NBU-Contact-Thomas Monjalon , "bruce.richardson@intel.com" , "ferruh.yigit@intel.com" Message-ID: <20210402221918.GB6573@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1616048795-16906-1-git-send-email-jizh@linux.microsoft.com> <1616172695-28505-1-git-send-email-jizh@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH v2] app/test-pmd: enable testpmd on windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Apr 01, 2021 at 08:44:31AM +0000, Tal Shnaiderman wrote: > > Subject: [dpdk-dev] [PATCH v2] app/test-pmd: enable testpmd on windows > > > > From: Jie Zhou > > > > 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. > Sure Tal, I will try to split into multiple patch as many as possible in next version. > > > > 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 > > Signed-off-by: Jie Zhou > > > > --- > > 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")]. Will do for all the instances. Thanks for the pointer! > > > # 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 > > > > > 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()? > You are right. Will address in the new version. > > else > > nb_seg = tx_pkt_nb_segs; > > > > > > > - > > +#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. > Will add librte_eal\windows\eal_dev.c and stubs in it. Thanks. > > 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