Giter VIP home page Giter VIP logo

udpdk's Introduction


[Paper] [Video]

UDPDK is a minimal UDP stack based on DPDK for fast point-to-point communication between servers.
It runs completely in userspace, so that you can move your packets quickly without going through the cumbersome kernel stack.
Moreover, thanks to its POSIX-like API, porting existing applications to UDPDK is dead easy!1

What UDPDK is:

  • A transport-level network stack
  • A POSIX-like implementation of UDP sockets on top of DPDK
  • A framework for low-latency packet exchanging

What UDPDK is NOT:

  • A complete IP stack
  • A mechanism to interconnect large networks nodes
  • A software running on low-end consumer NICs

1Some features may be unsupported yet.

Table of Contents

Requirements

In order to use UDPDK, your machines must be equipped with DPDK-enabled NICs; these are typically found in servers, not in laptops and desktop machines. The list of hardware officially supported by DPDK is available here. Specifically, UDPDK has been developed and tested on Intel X710-DA2 with igb_uio and vfio drivers; other devices should work as long as DPDK supports them.

Install Dependencies

UDPDK requires:

  • DPDK 20.05
  • inih (any)

They are already included in this repository as submodules, so pull them:

git submodule init
git submodule update

DPDK

DPDK is the pivotal element of UDPDK. It manages the NIC and implements Ethernet.

cd dpdk/usertools
./dpdk-setup.sh

From the menu, do the following:

  1. Compile for your specific arch, usually x86_64-native-linuxapp-gcc
  2. Load the vfio module
  3. Configure hugepages (e.g. 1024M for each NUMA node)
  4. Bind the NIC to vfio driver, specifying its PCI address

⚠️ If you use the VFIO driver, then you must enable the IOMMU in your system.
To enable it, open /etc/default/grub, add the flag intel_iommu=on in GRUB_CMDLINE_LINUX_DEFAULT, then sudo update-grub and finally reboot.

inih

inih is used for convenience to parse .ini configuration files.

cd inih
meson build
cd build
ninja

Build and install UDPDK

UDPDK builds into a static library, which eventually needs to be linked with the final application.

cd udpdk
make
sudo make install

API

The API of UDPDK closely resembles that of good old BSD sockets:

int udpdk_socket(int domain, int type, int protocol);
int udpdk_bind(int s, const struct sockaddr *addr, socklen_t addrlen);
int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t *optlen);
ssize_t udpdk_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
ssize_t udpdk_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
int udpdk_close(int s);

In addition, the following methods are required for the proper setup and teardown of DPDK internals (structures and processes):

int udpdk_init(int argc, char *argv[]);
void udpdk_interrupt(int signum);
void udpdk_cleanup(void);

Note: select() is not implemented yet

Examples

The apps/ folder contains two simple examples: a ping-pong and a pkt-gen application.

How it works

UDPDK runs in two separate processes: the primary is the one containing the application logic (i.e. where syscalls are called), while the secondary (poller) continuously polls the NIC to send and receive data. The packets are exchanged between the application and the poller through shared memory, using lockless ring queues.

Performance

We compare UDPDK against standard UDP sockets in terms of throughput and latency.

Environment

Two identical servers are connected point-to-point on a 10G interface. Their specs are:

CPU: Intel Xeon E5-2640 @2.4GHz
RAM: 64GB
OS: Ubuntu 18.04
Kernel: 4.15.0
NIC: Intel X710 DA2 10GbE
NIC driver: VFIO (DPDK) or i40e (normal sockets)

Throughput

We measure the maximum throughput achieved varying the packet size.
The latter is inclusive of the UDP, IP and MAC headers.

As shown in the picture, UDPDK is up to 18x better than traditional sockets.
It should be noted that UDPDK saturates the 10G connection, which unfortunately is all we had: a 40G inferface would make it definitely shine!

Throughput chart

Latency

We measure the latency and its jitter.
Again, UDPDK proves to be an order of magnitude better than standard sockets.

UDPDK Standard
Mean (μs) 13.92 116.57
Std (μs) 0.74 18.49

License

The code of UDPDK is released under BSD 3-Clause license.

Citing

This work has been presented at IEEE NFV-SDN 2021, the 7th IEEE Conference on Network Functions Virtualization and Software-Defined Networking. The authors are: L. Lai, G. Ara, T. Cucinotta, K. Kondepu, L. Valcarenghi.

