Mellanox / libvma

Linux user space library for network socket acceleration based on RDMA compatible network adaptors
https://www.mellanox.com/products/software/accelerator-software/vma?mtag=vma
Other
557 stars 152 forks source link

Rust TcpStream clone cannot send/recv through libvma #1050

Open boranby opened 8 months ago

boranby commented 8 months ago

Subject

I have a system setup where listening the UDP stream from one port and send/recv TCP from the other port of my NIC. All of the parts are working except the cloned TcpStream part. Using: https://doc.rust-lang.org/std/net/struct.TcpStream.html#method.try_clone

Issue type

Configuration:

Actual behavior:

I am using a separate thread to send and receive heartbeats so I pass the cloned TcpStream to that thread. The main TcpStream can send and receive packets but The cloned TcpStream cannot send and receive any packets, and TcpStream::write_all returns with Broken pipe error. When I don't use libvma and offload with OS, everything works as expected.

Expected behavior:

libvma is expected to work same as the OS to offload the traffic from the cloned TcpStream.

Steps to reproduce:

Server gist: https://gist.github.com/boranby/02464d37e188ba1fe6032afc79ba5d50 Client gist: https://gist.github.com/boranby/787343c64d6c5292369fd722977641ea

Need to update the IP addresses and route the Multicast address via port0 and route the TCP connection via port1.

You should see that login packet and login accepted packets reaches, but heartbeats don't reach.

igor-ivanov commented 8 months ago

Hello @boranby, I think in your application scenario you meet libvma limitations such as VMA does not work as server/client from single process and it has restriction in loopback flow usage.

boranby commented 8 months ago

Hi @igor-ivanov , thanks for your response.

I am running the client and server in two different machines. Does libvma consider cloning a TcpStream to read/write from two threads as server/client from single process?

igor-ivanov commented 8 months ago

do you mean that application uses thread0 for read and thread1 for write from the same process? Note: it should be ok from libvma. I noticed 127.0.0.1 ip in application sources you provided.

boranby commented 8 months ago

It is more like

boranby commented 8 months ago

I suspected that TCPStream clone has the problem. When I use only one thread to read/write TCP, it works.