Hi, lately I began to study the driver’s source code of MLNX_OFED_LINUX-4.0-2.0.0.1-rhel7.3-x86_64.
When proceeding to the Network protocol stack, I met some problem,hoping for some guide from friends in the community.
Please let me show the question:
Now I’m using verbs api(black line at the below pic 2) and familiar with all its procedure(reading source code and mannual) but the abstract layer below it is not familiar.
So I want to know:
How is the RoCE v2 packing udp and ip header into the packet?(uh…I’m meaning where it’s done,because I haven’t found relevant code about it,but do have some clue,seeing below).And I’m not sure if this procudure is done by this driver or by system network stack.Somebody know it?Very pleasure to learn from you!
1.source code from MLNX_OFED_LINUX-4.0-2.0.0.1-rhel7.3-x86_64/MLNX_OFED_SRC-4.0-2.0.0.1/SRPMS/libmlx5-1.2.1mlnx1/src/mlx5.c:
Following your indication,I locate the prototype of ibv_modify_qp in kernel layer and it do set some attributes of the QP context and encapsulate the udp sport into the path attributes of QP
but there are some extra questions that confuse me.May I ask you for advices?
we use -q = 6 , and we found the Queue pair value varies from 275~280 (0x000113-0x000118), however, there is only one udp port which is 49152. Does that means all the queue pairs mapped to only one udp port?
Finally, It seems that there is a QP-Port mapping algorithm to allocate port for QP according to the system load(I guess)
Because at the beginning there is only one port for network communication but as the test numbers increase it gradually to allocate more ports for communication(Something like a warmup procedure).So you may need to try more experiments…
Each QP has its own context. After QP is created, software set the attributes of the QP context by ibv_modify_qp. These attributes are used by hardware to encapsulate the headers.
HCA can support up to 16 millions QPs. But there are only up to 64K UDP port number, and some UDP port was reserved for some specific application. So it is not 1:1 mapping between QP and src UDP port, but N:1 mapping. Always, a couple/group of QPs share one src UDP port. The main purpose of using scrambled src UDP port is for load balance in network. N:1 mapping works for that.
Your experiment shows that in that case, all QP are mapped to only one UDP port.
According to our experiments, the mapping method is dynamic and changes with some factors(Network load and QP creation time I guess).
If you want to see it, you may do more experiments and change the QP num or run several sample process individually at the same time and capture the packets.
I am having similar issue, do you hava any advice ? From my side, i tried to assign a number to -q parameter , However, i could’t not be abole to get different udp source ports, only one (49152) instead. I am using newest MLNX-OFED 4.2 .
For that source file mlx5.c, do i need to compile or like edit it to make it work ?
I am using MLNX_OFED_Linux 4.2 and yes RoCEv2, by using ib_write_bw to test RDMA performance, here i assigned -q a number, 20 for example, and capture and save them to file by TCPDUMP tool. In Wireshark i see UDP source ports are the same 49152, so i want to know how could i get different source ports. Do i need to modify any files like that mlx5.c? or any other additional configurations?