I am running dpdk-stable-18.11.8 on Centos 7. My test code transmits udp packets with a simple payload string ‘Hello from dpdk’ to a remote host.
Immediately before transmission a dump of the mbuf looks like this:
dump mbuf at 0x53e4e92c0, iova=73e4e9340, buf_len=2176
pkt_len=57, ol_flags=c0000000000000, nb_segs=2, in_port=65535
segment at 0x53e4e92c0, data=0x53e4e9396, data_len=42
Dump data at [0x53e4e9396], len=42
00000000: 94 40 C9 1F C4 DB 94 40 C9 1E 13 7D 08 00 45 B8 | .@.....@...}..E.
00000010: 00 2B 00 00 00 00 40 11 F5 E8 C0 A8 01 69 C0 A8 | [email protected]..
00000020: 01 68 0B B9 0B B8 00 17 64 2D | | | | | | | .h......d-
segment at 0x53e146e40, data=0x53e4fbbc0, data_len=15
Dump data at [0x53e4fbbc0], len=15
00000000: 48 65 6C 6C 6F 20 66 72 6F 6D 20 64 70 64 6B | | Hello from dpdk
Running tcpdump with command:
tcpdump -A -nni eno2 src 192.168.1.105 -vv -X
on the remote host yields:
10:44:33.022538 IP (tos 0xb8, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 43)
192.168.1.105.3001 > 192.168.1.104.3000: [udp sum ok] UDP, length 15
0x0000: 45b8 002b 0000 0000 4011 f5e8 c0a8 0169 [email protected]
0x0010: c0a8 0168 0bb9 0bb8 0017 642d 0000 0000 ...h......d-....
0x0020: 0000 0000 0000 0000 0000 0000 0000 ..............
So the udp packet arrives but the payload is all zeros.
(The transmitter is 192.168.1.105 and the receiver is 192.168.1.104).
Here’s a snippet of my code that adds space for the udp and ip headers to the mbuf in the transmitter:
p_udp_hdr = (struct udp_hdr*)rte_pktmbuf_prepend(ptMbuf, (uint16_t)sizeof(struct udp_hdr));
p_ip_hdr = (struct ipv4_hdr*)rte_pktmbuf_prepend(ptMbuf, (uint16_t)sizeof(struct ipv4_hdr));
I’m not sure where to look, as the code is adapted from working code from another project. It may be relevant that, in the other project, checksums were generated by the NIC but in this project I have calculated them in software; but tcpdump says the checksums are correct.
Any advice would be appreciated.
2
Answers
I believe at least part of your problem is that, while you’ve modified the pkt_len field in your packet to reflect the payload you’ve added, data_len is still just 42 bytes. That’s just the length of your L2-4 headers. You want to add space for your payload there as well.
Also, I note that the nb_segs field in your packet is 2, indicating that you have a chain of packets. Do you? I wouldn’t expect having that wrong would cause the problem you’re seeing, but it’s probably something you’d like to fix up, regardless.
[EDIT-2] Issue because PKT_TX_MSEGS is not updated in application. Refelcted in above answer and comment
Hi @DavidA requesting you to check the dev_configure TX offload flag for multi-segment behaviour. – Vipin Varghese Jul 2 '20 at 12:13
You need to enable multi segments in the eth_dev configuration as indicated
below:
[EDIT-1] also shared in comment ‘Hi @DavidA requesting you to check the dev_configure TX offload flag for multi-segment behaviour. ‘.