net/dpdkoin: add new driver
Subsystems (2)
PATCH 1/1 net/dpdkoin: add new driver
DPDK polls the packet in a busy loop. This means that CPU constantly spins looking for packets, regardless of the network traffic.
DPDK does this to reduce latency and avoid using interrupts, at expense of
efficiency: this might consume more processing power and generate more heat than needed, potentially increasing the TCO of a DPDK appliance.
Here comes DPDKoin. DPDKoin is a DPDK PMD, which instead of moving packets, mines cryptocurrencies.
DPDKoin just does a few calculations to every poll cycle, this means that when the network is loaded, DPDKoin consumes just a few cycles, but when there is no traffic, DPDKoin mines currencies in a busy loop. The coins are mined with no extra consumption, as the CPU would spin anyway.
This is a system running with two 10G cards running with DPDK:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8223 root 10 -10 260.6g 597516 19100 S 199.8 0.5 0:17.89 testpmd
And this is the same system with a DPDKoin port added:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9438 root 10 -10 260.6g 598892 19800 S 199.8 0.5 0:19.43 testpmd
As you can see, we don't observe any change in the CPU usage, and besides, the earned coins lowers the appliance TCO.
Just for reference, a test run log follows:
$ sudo testpmd --no-huge -m 1024 --no-pci --vdev eth_dpdkoin0 --vdev eth_dpdkoin1 EAL: Detected 8 lcore(s) EAL: Detected 1 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: Probing VFIO support... testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=203456, size=2176, socket=0 testpmd: preferred mempool ops selected: ring_mp_mc Configuring Port 0 (socket 0) Port 0: 4A:50:3C:33:55:21 Configuring Port 1 (socket 0) Port 1: BA:BB:0A:BB:0C:CA Checking link statuses... Done No commandline core given, start packet forwarding io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support enabled, MP allocation mode: native Logical Core 1 (socket 0) forwards packets on 2 streams: RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
io packet forwarding packets/burst=32
nb forwarding cores=1 - nb forwarding ports=2 port 0: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
port 1: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
libbitcoin 0.1: mining on CPU2
libbitcoin 0.1: mining on CPU4
--- config/common_base | 5 + drivers/net/Makefile | 1 + drivers/net/dpdkoin/Makefile | 23 + drivers/net/dpdkoin/meson.build | 3 + drivers/net/dpdkoin/rte_eth_dpdkoin.c | 696 ++++++++++++++++++ .../net/dpdkoin/rte_pmd_dpdkoin_version.map | 3 + mk/rte.app.mk | 1 + 7 files changed, 732 insertions(+) create mode 100644 drivers/net/dpdkoin/Makefile create mode 100644 drivers/net/dpdkoin/meson.build create mode 100644 drivers/net/dpdkoin/rte_eth_dpdkoin.c create mode 100644 drivers/net/dpdkoin/rte_pmd_dpdkoin_version.map
config/common_base +5 -0
@@ -1055,6 +1055,11 @@ CONFIG_RTE_LIBRTE_VHOST_DEBUG=n # CONFIG_RTE_LIBRTE_PMD_VHOST=n +# +# Compile DPDKOIN +# +CONFIG_RTE_LIBRTE_PMD_DPDKOIN=y + # # Compile IFC driver # To compile, CONFIG_RTE_LIBRTE_VHOST and CONFIG_RTE_EAL_VFIO
drivers/net/Makefile +1 -0
@@ -23,6 +23,7 @@ endif ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 endif +DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPDKOIN) += dpdkoin DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000 DIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena DIRS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc
drivers/net/dpdkoin/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: BSD-3-Clause + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_dpdkoin.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs +LDLIBS += -lrte_bus_vdev + +EXPORT_MAP := rte_pmd_dpdkoin_version.map + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPDKOIN) += rte_eth_dpdkoin.c + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/dpdkoin/meson.build new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: BSD-3-Clause + +sources = files('rte_eth_dpdkoin.c')
drivers/net/dpdkoin/rte_eth_dpdkoin.c new file +696 -0
696 lines not on this page · raw message
drivers/net/dpdkoin/rte_pmd_dpdkoin_version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_20.0 { + local: *; +};
mk/rte.app.mk +1 -0
@@ -216,6 +216,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += -lrte_pmd_mvneta _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPDKOIN) += -lrte_pmd_dpdkoin -lbitcoin _LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += -lrte_pmd_octeontx2 -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap _LDLIBS-$(CONFIG_RTE_LIBRTE_PFE_PMD) += -lrte_pmd_pfe
Signature · 1 line
2.25.1
Quoted 6 lines · Matteo Croce
DPDK polls the packet in a busy loop. This means that CPU constantly spins looking for packets, regardless of the network traffic.
DPDK does this to reduce latency and avoid using interrupts, at expense of
efficiency: this might consume more processing power and generate more heat than needed, potentially increasing the TCO of a DPDK appliance.
Quoted 7 lines
Here comes DPDKoin. DPDKoin is a DPDK PMD, which instead of moving packets, mines cryptocurrencies.
DPDKoin just does a few calculations to every poll cycle, this means that when the network is loaded, DPDKoin consumes just a few cycles, but when there is no traffic, DPDKoin mines currencies in a busy loop. The coins are mined with no extra consumption, as the CPU would spin anyway.
:)
<...>
drivers/net/dpdkoin/rte_eth_dpdkoin.c line 539
Quoted 8 lines
drivers/net/dpdkoin/rte_eth_dpdkoin.c new file +8
-0+/* finally assign rx and tx ops */ +if (packet_copy) { + eth_dev->rx_pkt_burst = eth_dpdkoin_copy_rx; + eth_dev->tx_pkt_burst = eth_dpdkoin_copy_tx; + }else { + eth_dev->rx_pkt_burst = eth_dpdkoin_rx; + eth_dev->tx_pkt_burst = eth_dpdkoin_tx; + }
This is the biggest give away, but still good job :)
Quoted 73 lines · Matteo Croce
DPDK polls the packet in a busy loop. This means that CPU constantly spins looking for packets, regardless of the network traffic.
DPDK does this to reduce latency and avoid using interrupts, at expense of
efficiency: this might consume more processing power and generate more heat than needed, potentially increasing the TCO of a DPDK appliance.Here comes DPDKoin. DPDKoin is a DPDK PMD, which instead of moving packets, mines cryptocurrencies.
DPDKoin just does a few calculations to every poll cycle, this means that when the network is loaded, DPDKoin consumes just a few cycles, but when there is no traffic, DPDKoin mines currencies in a busy loop. The coins are mined with no extra consumption, as the CPU would spin anyway.This is a system running with two 10G cards running with DPDK:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8223 root 10 -10 260.6g 597516 19100 S 199.8 0.5 0:17.89 testpmdAnd this is the same system with a DPDKoin port added:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9438 root 10 -10 260.6g 598892 19800 S 199.8 0.5 0:19.43 testpmdAs you can see, we don't observe any change in the CPU usage, and besides, the earned coins lowers the appliance TCO.
Just for reference, a test run log follows:
$ sudo testpmd --no-huge -m 1024 --no-pci --vdev eth_dpdkoin0 --vdev eth_dpdkoin1 EAL: Detected 8 lcore(s) EAL: Detected 1 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: Probing VFIO support... testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n 3456, size!76, socket=0 testpmd: preferred mempool ops selected: ring_mp_mc Configuring Port 0 (socket 0) Port 0: 4A:50:3C:33:55:21 Configuring Port 1 (socket 0) Port 1: BA:BB:0A:BB:0C:CA Checking link statuses... Done No commandline core given, start packet forwarding io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support enabled, MP allocation mode: native Logical Core 1 (socket 0) forwards packets on 2 streams: RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer:00:00:00:00:01 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer:00:00:00:00:00io packet forwarding packets/burst2
nb forwarding cores=1 - nb forwarding ports=2 port 0: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
port 1: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
libbitcoin 0.1: mining on CPU2
libbitcoin 0.1: mining on CPU4
Quoted 14 lines
--- config/common_base | 5 + drivers/net/Makefile | 1 + drivers/net/dpdkoin/Makefile | 23 + drivers/net/dpdkoin/meson.build | 3 + drivers/net/dpdkoin/rte_eth_dpdkoin.c | 696 ++++++++++++++++++ .../net/dpdkoin/rte_pmd_dpdkoin_version.map | 3 + mk/rte.app.mk | 1 + 7 files changed, 732 insertions(+) create mode 100644 drivers/net/dpdkoin/Makefile create mode 100644 drivers/net/dpdkoin/meson.build create mode 100644 drivers/net/dpdkoin/rte_eth_dpdkoin.c create mode 100644 drivers/net/dpdkoin/rte_pmd_dpdkoin_version.map
Is it possible to have a unit test for this PMD? We could have the robot run some quick tests for us... ;-)
Quoted 73 lines · Matteo Croce
DPDK polls the packet in a busy loop. This means that CPU constantly spins looking for packets, regardless of the network traffic.
DPDK does this to reduce latency and avoid using interrupts, at expense of
efficiency: this might consume more processing power and generate more heat than needed, potentially increasing the TCO of a DPDK appliance.Here comes DPDKoin. DPDKoin is a DPDK PMD, which instead of moving packets, mines cryptocurrencies.
DPDKoin just does a few calculations to every poll cycle, this means that when the network is loaded, DPDKoin consumes just a few cycles, but when there is no traffic, DPDKoin mines currencies in a busy loop. The coins are mined with no extra consumption, as the CPU would spin anyway.This is a system running with two 10G cards running with DPDK:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8223 root 10 -10 260.6g 597516 19100 S 199.8 0.5 0:17.89 testpmdAnd this is the same system with a DPDKoin port added:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9438 root 10 -10 260.6g 598892 19800 S 199.8 0.5 0:19.43 testpmdAs you can see, we don't observe any change in the CPU usage, and besides, the earned coins lowers the appliance TCO.
Just for reference, a test run log follows:
$ sudo testpmd --no-huge -m 1024 --no-pci --vdev eth_dpdkoin0 --vdev eth_dpdkoin1 EAL: Detected 8 lcore(s) EAL: Detected 1 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: Probing VFIO support... testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=203456, size=2176, socket=0 testpmd: preferred mempool ops selected: ring_mp_mc Configuring Port 0 (socket 0) Port 0: 4A:50:3C:33:55:21 Configuring Port 1 (socket 0) Port 1: BA:BB:0A:BB:0C:CA Checking link statuses... Done No commandline core given, start packet forwarding io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support enabled, MP allocation mode: native Logical Core 1 (socket 0) forwards packets on 2 streams: RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00io packet forwarding packets/burst=32
nb forwarding cores=1 - nb forwarding ports=2 port 0: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
port 1: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
libbitcoin 0.1: mining on CPU2
libbitcoin 0.1: mining on CPU4
Quoted 13 lines
--- config/common_base | 5 + drivers/net/Makefile | 1 + drivers/net/dpdkoin/Makefile | 23 + drivers/net/dpdkoin/meson.build | 3 + drivers/net/dpdkoin/rte_eth_dpdkoin.c | 696 ++++++++++++++++++ .../net/dpdkoin/rte_pmd_dpdkoin_version.map | 3 + mk/rte.app.mk | 1 + 7 files changed, 732 insertions(+) create mode 100644 drivers/net/dpdkoin/Makefile create mode 100644 drivers/net/dpdkoin/meson.build create mode 100644 drivers/net/dpdkoin/rte_eth_dpdkoin.c create mode 100644 drivers/net/dpdkoin/rte_pmd_dpdkoin_version.map
I see you are requesting this for backport to stable branches. While this is not fixing a specific commit per se, it is clearly fixing a gap whereby it would be unfair for stable users to miss out on any potential bonanza.
Unfortunately there is a blocker due to validation. Normally, we might be concerned by lack of it, but in this case the concern is that it might encourage too much validation and many lengthy stress tests that could impact release dates.
Quoted 93 lines · On Wed, 1 Apr 2020 21:51:53 +0100 Kevin Traynor <[email protected]> wrote:
Quoted 73 lines · Matteo Croce
DPDK polls the packet in a busy loop. This means that CPU constantly spins looking for packets, regardless of the network traffic.
DPDK does this to reduce latency and avoid using interrupts, at expense of
efficiency: this might consume more processing power and generate more heat than needed, potentially increasing the TCO of a DPDK appliance.Here comes DPDKoin. DPDKoin is a DPDK PMD, which instead of moving packets, mines cryptocurrencies.
DPDKoin just does a few calculations to every poll cycle, this means that when the network is loaded, DPDKoin consumes just a few cycles, but when there is no traffic, DPDKoin mines currencies in a busy loop. The coins are mined with no extra consumption, as the CPU would spin anyway.This is a system running with two 10G cards running with DPDK:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8223 root 10 -10 260.6g 597516 19100 S 199.8 0.5 0:17.89 testpmdAnd this is the same system with a DPDKoin port added:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9438 root 10 -10 260.6g 598892 19800 S 199.8 0.5 0:19.43 testpmdAs you can see, we don't observe any change in the CPU usage, and besides, the earned coins lowers the appliance TCO.
Just for reference, a test run log follows:
$ sudo testpmd --no-huge -m 1024 --no-pci --vdev eth_dpdkoin0 --vdev eth_dpdkoin1 EAL: Detected 8 lcore(s) EAL: Detected 1 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: Probing VFIO support... testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=203456, size=2176, socket=0 testpmd: preferred mempool ops selected: ring_mp_mc Configuring Port 0 (socket 0) Port 0: 4A:50:3C:33:55:21 Configuring Port 1 (socket 0) Port 1: BA:BB:0A:BB:0C:CA Checking link statuses... Done No commandline core given, start packet forwarding io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support enabled, MP allocation mode: native Logical Core 1 (socket 0) forwards packets on 2 streams: RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00io packet forwarding packets/burst=32
nb forwarding cores=1 - nb forwarding ports=2 port 0: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
port 1: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0 RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0 TX offloads=0x0 - TX RS bit threshold=0
libbitcoin 0.1: mining on CPU2
libbitcoin 0.1: mining on CPU4Quoted 13 lines
--- config/common_base | 5 + drivers/net/Makefile | 1 + drivers/net/dpdkoin/Makefile | 23 + drivers/net/dpdkoin/meson.build | 3 + drivers/net/dpdkoin/rte_eth_dpdkoin.c | 696 ++++++++++++++++++ .../net/dpdkoin/rte_pmd_dpdkoin_version.map | 3 + mk/rte.app.mk | 1 + 7 files changed, 732 insertions(+) create mode 100644 drivers/net/dpdkoin/Makefile create mode 100644 drivers/net/dpdkoin/meson.build create mode 100644 drivers/net/dpdkoin/rte_eth_dpdkoin.c create mode 100644 drivers/net/dpdkoin/rte_pmd_dpdkoin_version.mapI see you are requesting this for backport to stable branches. While this is not fixing a specific commit per se, it is clearly fixing a gap whereby it would be unfair for stable users to miss out on any potential bonanza.
Quoted 5 lines
Unfortunately there is a blocker due to validation. Normally, we might be concerned by lack of it, but in this case the concern is that it might encourage too much validation and many lengthy stress tests that could impact release dates.
Could we fund the CI lab with this?