summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSomnath Kotur <somnath.kotur@broadcom.com>2020-11-30 08:24:45 +0530
committerDamjan Marion <dmarion@me.com>2021-01-21 13:40:42 +0000
commit09332e9bc09748dd7eea564cb47f70863374ebf8 (patch)
tree0ff9eb4469a277749d0a780aedcc5bf2fb640a50 /src/plugins
parente1480a2c12ff764622dd2ae1bc9bce6cd25bcbdd (diff)
dpdk: do not use TSO for small packets
Asking for TSO (TCP Segmentation Offload) on packets that are already smaller than (headers + MSS) does not make sense and may not work on some HW. Fix to only set the TSO flag when a segmentation offload is really required, i.e when packet is large enough. Type: improvement Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com> Change-Id: I7830ae8474581c8e518fb4910f7863e10346bb62 Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/device.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 4d26abde214..ec33f6a4461 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -222,7 +222,7 @@ dpdk_buffer_tx_offload (dpdk_device_t * xd, vlib_buffer_t * b,
u32 tcp_cksum = b->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM;
u32 udp_cksum = b->flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
int is_ip4 = b->flags & VNET_BUFFER_F_IS_IP4;
- u32 tso = b->flags & VNET_BUFFER_F_GSO;
+ u32 tso = b->flags & VNET_BUFFER_F_GSO, max_pkt_len;
u64 ol_flags;
/* Is there any work for us? */
@@ -238,12 +238,15 @@ dpdk_buffer_tx_offload (dpdk_device_t * xd, vlib_buffer_t * b,
ol_flags |= ip_cksum ? PKT_TX_IP_CKSUM : 0;
ol_flags |= tcp_cksum ? PKT_TX_TCP_CKSUM : 0;
ol_flags |= udp_cksum ? PKT_TX_UDP_CKSUM : 0;
- ol_flags |= tso ? (tcp_cksum ? PKT_TX_TCP_SEG : PKT_TX_UDP_SEG) : 0;
if (tso)
{
mb->l4_len = vnet_buffer2 (b)->gso_l4_hdr_sz;
mb->tso_segsz = vnet_buffer2 (b)->gso_size;
+ /* ensure packet is large enough to require tso */
+ max_pkt_len = mb->l2_len + mb->l3_len + mb->l4_len + mb->tso_segsz;
+ if (mb->tso_segsz != 0 && mb->pkt_len > max_pkt_len)
+ ol_flags |= (tcp_cksum ? PKT_TX_TCP_SEG : PKT_TX_UDP_SEG);
}
mb->ol_flags |= ol_flags;