Lai, Leonardo, et al. "Ultra-low Latency NFV Services Using DPDK" 2021 IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN). IEEE, 2021.

Contributing

Everyone is more than welcome to contribute to UDPDK by implementing new features, extending existing ones or simply reporting bugs/issues.

udpdk's People

Contributors

leoll2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

udpdk's Issues

use dpdk send only

can I use your lib send udp packet only, and recv udp packet from epoll(linux kernel)?

POLLINIT: Waiting to initialize IPC...

Hello,
I started the pktgen with default command ./pktgen -c ../../config.ini -f send -s 100 -r 10000 -l pktgen-send.log
It keeps saying
POLLINIT: Waiting to initialize IPC...

my config.ini as below
[dpdk]
cores_primary=2
lcores_secondary=4
n_mem_channels=2

[port0]
mac_addr=00:11:22:33:44:50
ip_addr=127.0.0.1

[port0_dst]
mac_addr=00:11:22:33:44:60

the 2 mac addr (50 and 60) are the VFs setup on my NIC.
I'm new to DPDK. Your comments are very welcome.

Can't Receive packets using rte_eth_rx_burst

When using the ping-pong application or the pkt-gen application, the sender is able to transmit packets but, at the receiver side on call to rte_eth_rx_burst it get's stuck as it returns a value of 0 every time in the poller body function. As a result it is not able to flush the packet to the rx-queue which is used by the UDPDK recvfrom to retrieve the packets. I have confirmed that the packet is reached at the receiver side using rte_eth_stats_get() method but not sure why rte_eth_rx_burst is not able to retrieve the packets?

Sender side config.ini

UDPDK configuration file

[dpdk]

lcores_primary=2
lcores_secondary=2
n_mem_channels=2

[port0]

mac_addr=50:9a:4c:27:6b:58
ip_addr=192.168.10.100

[port0_dst]

mac_addr=50:9a:4c:27:6a:4a

Receiver Side config.ini:

UDPDK configuration file

[dpdk]

lcores_primary=2
lcores_secondary=2
n_mem_channels=2

[port0]
mac_addr=50:9a:4c:27:6a:4a
ip_addr=192.168.10.101

[port0_dst]
mac_addr=50:9a:4c:27:6b:58

dpdk-devbind.py Statistics:

Network devices using DPDK-compatible driver

0000:00:1f.6 'Ethernet Connection (5) I219-LM 15e3' drv=uio_pci_generic unused=e1000e,vfio-pci

No 'Baseband' devices detected

No 'Crypto' devices detected

No 'DMA' devices detected

No 'Eventdev' devices detected

No 'Mempool' devices detected

No 'Compress' devices detected

No 'Misc (rawdev)' devices detected

No 'Regex' devices detected

Pingpong doesn't ping-pong

Problem

POLLBODY: Received non-IPv4 packet, showing content below:
Dumping payload [len = 60]:
    0: f8 b4 6a a0 7a fc 18 31 bf cf f8 5e 08 00 45 00 ..j.z..1...^..E.
   16: 00 2c 00 00 00 00 40 11 66 bf 0a 00 00 01 0a 00 .,[email protected].......
   32: 00 02 27 11 27 10 00 18 00 00 50 51 e4 00 d7 55 ..'.'.....PQ...U
   48: 00 00 27 67 7b f5 44 7f 00 00 00 00 

I got this message at the ping-side so it seems that the pong-side does not send a packet in a right way. As a result, a looping does not work at all. Is it matter in the core of UDPDK? Or should I change something in the application-side?

can't use pktgen to send udp traffic to public server from local VM / public server

we setup the full dpdk environment in VM. then changed the config.ini a bit by changing the "port0" mac & ip to dpdk binded ethernet address and ip assigned to that interface. Then in main.c, I changed the recv_ip to my public server ip. I started the pktgen after make, I am seeing those "vm_dpdk_ip > public_server_ip" packets from host pc through tcpdump command but I am not actually getting those udp packets in the server (checked via tcpdump). The server is just simple linux server which was meant to receive packets and my VM's dpdk binded ip was meant to sent. my main target was to check whether I am able send/receive udp packets using dpdk in public internet. What am I doing wrong here ? Thanks in advance

