ansyun / dpdk-ans

ANS(Accelerated Network Stack) on DPDK, DPDK native TCP/IP stack.
https://ansyun.com
BSD 3-Clause "New" or "Revised" License
1.16k stars 324 forks source link

How to Enable ip Fragmentation #123

Closed up0617 closed 4 years ago

up0617 commented 4 years ago

hi, I'm sending 5800B data per send call and ip fragmentation didn't work. By the same application without dpdk-ans, the packet is devided by mtu(1500 by default) and send.

Is there any flag or option to enable ip fragmentaion?

and another question is that, is jumbo frame supported by using option '--enable-jumbo --max-pkt-len 9000' ? or need to change code by using 'int netdp_intf_set_mtu(caddr_t name, int *mtu)' api?

bluenet13 commented 4 years ago

The max IP fragmentaion is defined in DPDK. What is ans verson do you use? Your version is very old. Shall use ans_iface_set_mtu to set MTU.

up0617 commented 4 years ago

Thanks for the quick answering.

(I'm using the latest version. I saw old API netdp*** at the old issue in 2016.)

For the fragmentation, I ran DPDK IP fragmentation example and it well fragments packet as its MTU configured.

As I know, IP fragmentation is not a sort of EAL option but can be enabled by related API like 'rte_ip_frag.h->rte_ipv4_fragment_packet()'.

Following the ans.map file, 'rte_ip_frag.h' and 'rte_ipv4_fragment_packet()' are already imported and used.

Also anscli shows mtu is set as 1500, in below ans> ip addr show veth0: mtu 1500

Then what I anticipate is that, 5800B data should be fragmented to 1500B size and sent.

But it doesn't as shown anscli stats

ans> ip stats show Total packets received :7448 Checksum bad :0 Packet too short :0 Not enough data :0 IP header length < data size :0 IP length < ip header length :0 Fragments received :0 Frags dropped (dups, out of space) :0 Fragments timed out :0 Packets forwarded :2320 Packets fast forwarded :0 Packets rcvd for unreachable dest :0 Packets forwarded on same net :2320 Unknown or unsupported protocol :0 Datagrams delivered to upper level :5128 Total ip packets generated here :3608 Lost packets due to nobufs, etc. :0 Total packets reassembled ok :0 Datagrams successfully fragmented :0 Output fragments created :0 Don't fragment flag was set, etc. :0 Error in option processing :0 Packets discarded due to no route :0 IP version != 4 :0 Total raw ip packets generated :0 IP length > max ip packet size :0 Multicasts for unregistered grps :0 No match gif found :0 Invalid address on header :0 Packets filtered :0

bluenet13 commented 4 years ago

The limitaion in DPDK: / ip_fragmentation defines /

define RTE_LIBRTE_IP_FRAG_MAX_FRAG 4

You may try 3000B.

up0617 commented 4 years ago

Oh Thanks very much for your answer.

IP Fragmentation is actually works at 5800B, for exactly up to 5912B packet Send. 5912B = (1514(mtu)-34(header) ) * 4(max frag) - 8(udp header of reassembled packet)

Wireshark shows UDP+ IPv4 packets are well fragmented up to 1514. but anscli only shows stats about Frags only when there are drops, like below::

//when send more then mtu*maxFrag Frags dropped (dups, out of space) :1816

//when recv kernel dump shows ip fragmented well but cli is not. Datagrams successfully fragmented :0 Output fragments created :0

It's all clear about IP fragmentation. Thanks for your help again!