Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infiniband soft_RoCE implement #1603

Open
wants to merge 25 commits into
base: dev
Choose a base branch
from

Conversation

FlashBarryAllen
Copy link

Soft-RoCE is the software implementation of the RDMA transport. It provides a high-performance, low-latency communication mechanism for applications that require direct memory access (DMA) between nodes.

Key features and benefits of Soft-RoCE:

Kernel Integration: Since Red Hat Enterprise Linux 7.4, the Soft-RoCE driver has been merged into the kernel, making it a standard component of the operating system.
User-Space Driver: The user-space driver is also integrated into the rdma-core package, providing a consistent API for applications to interact with the RDMA transport.
Performance: Soft-RoCE offers high performance and low latency, making it suitable for applications that require fast, reliable communication.
Flexibility: It can be used in a variety of network topologies, including Ethernet, Infiniband, and RoCE.
Soft-RoCE is also known as RXE. This is an alternative name for the technology.

And the wireshark has supported rdma, I think our pcapp should syn this feature.

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 64.22764% with 88 lines in your changes missing coverage. Please review.

Project coverage is 83.03%. Comparing base (ae8652f) to head (dd63809).
Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
Packet++/src/InfiniBandLayer.cpp 52.05% 69 Missing and 1 partial ⚠️
Tests/Packet++Test/Tests/InfiniBandTests.cpp 78.08% 16 Missing ⚠️
Packet++/header/InfiniBandLayer.h 90.90% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1603      +/-   ##
==========================================
- Coverage   83.13%   83.03%   -0.10%     
==========================================
  Files         276      279       +3     
  Lines       47315    47561     +246     
  Branches     9520     9540      +20     
==========================================
+ Hits        39337    39494     +157     
- Misses       7091     7177      +86     
- Partials      887      890       +3     
Flag Coverage Δ
fedora40 75.09% <48.29%> (-0.16%) ⬇️
macos-13 80.57% <58.54%> (-0.11%) ⬇️
macos-14 80.57% <58.54%> (-0.11%) ⬇️
macos-15 80.54% <58.54%> (-0.11%) ⬇️
mingw32 70.60% <42.85%> (-0.26%) ⬇️
mingw64 70.58% <42.85%> (-0.24%) ⬇️
npcap 84.99% <57.03%> (-0.21%) ⬇️
rhel94 74.94% <48.32%> (-0.13%) ⬇️
ubuntu2004 58.57% <40.12%> (-0.10%) ⬇️
ubuntu2004-zstd 58.71% <40.12%> (-0.10%) ⬇️
ubuntu2204 74.87% <47.97%> (-0.16%) ⬇️
ubuntu2204-icpx 61.40% <42.74%> (-0.08%) ⬇️
ubuntu2404 75.10% <48.29%> (-0.16%) ⬇️
unittest 83.03% <64.22%> (-0.10%) ⬇️
windows-2019 85.04% <57.03%> (-0.21%) ⬇️
windows-2022 85.06% <57.03%> (-0.21%) ⬇️
winpcap 85.02% <57.03%> (-0.20%) ⬇️
xdp 50.21% <47.97%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@tigercosmos tigercosmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I take a quick look. Seems that the code is not formatted, and missing documents. Please take a look at https://pcapplusplus.github.io/community#contribute. Also, please try to follow the coding style with the other places in the repo.

Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/ProtocolType.h Outdated Show resolved Hide resolved
Packet++/src/InfiniBandLayer.cpp Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Tests/Packet++Test/Tests/InfiniBandTests.cpp Outdated Show resolved Hide resolved
Packet++/CMakeLists.txt Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/ProtocolType.h Outdated Show resolved Hide resolved
Tests/Packet++Test/main.cpp Outdated Show resolved Hide resolved
@seladb
Copy link
Owner

seladb commented Oct 17, 2024

@FlashBarryAllen in order to review this PR I'd like to know the protocol better. I did some reading and here is what I found. Can you please confirm these are good sources to understand the protocol?

Packet++/CMakeLists.txt Show resolved Hide resolved
Packet++/header/ProtocolType.h Outdated Show resolved Hide resolved
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also provide a pcap/pcapng file so it's easier to open in Wireshark?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Here's the pcap of rocev2.
Uploading image.png…

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the pcap file? 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry, the file is too big to upload. I provide a small file of the roce.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can extract only the packet in InfiniBandPacket.dat and put it in a pcap file, then add the pcap file to the repo

Packet++/src/UdpLayer.cpp Outdated Show resolved Hide resolved
Tests/Packet++Test/CMakeLists.txt Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
@FlashBarryAllen
Copy link
Author

@FlashBarryAllen in order to review this PR I'd like to know the protocol better. I did some reading and here is what I found. Can you please confirm these are good sources to understand the protocol?

@seladb

@seladb
Copy link
Owner

seladb commented Oct 19, 2024

@FlashBarryAllen in order to review this PR I'd like to know the protocol better. I did some reading and here is what I found. Can you please confirm these are good sources to understand the protocol?

@seladb

Thank you @FlashBarryAllen ! Please see the PR comments above

@seladb
Copy link
Owner

seladb commented Oct 23, 2024

@FlashBarryAllen there are a few more open comments, can you please take of them before I continue to review the PR?

@FlashBarryAllen
Copy link
Author

@FlashBarryAllen there are a few more open comments, can you please take of them before I continue to review the PR?
@seladb ok, I'll finish the comments above.