Target does not have the DPDK KNI Module & KNI: Can not open /dev/kni

I have installed UDPDK on my server machine which has enp5s0f0 and enp5s0f1 NIC card and I followed all the steps as mentioned in the Readme.md file but when I was inserting KNI module while setting up linux environment by using ./dpdk-setup.sh, it is giving me the error "Target does not have the DPDK KNI Module. To fix, please try to rebuild target". I did rebuilt the target but the error remains the same. Also while I was running the sample applications (ip_pipeline) under example folder of DPDK, I am stucking at KNI: Can not open /dev/kni message.

What I have done

1.) I read the DPDK Documentation from [https://doc.dpdk.org/guides/prog_guide/kernel_nic_interface.html](the following page) and in its 47.1 point it states that you need to load rte_kni.ko file which is not available in /kernel/linux/kni of DPDK (version 20.05).
2.) I enabled CONFIG_RTE_LIBRTE_KNI=y which is in UDPDK/deps/dpdk/config# nano common_base.

How to enable/import KNI module into DPDK. And how to get rte_kni.ko file in /kernel/linux/kni.

pingpong sample application stuck in rte_eth_tx_burst()

Hello

Thank you for having developed and open-sourced UDPDK.

When I execute the pingpong application, the call to rte_eth_tx_burst() in udpdk_poller.c:flush_tx_table() is stuck. As a result no message is sent over the network. Strangely, when executing the application with gdb, adding a breakpoint to rte_eth_tx_burst(), and issuing next commands, the packet is sent over the network and correctly received by the other endpoint. This suggests to me there is a data race somewhere in the code.

I had to make a few small changes to the code and compilation process to fit with my environment (AMD EPYC 7543 and Mellanox ConnectX-6 Dx) that you can find here. However they should not impact the code in any negative way.

By any chance, would you have any pointers or ideas on the problem origin and/or how to debug it?

Number of cores needed

We have an instance with 2 cores , 2 NICs.

Are two cores enough?

[root@colo-14 pingpong]# LD_LIBRARY_PATH=/usr/local/lib64  ./pingpong -c ../../config.ini -f pong
Application args: ./pingpong -l 1 -n 2 --proc-type=primary -- -f pong 
Poller args: ./pingpong -l 1 -n 2 --proc-type=secondary 
EAL: Detected 2 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Detected 2 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: No available hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL:   Invalid NUMA socket, default to 0
EAL:   Invalid NUMA socket, default to 0
EAL: Probe PCI driver: net_ixgbe_vf (8086:10ed) device: 0000:00:04.0 (socket 0)
EAL: No legacy callbacks, legacy socket not created
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_174955_199a03d762812
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
INIT: Could not set port 0 to promiscous mode
INIT: Cannot initialize RX port 0
INTR: Killing the poller process (174955)...
CLOSE: Killing the poller process (174955)...
Caught signal 15 in pingpong main process
INTR: Killing the poller process (0)...
EAL:   Invalid NUMA socket, default to 0
EAL:   Invalid NUMA socket, default to 0
EAL: Probe PCI driver: net_ixgbe_vf (8086:10ed) device: 0000:00:04.0 (socket 0)
EAL: No legacy callbacks, legacy socket not created
POLLINIT: Waiting to initialize IPC...
POLLINIT: Waiting to initialize IPC...

Not sure how to fix this ...

unable to establish communication with the assigned IP

I am currently working with UDPDK and facing challenges in configuring IP addresses for my server machine's NICs.
My goal is to efficiently receive packets from a switch,which is connected to a server machine having 3 NIC card of interface name enp130s0f0, enp5s0f0, enp5s0f1 from which enp5s0f0 is connected to switch and I have binded enp5s0f0's PCI address to the dpdk.

To receive this package, I installed UDPDK which is mentioned on your github repository, edited the 'config.ini' file, and mentioned the MAC address of enp5s0f0 and assigned an IP and successfully compiled the UDPDK, and sample application example such as pktgen and pingpong are running successfully on the server machine. However, I am still unable to establish communication with the assigned IP, i.e. When I run the 'ping' command from another system for the assigned IP address, I receive a "Destination Host Unreachable" error.

Could you please provide guidance on correctly assigning the IP address within the UDPDK stack to enable packet reception from the switch?

Thanks a lot in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.