From 47ea4c35feda9cdb8e24d863e1dc3418fababb7b Mon Sep 17 00:00:00 2001 From: Zhiyong Yang Date: Wed, 10 Jun 2020 13:23:50 +0000 Subject: vxlan: remove judgement with always true if ((A | B) == false) it means both A and B are false, so for the following code if (PREDICT_FALSE (!good_udp1)) { if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0) { ... } } if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0) is always true if the code run it. Remove it. Type: improvement Signed-off-by: Zhiyong Yang Change-Id: I6bd1e9340c7a00089fc1c9ae49773add832d309e --- src/vnet/vxlan/decap.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/vnet/vxlan/decap.c b/src/vnet/vxlan/decap.c index 3b428be35e4..d2ba62d12ed 100644 --- a/src/vnet/vxlan/decap.c +++ b/src/vnet/vxlan/decap.c @@ -579,15 +579,11 @@ ip_vxlan_bypass_inline (vlib_main_t * vm, /* Verify UDP checksum */ if (PREDICT_FALSE (!good_udp0)) { - if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0) - { - if (is_ip4) - flags0 = ip4_tcp_udp_validate_checksum (vm, b0); - else - flags0 = ip6_tcp_udp_icmp_validate_checksum (vm, b0); - good_udp0 = - (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; - } + if (is_ip4) + flags0 = ip4_tcp_udp_validate_checksum (vm, b0); + else + flags0 = ip6_tcp_udp_icmp_validate_checksum (vm, b0); + good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; } if (is_ip4) @@ -657,15 +653,11 @@ ip_vxlan_bypass_inline (vlib_main_t * vm, /* Verify UDP checksum */ if (PREDICT_FALSE (!good_udp1)) { - if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0) - { - if (is_ip4) - flags1 = ip4_tcp_udp_validate_checksum (vm, b1); - else - flags1 = ip6_tcp_udp_icmp_validate_checksum (vm, b1); - good_udp1 = - (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; - } + if (is_ip4) + flags1 = ip4_tcp_udp_validate_checksum (vm, b1); + else + flags1 = ip6_tcp_udp_icmp_validate_checksum (vm, b1); + good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; } if (is_ip4) @@ -771,15 +763,11 @@ ip_vxlan_bypass_inline (vlib_main_t * vm, /* Verify UDP checksum */ if (PREDICT_FALSE (!good_udp0)) { - if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0) - { - if (is_ip4) - flags0 = ip4_tcp_udp_validate_checksum (vm, b0); - else - flags0 = ip6_tcp_udp_icmp_validate_checksum (vm, b0); - good_udp0 = - (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; - } + if (is_ip4) + flags0 = ip4_tcp_udp_validate_checksum (vm, b0); + else + flags0 = ip6_tcp_udp_icmp_validate_checksum (vm, b0); + good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; } if (is_ip4) -- cgit 1.2.3-korg