diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-05-05 14:30:25 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-05-13 11:31:11 +0000 |
commit | a9a9d8255b472de760704621468b92a86e308aca (patch) | |
tree | 7ace106b353f8fa9e0b3a6280bc7d85fad980664 /src/vnet/interface_output.c | |
parent | 5d0136f09944b0d7ea9d1db5c368d4d0b36cedd2 (diff) |
interface: fix the checksum offload in quad loop
Type: fix
In quad loop, checksum will be calculated for all four packets,
if one packet needs checksum computation, without respecting their
respective flags. This patch fixes it.
Change-Id: I479b420ba0dcbd178ea4180bf05a0e55a6b13843
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/interface_output.c')
-rw-r--r-- | src/vnet/interface_output.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index f289fcc489e..8e3d53ab76f 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -334,27 +334,32 @@ vnet_interface_output_node_inline (vlib_main_t * vm, if (do_tx_offloads) { - if (or_flags & - (VNET_BUFFER_F_OFFLOAD_TCP_CKSUM | - VNET_BUFFER_F_OFFLOAD_UDP_CKSUM | - VNET_BUFFER_F_OFFLOAD_IP_CKSUM)) + u32 vnet_buffer_offload_flags = + (VNET_BUFFER_F_OFFLOAD_TCP_CKSUM | + VNET_BUFFER_F_OFFLOAD_UDP_CKSUM | + VNET_BUFFER_F_OFFLOAD_IP_CKSUM); + if (or_flags & vnet_buffer_offload_flags) { - vnet_calc_checksums_inline - (vm, b[0], - b[0]->flags & VNET_BUFFER_F_IS_IP4, - b[0]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); - vnet_calc_checksums_inline - (vm, b[1], - b[1]->flags & VNET_BUFFER_F_IS_IP4, - b[1]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); - vnet_calc_checksums_inline - (vm, b[2], - b[2]->flags & VNET_BUFFER_F_IS_IP4, - b[2]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); - vnet_calc_checksums_inline - (vm, b[3], - b[3]->flags & VNET_BUFFER_F_IS_IP4, - b[3]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); + if (b[0]->flags & vnet_buffer_offload_flags) + vnet_calc_checksums_inline + (vm, b[0], + b[0]->flags & VNET_BUFFER_F_IS_IP4, + b[0]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); + if (b[1]->flags & vnet_buffer_offload_flags) + vnet_calc_checksums_inline + (vm, b[1], + b[1]->flags & VNET_BUFFER_F_IS_IP4, + b[1]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); + if (b[2]->flags & vnet_buffer_offload_flags) + vnet_calc_checksums_inline + (vm, b[2], + b[2]->flags & VNET_BUFFER_F_IS_IP4, + b[2]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); + if (b[3]->flags & vnet_buffer_offload_flags) + vnet_calc_checksums_inline + (vm, b[3], + b[3]->flags & VNET_BUFFER_F_IS_IP4, + b[3]->flags & VNET_BUFFER_F_IS_IP6, 1 /* with gso */ ); } } b += 4; |