Skip to content

Commit

Permalink
netdev-dpdk: Use guest TSO segmentation size hint.
Browse files Browse the repository at this point in the history
In a typical setup like:
guest A <-virtio-> OVS A <-vxlan-> OVS B <-virtio-> guest B

TSO packets from guest A are segmented against the OVS A physical port
mtu adjusted by the vxlan tunnel header size, regardless of guest A
interface mtu.

As an example, let's say guest A and guest B mtu are set to 1500 bytes.
OVS A and OVS B physical ports mtu are set to 1600 bytes.
Guest A will request TCP segmentation for 1448 bytes segments.
On the other hand, OVS A will request 1498 bytes segments to the HW.
This results in OVS B dropping packets because decapsulated packets
are larger than the vhost-user port (serving guest B) mtu.

2024-04-17T14:13:01.239Z|00002|netdev_dpdk(pmd-c03/id:7)|WARN|vhost0:
	Too big size 1564 max_packet_len 1518

vhost-user ports expose a guest mtu by filling mbuf->tso_segsz.
Use it as a hint.

This may result in segments (on the wire) slightly shorter than the
optimal size.

Reported-at: openvswitch/ovs-issues#321
Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Apr 19, 2024
1 parent 528255d commit f5a606a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2671,14 +2671,19 @@ netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)

if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
struct tcp_header *th = dp_packet_l4(pkt);
uint16_t link_tso_segsz;
int hdr_len;

if (tunnel_type) {
mbuf->tso_segsz = dev->mtu - mbuf->l2_len - mbuf->l3_len -
mbuf->l4_len - mbuf->outer_l3_len;
link_tso_segsz = dev->mtu - mbuf->l2_len - mbuf->l3_len -
mbuf->l4_len - mbuf->outer_l3_len;
} else {
mbuf->l4_len = TCP_OFFSET(th->tcp_ctl) * 4;
mbuf->tso_segsz = dev->mtu - mbuf->l3_len - mbuf->l4_len;
link_tso_segsz = dev->mtu - mbuf->l3_len - mbuf->l4_len;
}

if (!mbuf->tso_segsz || mbuf->tso_segsz > link_tso_segsz) {
mbuf->tso_segsz = link_tso_segsz;
}

hdr_len = mbuf->l2_len + mbuf->l3_len + mbuf->l4_len;
Expand Down

0 comments on commit f5a606a

Please sign in to comment.