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 72722A0C45; Sun, 11 Apr 2021 23:39:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CEBD141445; Sun, 11 Apr 2021 23:39:57 +0200 (CEST) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mails.dpdk.org (Postfix) with ESMTP id 7918F1413F6 for ; Sun, 11 Apr 2021 23:39:56 +0200 (CEST) Received: by mail-lf1-f48.google.com with SMTP id n8so18244915lfh.1 for ; Sun, 11 Apr 2021 14:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gH9x6Rv16ad7Ou8RMnJ/766cW0o3FKldaXg1zy4fRZw=; b=dR/CQiGkitT6mgYftPlEnolRFbc10l5lM1LapPdfxaYuwQl5r9ZQLSgoK9MTb2JwBb sSTq+/6FkHfLOfiyMXeXFN2GvXpZorcR4qaXQ313nTLy+A7ui4ZitcWalv/5EWEqjFmf MTlZ1RxhtkBdi6HnVgHYBx4WXAjKNsHxDbhsJLpJSGUGV715SnTDxcD0Ebbzdn9hoSMF 1jyNBveg684i1ps18OviJ8Z9RJLXyM3MxbF4PFVz2QZdMqm7gd2dsOWE49vGgZv3Jqdl 5CO3HkwTywEytwgyGATBKl/HGwgyPFyktsAFey5uf619aLeDp8eFBYmy1pEpb7rsZl+p 547g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gH9x6Rv16ad7Ou8RMnJ/766cW0o3FKldaXg1zy4fRZw=; b=b5bo7Mwb1GdpJqOAhq1dR2t7+FU/quoDmTnO0ILQatFrVhuOxDuvJATsX0xH8r0ZxF qHl/jo0A1YLfkLEpyTn4rz2EiuBhNW91fOHA3+dFLFCTO3UTzdV34fK2En+inJA8sl3m B57NGHJWIgdRVS1wqI7O8znhT7aoJYtp8cpXdT3rCLMcjnctUrOa+KmclaJOHL80JTR3 6M5+cenqghwUNhFCIpoRGKyyLmQOysPfRtpFu7P+YvK7z4Gk23JxCPW6te5rI6eDrbpL Nmjmm5EZbP5QayVqzigdTybh0IwO25sGwoUT4umUv+j8TY0G+8qG0IfGFZ44eSouKhu+ BDKg== X-Gm-Message-State: AOAM532/46BH+r4lZEOdZNUerW2p34OU9vISnZaMlEwQAJO1BVqIyvR8 Dq2AAzYDF9XypdaXM+EqUUs= X-Google-Smtp-Source: ABdhPJxA9HoADpCqlnyqxb1PMiSiJ5ll6/d+3hCY8M0haPUP5tOrVdE4qHPbWgaMBWg2Vj3QYyXpvw== X-Received: by 2002:ac2:442e:: with SMTP id w14mr1224485lfl.285.1618177195934; Sun, 11 Apr 2021 14:39:55 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id a40sm2192353ljq.86.2021.04.11.14.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Apr 2021 14:39:55 -0700 (PDT) Date: Mon, 12 Apr 2021 00:39:54 +0300 From: Dmitry Kozlyuk To: Jie Zhou Cc: dev@dpdk.org, xiaoyun.li@intel.com, roretzla@microsoft.com, pallavi.kadam@intel.com, thomas@monjalon.net, bruce.richardson@intel.com, ferruh.yigit@intel.com Message-ID: <20210412003954.62ce3ca4@sovereign> In-Reply-To: <1616172695-28505-1-git-send-email-jizh@linux.microsoft.com> References: <1616048795-16906-1-git-send-email-jizh@linux.microsoft.com> <1616172695-28505-1-git-send-email-jizh@linux.microsoft.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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" Hi Jie, General comment: try to avoid #ifdef RTE_EXEC_ENV_WINDOWS except for inherently non-portable Unix code. It clutters the source and complicates testing: unless you build on Linux you won't know something broke in code under #ifdef. Take device hot-plug for example. Since you disable parameter parsing with #ifdef, hot_plug variable is always 0. You don't need to disable code guarded by this variable until it only uses DPDK API. You may need to add stubs to EAL in a separate commit. 2021-03-19 09:51 (UTC-0700), Jie Zhou: [...] > 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 > + Can we disable individual apps instead of having two lists, like Pallavi did in drivers/net directory? [...] > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 14110eb2e..35a6dd0d3 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -8,12 +8,14 @@ > #include > #include > #include > + > +#ifndef RTE_EXEC_ENV_WINDOWS > #include > +#endif This include is not needed at all: cmdline abstracts termios. > +#ifdef RTE_EXEC_ENV_WINDOWS > +#ifndef IPDEFTTL > +#define IPDEFTTL 64 > +#endif > +#endif > + [...] > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 576d5acab..af7570429 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -38,7 +38,6 @@ > #include > #include > #include > -#include > #ifdef RTE_NET_IXGBE > #include > #endif > @@ -170,6 +169,27 @@ print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) > printf("%s%s", name, buf); > } > > +#ifdef RTE_EXEC_ENV_WINDOWS > +static int > +clock_gettime_monotonic(struct timespec *tp) > +{ > + LARGE_INTEGER pf, pc; > + LONGLONG nsec; > + > + if (QueryPerformanceFrequency(&pf) == 0) > + return -1; > + > + if (QueryPerformanceCounter(&pc) == 0) > + return -1; > + > + nsec = pc.QuadPart * NS_PER_SEC / pf.QuadPart; > + tp->tv_sec = nsec / NS_PER_SEC; > + tp->tv_nsec = nsec - tp->tv_sec * NS_PER_SEC; > + > + return 0; > +} > +#endif > + > void > nic_stats_display(portid_t port_id) > { > @@ -182,6 +202,7 @@ nic_stats_display(portid_t port_id) > uint64_t diff_pkts_rx, diff_pkts_tx, diff_bytes_rx, diff_bytes_tx, > diff_ns; > uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx; > + int ret; > struct rte_eth_stats stats; > > static const char *nic_stats_border = "########################"; > @@ -202,7 +223,13 @@ nic_stats_display(portid_t port_id) > "%-"PRIu64"\n", stats.opackets, stats.oerrors, stats.obytes); > > diff_ns = 0; > - if (clock_gettime(CLOCK_TYPE_ID, &cur_time) == 0) { > + > +#ifdef RTE_EXEC_ENV_WINDOWS > + ret = clock_gettime_monotonic(&cur_time); > +#else > + ret = clock_gettime(CLOCK_TYPE_ID, &cur_time); > +#endif > + if (ret == 0) { I suggest to use a single wrapped defined using #ifdef to avoid an #ifdef each time it is called (although it's the only occurrence for now). [...] > 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 rte_rand() be exported from EAL and used here? [...] > > +#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; > } rte_eal_cleanup() is fixed, this can be removed.