On Wed, Aug 24, 2016 at 7:54 AM, Sugesh Chandran
<sugesh.chand...@intel.com> wrote:
> diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
> index ce2582f..31a12d6 100644
> --- a/lib/netdev-native-tnl.c
> +++ b/lib/netdev-native-tnl.c
> @@ -179,20 +181,26 @@ udp_extract_tnl_md(struct dp_packet *packet, struct 
> flow_tnl *tnl,
>      }
>
>      if (udp->udp_csum) {
> -        uint32_t csum;
> -        if (netdev_tnl_is_header_ipv6(dp_packet_data(packet))) {
> -            csum = packet_csum_pseudoheader6(dp_packet_l3(packet));
> -        } else {
> -            csum = packet_csum_pseudoheader(dp_packet_l3(packet));
> -        }
> -
> -        csum = csum_continue(csum, udp, dp_packet_size(packet) -
> -                             ((const unsigned char *)udp -
> -                              (const unsigned char *)dp_packet_l2(packet)));
> -        if (csum_finish(csum)) {
> -            return NULL;
> +        if(OVS_UNLIKELY(!dp_packet_l4_checksum_valid(packet))) {
> +            uint32_t csum;
> +            if (netdev_tnl_is_header_ipv6(dp_packet_data(packet))) {
> +                csum = packet_csum_pseudoheader6(dp_packet_l3(packet));
> +            } else {
> +                csum = packet_csum_pseudoheader(dp_packet_l3(packet));
> +            }
> +
> +            csum = csum_continue(csum, udp, dp_packet_size(packet) -
> +                                 ((const unsigned char *)udp -
> +                                  (const unsigned char 
> *)dp_packet_l2(packet)));
> +            if (csum_finish(csum)) {
> +                return NULL;
> +            }
>          }
>          tnl->flags |= FLOW_TNL_F_CSUM;
> +
> +        /* Reset the checksum offload flags if present, to avoid wrong
> +         * interpretation in the further packet processing when 
> recirculated.*/
> +        reset_dp_packet_checksum_ol_flags(packet);
>      }

Sorry to keep going back and forth on this but what I was trying to
say previously was that this call should go somewhere common shared by
all tunnels. For example, there is currently support for GRE tunnels
in OVS but the IP checksum flag wouldn't get cleared with the call
being in udp_extract_tnl_md().

I think that we can move reset_dp_packet_checksum_ol_flags() to
netdev_pop_header() and then we'll be all set.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to