Hi, 

By default udp computes its mss starting from a 1500 mtu. You can avoid this by 
either changing the default, i.e., in startup.conf under the udp stanza add 
“mtu <value>”, or alternatively you can force mss on each connect, by 
explicitly setting it in the remote endpoint’s transport_endpoint_cfg_t 
structure. 

If the dgram written through app_send_dgram is shorter than mss, the 
session-queue node sends it out as one “packet”, which could be a chained 
buffer if mss > ~2kB (default buffer size). IP layer could still decide to 
fragment the resulting buffer, subject to the output interface’s mtu. 
Otherwise, i.e. dgram larger than mss, session-queue forcefully fragments the 
dgram, this is probably something that you don’t want. 

Regards,
Florin

> On Jul 21, 2020, at 5:07 AM, [email protected] wrote:
> 
> hi:
>    When sending 1500 bytes data with session app_send_dgram api, I find 
> session-queue node will split the data to two udp packets, then vpp will 
> sending to two separate IP packets out with no fragmentation. Even I set 
> interface MTU with 9000, It's still sending two separate IP packets. I think 
> the way session-queue process the app_send_dgram data have two logic logic 
> bug.
>   1. If app_send_dgram's sending length more then snd_mss, session-queue 
> should do udp fragmentation, rather simplely separating to other udp packets.
>   2. if app_send_dgram's sending length less then interface's MTU, 
> session-queue should sending one ip packet out. But the MTU seems have no 
> effect on session-queue.
> 
> Below is the debug log:
> DBGvpp# trace add session-queue 20
> DBGvpp# sh trace
> ------------------- Start of thread 0 vpp_main -------------------
> No packets in trace buffer
> ------------------- Start of thread 1 vpp_wk_0 -------------------
> Packet 1
>
> 00:06:06:009843: session-queue
>   session index 0 thread index 1
> 00:06:06:009860: ip4-lookup
>   fib 0 dpo-idx 1 flow hash: 0x00000000
>   UDP: 192.168.7.101 -> 192.168.7.100
>     tos 0x00, ttl 255, length 1500, checksum 0x0000 (should be 0x25f7) dscp 
> CS0 ecn NON_ECN
>     fragment id 0x0000
>   UDP: 12738 -> 500
>     length 1480, checksum 0x0000
> 00:06:06:009868: ip4-rewrite
>   tx_sw_if_index 1 dpo-idx 1 : ipv4 via 192.168.7.100 eth0: mtu:9000 next:3 
> 0000000000010000000000020800 flow hash: 0x00000000
>   00000000: 0000000000010000000000020800450005dc00000000ff110000c0a80765c0a8
>   00000020: 076431c201f405c80000010101010101010101010101010101010101
> 00:06:06:009873: eth0-output
>   eth0 
>   IP4: 00:00:00:00:00:02 -> 00:00:00:00:00:01
>   UDP: 192.168.7.101 -> 192.168.7.100
>     tos 0x00, ttl 255, length 1500, checksum 0x0000 (should be 0x25f7) dscp 
> CS0 ecn NON_ECN
>     fragment id 0x0000
>   UDP: 12738 -> 500
>     length 1480, checksum 0x0000
> 00:06:06:009878: eth0-tx
>   eth0 tx queue 1
>   buffer 0x27685e: current data 98, length 1514, buffer-pool 0, ref-count 1, 
> trace handle 0x1000000
>                    local ip4 offload-ip-cksum offload-udp-cksum l3-hdr-offset 
> 112 l4-hdr-offset 132 
>   PKT MBUF: port 65535, nb_segs 1, pkt_len 1514
>     buf_len 2176, data_len 1514, ol_flags 0xf0000000000000, data_off 226, 
> phys_addr 0x47a1800
>     packet_type 0x0 l2_len 14 l3_len 20 outer_l2_len 0 outer_l3_len 0
>     rss 0x0 fdir.hi 0x0 fdir.lo 0x0
>     Packet Offload Flags
>       PKT_TX_IP_CKSUM (0x0000) IP cksum of TX pkt. computed by NIC
>       PKT_TX_TCP_CKSUM (0x0000) TCP cksum of TX pkt. computed by NIC
>       PKT_TX_SCTP_CKSUM (0x0000) SCTP cksum of TX pkt. computed by NIC
>   IP4: 00:00:00:00:00:02 -> 00:00:00:00:00:01
>   UDP: 192.168.7.101 -> 192.168.7.100
>     tos 0x00, ttl 255, length 1500, checksum 0x0000 (should be 0x25f7) dscp 
> CS0 ecn NON_ECN
>     fragment id 0x0000
>   UDP: 12738 -> 500
>     length 1480, checksum 0x95f3
>
> Packet 2
>
> 00:06:06:009940: session-queue
>   session index 0 thread index 1
> 00:06:06:009949: ip4-lookup
>   fib 0 dpo-idx 1 flow hash: 0x00000000
>   UDP: 192.168.7.101 -> 192.168.7.100
>     tos 0x00, ttl 255, length 66, checksum 0x0000 (should be 0x2b91) dscp CS0 
> ecn NON_ECN
>     fragment id 0x0000
>   UDP: 12738 -> 500
>     length 46, checksum 0x0000
> 00:06:06:009952: ip4-rewrite
>   tx_sw_if_index 1 dpo-idx 1 : ipv4 via 192.168.7.100 eth0: mtu:9000 next:3 
> 0000000000010000000000020800 flow hash: 0x00000000
>   00000000: 00000000000100000000000208004500004200000000ff110000c0a80765c0a8
>   00000020: 076431c201f4002e0000010101010101010101010101010101010101
> 00:06:06:009954: eth0-output
>   eth0 
>   IP4: 00:00:00:00:00:02 -> 00:00:00:00:00:01
>   UDP: 192.168.7.101 -> 192.168.7.100
>     tos 0x00, ttl 255, length 66, checksum 0x0000 (should be 0x2b91) dscp CS0 
> ecn NON_ECN
>     fragment id 0x0000
>   UDP: 12738 -> 500
>     length 46, checksum 0x0000
> 00:06:06:009956: eth0-tx
>   eth0 tx queue 1
>   buffer 0x276837: current data 98, length 80, buffer-pool 0, ref-count 1, 
> trace handle 0x1000001
>                    local ip4 offload-ip-cksum offload-udp-cksum l3-hdr-offset 
> 112 l4-hdr-offset 132 
>   PKT MBUF: port 65535, nb_segs 1, pkt_len 80
>     buf_len 2176, data_len 80, ol_flags 0xf0000000000000, data_off 226, 
> phys_addr 0x47a0e40
>     packet_type 0x0 l2_len 14 l3_len 20 outer_l2_len 0 outer_l3_len 0
>     rss 0x0 fdir.hi 0x0 fdir.lo 0x0
>     Packet Offload Flags
>       PKT_TX_IP_CKSUM (0x0000) IP cksum of TX pkt. computed by NIC
>       PKT_TX_TCP_CKSUM (0x0000) TCP cksum of TX pkt. computed by NIC
>       PKT_TX_SCTP_CKSUM (0x0000) SCTP cksum of TX pkt. computed by NIC
>   IP4: 00:00:00:00:00:02 -> 00:00:00:00:00:01
>   UDP: 192.168.7.101 -> 192.168.7.100
>     tos 0x00, ttl 255, length 66, checksum 0x0000 (should be 0x2b91) dscp CS0 
> ecn NON_ECN
>     fragment id 0x0000
>   UDP: 12738 -> 500
>     length 46, checksum 0x9059
>
> DBGvpp# sh int 
>               Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     
> Counter          Count     
> eth0                              1      up          9000/0/0/0     rx 
> packets                   164
>                                                                     rx bytes  
>                  16136
>                                                                     tx 
> packets                     9
>                                                                     tx bytes  
>                   6428
>                                                                     drops     
>                    164
>                                                                     ip4       
>                    102
>                                                                     ip6       
>                     62
> local0                            0     down          0/0/0/0       drops     
>                      2
> DBGvpp# sh session verbose
> Thread 0: no sessions
>
> Connection                                        State          Rx-f      
> Tx-f
> [1:0][U] 192.168.7.101:12738->192.168.7.100:500   OPENED         0         0  
>        
> Thread 1: active sessions 1
> DBGvpp# 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#17018): https://lists.fd.io/g/vpp-dev/message/17018
Mute This Topic: https://lists.fd.io/mt/75701885/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to