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 6F138A0A0A; Wed, 24 Mar 2021 01:50:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4DE840693; Wed, 24 Mar 2021 01:50:25 +0100 (CET) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mails.dpdk.org (Postfix) with ESMTP id C7F0B40684 for ; Wed, 24 Mar 2021 01:50:24 +0100 (CET) Received: by mail-lj1-f180.google.com with SMTP id u20so28005786lja.13 for ; Tue, 23 Mar 2021 17:50:24 -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=R/M73yOiC48bofUt9pzVjSBPEGu7WuDzckccB5vg/HA=; b=Hp26FPLFyGgHnWav7Z/xQTdJlidk7idNiipb38MO+1aqJwCqrLaHvCfmrSwzaWMY5y tFk0llvqhuw7j/UBFs208RgzGPsccEgAr8I7p1omgeI9EbxQpELi9uO5rkVm0M+kVMfA mXlf3aSgw6fWLA4R1jRbziQEXG0cBXOgZqn1coYaYDax6l6sMf/vKQYOGtQ69NGM0cMA Dxe1zbFKfp8eMOGiOkzzftRm754QjmGKvX1siTebtUOaBJSboAbRcafGdweftI8tlv0w 7mQvwtZmSbR72ndBg/W+kCo7bsp3JpPuGvKPHRJrOZUb3qqUHyFIqiJF/99B19lUP7V5 QQ4Q== 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=R/M73yOiC48bofUt9pzVjSBPEGu7WuDzckccB5vg/HA=; b=MhQtDkTji9/nYv9MMjTP1Lf9kOSttiUosNaqhFdlvCqBpAqfYKvq7UvH6nVSHrh6HU isBoGm+FzCfvNd403SSkY6nb3IuQUjnbEmXgNrEEPqOsW4G8ULfnDzQp/h9nDzhX1Rgu fZr0GSiZCGLtU/fGMUacODrpIooGzIVEWas6PuCsU2F/8133Zi0oRgBwkK8oqBesPbHd 3G7Wd2nll0Bm2LnNeOAVDsPERrkR6VrfPicogxYfV18thVHb4g95LZFxw+QEZKQze9+w gAVcJ9h5FgS5rTJm8gDUFAj/+Wi3cUWSdfige77ZWH39EshhmUNq6rE4NPhrP3RDjoWO YxkA== X-Gm-Message-State: AOAM531GQYz6pg+IZls24Q9C7HJKgGtbm/xUcTryRrJBVKVSbsPOAQMM gz23L/EJ3IpxlJ6F49g4613sNG2CwbAv+EGX X-Google-Smtp-Source: ABdhPJyblt7j+Mn6BiLybc7NsF/EUKnNmALO3ZFTvn/S69+0rseRYUL1Xe8WcU5lVvohllMx/Xhmaw== X-Received: by 2002:a2e:9b16:: with SMTP id u22mr384156lji.184.1616547023989; Tue, 23 Mar 2021 17:50:23 -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 q12sm89794ljj.49.2021.03.23.17.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 17:50:23 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Nick Connolly , Mike Wells , Tyler Retzlaff , Dmitry Kozlyuk Date: Wed, 24 Mar 2021 03:50:04 +0300 Message-Id: <20210324005008.24705-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210214021616.26970-1-dmitry.kozliuk@gmail.com> References: <20210214021616.26970-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" NOTE: dependency patches are requirements, CI may fail. 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 Depends-on: series-15801 ("eal/windows: do not expose POSIX symbols") Depends-on: patch-89639 ("[v2,3/3] meson: remove unnecessary explicit link to libpcap") v3: * Use environment and pkg-config to locate libpcap (Bruce). * Use C11 timespec_get() instead of EAL wrapper. * Drop libpcap wrappers in net/pcap (Ferruh). 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 | 3 +- 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 ++++++++++++++++++ .../windows/include/rte_os_internal.h | 32 +++++ 9 files changed, 303 insertions(+), 98 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 -- 2.29.3