summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZhiyong Yang <zhiyong.yang@intel.com>2020-06-10 13:23:50 +0000
committerBenoƮt Ganne <bganne@cisco.com>2020-06-15 16:09:58 +0000
commit47ea4c35feda9cdb8e24d863e1dc3418fababb7b (patch)
treed762a2ad8e6f8c69045cd63110b7a6270da9db02 /src
parentc16fe4689055242c64c71d83e41908a8fb6c2726 (diff)
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 <zhiyong.yang@intel.com> Change-Id: I6bd1e9340c7a00089fc1c9ae49773add832d309e
Diffstat (limited to 'src')
-rw-r--r--src/vnet/vxlan/decap.c42
1 files changed, 15 insertions, 27 deletions
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)