3rdParty/OUIDataset/PCPP_OUIDataset.json Outdated Show resolved Hide resolved
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the pcap file? 🤔

Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/src/InfiniBandLayer.cpp Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/header/InfiniBandLayer.h Outdated Show resolved Hide resolved
Packet++/src/InfiniBandLayer.cpp Outdated Show resolved Hide resolved
@FlashBarryAllen
Copy link
Author

here's the pcap of rocev2@seladb
image

Packet++/header/InfiniBandLayer.h Show resolved Hide resolved
Packet++/src/InfiniBandLayer.cpp Show resolved Hide resolved
void setSolicitedEvent(bool se) const;

/**
* @return migreq which used to communicate migration state
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is migreq? 🤔

bool getMigrationState() const;

/**
* Set migreq
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: What is migreq?

Packet++/header/InfiniBandLayer.h Show resolved Hide resolved
Comment on lines +57 to +90
for (auto* curLayer = parsedPacket.getFirstLayer(); curLayer != nullptr; curLayer = curLayer->getNextLayer())
{
switch (curLayer->getProtocol())
{
case pcpp::Ethernet:
{
// now let's get the Ethernet layer
auto* ethernetLayer = parsedPacket.getLayerOfType<pcpp::EthLayer>();
PTF_ASSERT_NOT_NULL(ethernetLayer);
break;
}
case pcpp::VLAN:
{
// now let's get the Vlan layer
auto* vlanLayer = parsedPacket.getLayerOfType<pcpp::VlanLayer>();
PTF_ASSERT_NOT_NULL(vlanLayer);
break;
}
case pcpp::IPv4:
{
// let's get the IPv4 layer
auto* ipLayer = parsedPacket.getLayerOfType<pcpp::IPv4Layer>();
PTF_ASSERT_NOT_NULL(ipLayer);
break;
}
case pcpp::UDP:
{
// let's get the UDP layer
auto* udpLayer = parsedPacket.getLayerOfType<pcpp::UdpLayer>();
PTF_ASSERT_NOT_NULL(udpLayer);
PTF_ASSERT_EQUAL(udpLayer->getSrcPort(), 57236);
PTF_ASSERT_EQUAL(udpLayer->getDstPort(), 4791);
break;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this is not needed. Please look at other tests. You can only keep the InfiniBand part

Comment on lines +97 to +98
PTF_ASSERT_EQUAL(ibLayer->getSoliciteEvent(), false);
PTF_ASSERT_EQUAL(ibLayer->getMigrationState(), false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of PTF_ASSERT_EQUAL you can use PTF_ASSERT_FALSE

Comment on lines +103 to +104
PTF_ASSERT_EQUAL(ibLayer->getFecn(), false);
PTF_ASSERT_EQUAL(ibLayer->getBecn(), false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment on lines +123 to +142
pcpp::EthLayer ethLayer1(pcpp::MacAddress("02:7d:fa:01:17:40"), pcpp::MacAddress("02:7d:fa:00:10:01"),
PCPP_ETHERTYPE_IP);
pcpp::IPv4Layer ipLayer1(pcpp::IPv4Address("192.168.0.1"), pcpp::IPv4Address("192.168.0.2"));
pcpp::UdpLayer udpLayer1(30502, 4791);
pcpp::InfiniBandLayer infinibandLayer1(12, 0, 0, 0, 65535, 17, 1, 5557091);

pcpp::Packet infinibandPacket1(100);
PTF_ASSERT_TRUE(infinibandPacket1.addLayer(&ethLayer1));
PTF_ASSERT_TRUE(infinibandPacket1.addLayer(&ipLayer1));
PTF_ASSERT_TRUE(infinibandPacket1.addLayer(&udpLayer1));
PTF_ASSERT_TRUE(infinibandPacket1.addLayer(&infinibandLayer1));

PTF_ASSERT_EQUAL(infinibandPacket1.getLayerOfType<pcpp::UdpLayer>()->getDataLen(), 20);
PTF_ASSERT_NOT_NULL(infinibandPacket1.getLayerOfType<pcpp::InfiniBandLayer>());
PTF_ASSERT_EQUAL(udpLayer1.getDstPort(), 4791);
PTF_ASSERT_EQUAL(infinibandLayer1.getOpcode(), 12);
PTF_ASSERT_EQUAL(infinibandLayer1.getPartitionKey(), 65535);
PTF_ASSERT_EQUAL(infinibandLayer1.getQueuePairNumber(), 17);
PTF_ASSERT_EQUAL(infinibandLayer1.getAck(), 1);
PTF_ASSERT_EQUAL(infinibandLayer1.getPacketSequenceNumber(), 5557091);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write a test like this: https://github.com/seladb/PcapPlusPlus/blob/master/Tests/Packet%2B%2BTest/Tests/DhcpV6Tests.cpp#L123-L124

Basically what it does is:

  1. Create the InfiniBand layer
  2. Load the packet from the InfiniBand.dat file and get the InfiniBand layer
  3. Assert that the raw buffer length of the layer in (1) is equal to the raw buffer length of the layer in (2)
  4. Assert that the raw buffer of the layer in (1) is equal to the raw buffer of the layer in (2) using PTF_ASSERT_BUF_COMPARE

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add InfiniBandEditTest to test all of the setter methods

@egecetin egecetin linked an issue Nov 6, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can pcapp support soft-roce rdma packet header parse?
4 participants