Message ID | 20210415221055.1575-1-dmitry.kozliuk@gmail.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 70349A0C40; Fri, 16 Apr 2021 00:11:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46EA340150; Fri, 16 Apr 2021 00:11:05 +0200 (CEST) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by mails.dpdk.org (Postfix) with ESMTP id 8FC2140140 for <dev@dpdk.org>; Fri, 16 Apr 2021 00:11:04 +0200 (CEST) Received: by mail-lf1-f49.google.com with SMTP id j4so2092895lfp.0 for <dev@dpdk.org>; Thu, 15 Apr 2021 15:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bMjzylQeV+FYrhKl850iXypiyoS8/Dx9UIeXfUDPg2E=; b=H1/PIxQ/NjtQQtIfSsQcPOGXYVo5N45jPLukoyi16M9Vj6LaQTp4S03ZjJR9gnzz1W Nh5OLmgZp6WYtHa9pr6gqAwhPbIqUvfvXRa7NqbCwl98recqiHFwP0xjUtREQ0Xix18n P3QaT2oyyiBEfGPPqQca9tlEq51HYCYlGWauuoyrd/wNC3ErlUxqSfqbYbCqc96VB+Fs dDu+tQ6/yfroGiPKgm2jhIW6y3DMHOD5ZNCqpxaPjaZvWubOcAjQCT+zoFkZYQkEc6or NeJgSyeHV/gpxhgnkKs6ZanXjY/WxDQs9TYxzDjyqDVsY06LcMkJvMpPuvFp6jf4d8si PlOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bMjzylQeV+FYrhKl850iXypiyoS8/Dx9UIeXfUDPg2E=; b=ihfEOd4cQTQsfEfqZJDYdn569IFPOco8ouZRgQE05NIo9d4uFnkawsCVxdthGQClb9 E8vwF/DydsijHlnATdeI6MlOaDVwbbeNLUXNjyoqx7ERH7tzHQCRPTdNrGpgkAFv2g5j OjZY0IKNDWuEThm0oU2R1/1Dd9qcnSCi8quMq633+dFLSq32fXKwZaLu9QIqN3xjS4KN eXUI08cbuNcB0e5isLFI/MTsqR6Wjs8T/Dpiw/CmFgd4Hs6Ers/j7nnj7A42mXw59k0d cyFG12MgBjXR9Z3dje2jGVAlUgt6DEMkLs8GUGJ89QJ6ICkfBzUSBQqEREx0dppcv2Jg Szmg== X-Gm-Message-State: AOAM530yzsVlHkZPoMHnXhNnZxXu3JL0907O3kXsXbRb9oFAp+LUjvIu uSdPuf3SgbDFqzGt+fSqK+yHyw5UKSpxm/kO X-Google-Smtp-Source: ABdhPJw5a3M02G24xHpFw/gCRvfsmdweAyilasqt/iKuCLErzUD4kejyrPKs94NJ/Lcuem4+2B7zxQ== X-Received: by 2002:ac2:5238:: with SMTP id i24mr818151lfl.535.1618524663772; Thu, 15 Apr 2021 15:11:03 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id d17sm105591lfb.148.2021.04.15.15.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 15:11:03 -0700 (PDT) From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> To: dev@dpdk.org Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> Date: Fri, 16 Apr 2021 01:10:52 +0300 Message-Id: <20210415221055.1575-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210324005008.24705-1-dmitry.kozliuk@gmail.com> References: <20210324005008.24705-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 0/3] net/pcap: build on Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
net/pcap: build on Windows
|
|
Message
Dmitry Kozlyuk
April 15, 2021, 10:10 p.m. UTC
Most modern and actively maintained distribution of libpcap for Windows is Npcap [1]. It currently doesn't provide a pkg-config file [2]. By default it is installed to C:\Program Files\Npcap and can be located using standard environment variables [3]: $env:C_INCLUDE_PATH += ";C:\Program Files\Npcap" $env:LIBRARY_PATH += ";C:\Program Files\Npcap\Lib\x64" # MinGW $env:LINK += ' /LIBPATH:"C:\Program Files\Npcap\Lib\x64"' # Clang The following libpcap.pc also works if placed in PKG_CONFIG_PATH: prefix="C:/Program Files/Npcap" Name: libpcap Version: 1.10 Description: Platform-independent network traffic capture library Cflags: -I${prefix}/Include Libs: -L${prefix}/Lib/x64 -lwpcap Example of collecting packets from an interface to a file: .\build\examples\dpdk-skeleton.exe ` --vdev "eth_pcap0,iface=\Device\NPF_{DDD48985-A77C-4FC9-AF48-61E547C8797E}" ` --vdev "eth_pcap1,tx_pcap=capture.pcap" Interface name can be obtained as follows, with Wireshark installed: & "C:\Program Files\Wireshark\tshark.exe" -D Implementation in "pcap_osdep_windows.c" does some guesswork to convert between variants of an interface name. Microsoft experts and interested users, please take a look and/or give it a try in your environment. [1]: https://nmap.org/npcap [2]: https://github.com/nmap/npcap/issues/299 [3]: https://mesonbuild.com/Reference-manual.html#compiler-object v4: * Change libpcap discovery to work without dependent patch. * Fix memory leak in osdep_iface_mac_get (in v3, actually). * rte_os_internal.h -> rte_os_shim.h in patch 3/3. Dmitry Kozlyuk (3): eal/windows: add timespec_get shim for MinGW net/pcap: move OS-dependent code to separate files net/pcap: build on Windows config/meson.build | 5 +- doc/guides/rel_notes/release_21_05.rst | 4 + drivers/net/pcap/meson.build | 16 +-- .../pcap/{rte_eth_pcap.c => pcap_ethdev.c} | 109 +++------------- drivers/net/pcap/pcap_osdep.h | 18 +++ drivers/net/pcap/pcap_osdep_freebsd.c | 59 +++++++++ drivers/net/pcap/pcap_osdep_linux.c | 42 +++++++ drivers/net/pcap/pcap_osdep_windows.c | 118 ++++++++++++++++++ lib/librte_eal/windows/include/rte_os_shim.h | 32 +++++ 9 files changed, 304 insertions(+), 99 deletions(-) rename drivers/net/pcap/{rte_eth_pcap.c => pcap_ethdev.c} (95%) create mode 100644 drivers/net/pcap/pcap_osdep.h create mode 100644 drivers/net/pcap/pcap_osdep_freebsd.c create mode 100644 drivers/net/pcap/pcap_osdep_linux.c create mode 100644 drivers/net/pcap/pcap_osdep_windows.c
Comments
On 4/15/2021 11:10 PM, Dmitry Kozlyuk wrote: > Most modern and actively maintained distribution of libpcap for Windows > is Npcap [1]. It currently doesn't provide a pkg-config file [2]. > By default it is installed to C:\Program Files\Npcap and can be located > using standard environment variables [3]: > > $env:C_INCLUDE_PATH += ";C:\Program Files\Npcap" > $env:LIBRARY_PATH += ";C:\Program Files\Npcap\Lib\x64" # MinGW > $env:LINK += ' /LIBPATH:"C:\Program Files\Npcap\Lib\x64"' # Clang > > The following libpcap.pc also works if placed in PKG_CONFIG_PATH: > > prefix="C:/Program Files/Npcap" > Name: libpcap > Version: 1.10 > Description: Platform-independent network traffic capture library > Cflags: -I${prefix}/Include > Libs: -L${prefix}/Lib/x64 -lwpcap > > Example of collecting packets from an interface to a file: > > .\build\examples\dpdk-skeleton.exe ` > --vdev "eth_pcap0,iface=\Device\NPF_{DDD48985-A77C-4FC9-AF48-61E547C8797E}" ` > --vdev "eth_pcap1,tx_pcap=capture.pcap" > > Interface name can be obtained as follows, with Wireshark installed: > > & "C:\Program Files\Wireshark\tshark.exe" -D > > Implementation in "pcap_osdep_windows.c" does some guesswork to convert > between variants of an interface name. Microsoft experts and interested > users, please take a look and/or give it a try in your environment. > > [1]: https://nmap.org/npcap > [2]: https://github.com/nmap/npcap/issues/299 > [3]: https://mesonbuild.com/Reference-manual.html#compiler-object > > v4: > * Change libpcap discovery to work without dependent patch. > * Fix memory leak in osdep_iface_mac_get (in v3, actually). > * rte_os_internal.h -> rte_os_shim.h in patch 3/3. > > Dmitry Kozlyuk (3): > eal/windows: add timespec_get shim for MinGW > net/pcap: move OS-dependent code to separate files > net/pcap: build on Windows > Hi Dmitry, Since the dependent patches merged, I checked/tested the set and it looks good to me, pcap patch already has my review tag. But not able to test the pcap on Windows. Because if Windows & eal part of the patch, I am delegating it to Thomas in patchwork. > config/meson.build | 5 +- > doc/guides/rel_notes/release_21_05.rst | 4 + > drivers/net/pcap/meson.build | 16 +-- > .../pcap/{rte_eth_pcap.c => pcap_ethdev.c} | 109 +++------------- > drivers/net/pcap/pcap_osdep.h | 18 +++ > drivers/net/pcap/pcap_osdep_freebsd.c | 59 +++++++++ > drivers/net/pcap/pcap_osdep_linux.c | 42 +++++++ > drivers/net/pcap/pcap_osdep_windows.c | 118 ++++++++++++++++++ > lib/librte_eal/windows/include/rte_os_shim.h | 32 +++++ > 9 files changed, 304 insertions(+), 99 deletions(-) > rename drivers/net/pcap/{rte_eth_pcap.c => pcap_ethdev.c} (95%) > create mode 100644 drivers/net/pcap/pcap_osdep.h > create mode 100644 drivers/net/pcap/pcap_osdep_freebsd.c > create mode 100644 drivers/net/pcap/pcap_osdep_linux.c > create mode 100644 drivers/net/pcap/pcap_osdep_windows.c >
> Dmitry Kozlyuk (3): > eal/windows: add timespec_get shim for MinGW > net/pcap: move OS-dependent code to separate files > net/pcap: build on Windows Compilation is failing on FreeBSD 11: http://mails.dpdk.org/archives/test-report/2021-April/188997.html implicit declaration of function 'timespec_get' is invalid in C99 use of undeclared identifier 'TIME_UTC' It should be fixed by including time.h I cannot reproduce the issue with FreeBSD 12.
2021-04-21 00:20 (UTC+0200), Thomas Monjalon: > > Dmitry Kozlyuk (3): > > eal/windows: add timespec_get shim for MinGW > > net/pcap: move OS-dependent code to separate files > > net/pcap: build on Windows > > Compilation is failing on FreeBSD 11: > http://mails.dpdk.org/archives/test-report/2021-April/188997.html > implicit declaration of function 'timespec_get' is invalid in C99 > use of undeclared identifier 'TIME_UTC' > > It should be fixed by including time.h No, FreeBSD 11 is missing timespec_get indeed. > I cannot reproduce the issue with FreeBSD 12. After adding a FreeBSD 11 shim and rebasing over "main" I get another error unrelated to the patch. It seems FreeBSD 11 is missing pthread_setname_np() as well. [11/1847] Compiling C object lib/librte_telemetry.a.p/telemetry_telemetry.c.o ../src/lib/telemetry/telemetry.c:445:2: warning: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Wimplicit-function-declaration] pthread_setname_np(t_old, "telemetry-v1"); ^ ../src/lib/telemetry/telemetry.c:474:2: warning: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Wimplicit-function-declaration] pthread_setname_np(t_new, "telemetry-v2"); ^ 2 warnings generated. [60/1847] Linking target lib/librte_telemetry.so.21.2 FAILED: lib/librte_telemetry.so.21.2 cc -o lib/librte_telemetry.so.21.2 lib/librte_telemetry.a.p/telemetry_telemetry.c.o lib/librte_telemetry.a.p/telemetry_telemetry_data.c.o lib/librte_telemetry.a.p/telemetry_telemetry_legacy.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librte_telemetry.so.21 -Wl,--no-as-needed -pthread -lm -lexecinfo -Wl,--end-group -Wl,--version-script=/tmp/src/lib/telemetry/version.map lib/librte_telemetry.a.p/telemetry_telemetry.c.o: In function `rte_telemetry_init': telemetry.c:(.text.internal+0x15a): undefined reference to `pthread_setname_np' telemetry.c:(.text.internal+0x24d): undefined reference to `pthread_setname_np' cc: error: linker command failed with exit code 1 (use -v to see invocation)
21/04/2021 16:53, Dmitry Kozlyuk: > 2021-04-21 00:20 (UTC+0200), Thomas Monjalon: > > > Dmitry Kozlyuk (3): > > > eal/windows: add timespec_get shim for MinGW > > > net/pcap: move OS-dependent code to separate files > > > net/pcap: build on Windows > > > > Compilation is failing on FreeBSD 11: > > http://mails.dpdk.org/archives/test-report/2021-April/188997.html > > implicit declaration of function 'timespec_get' is invalid in C99 > > use of undeclared identifier 'TIME_UTC' > > > > It should be fixed by including time.h > > No, FreeBSD 11 is missing timespec_get indeed. > > > I cannot reproduce the issue with FreeBSD 12. > > After adding a FreeBSD 11 shim and rebasing over "main" > I get another error unrelated to the patch. > It seems FreeBSD 11 is missing pthread_setname_np() as well. > > [11/1847] Compiling C object lib/librte_telemetry.a.p/telemetry_telemetry.c.o > ../src/lib/telemetry/telemetry.c:445:2: warning: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Wimplicit-function-declaration] > pthread_setname_np(t_old, "telemetry-v1"); > ^ > ../src/lib/telemetry/telemetry.c:474:2: warning: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Wimplicit-function-declaration] > pthread_setname_np(t_new, "telemetry-v2"); > ^ Sorry, that's because I've merged a patch which is failing with FreeBSD < 12.2 and I missed the CI report. I am fixing with this patch: https://patches.dpdk.org/project/dpdk/patch/20210421181157.1634301-1-thomas@monjalon.net/