Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3684277imm; Mon, 10 Sep 2018 23:49:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY+oKbnnUmOPx8bH5um/01aSXhrdDmnkzycKdGiN+mZkdUtI0nhoaKoeZliRC45kzLKLHtr X-Received: by 2002:a17:902:2e01:: with SMTP id q1-v6mr25798141plb.40.1536648589051; Mon, 10 Sep 2018 23:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536648589; cv=none; d=google.com; s=arc-20160816; b=lysiCpJXshyRfo3EdHcKLiNRk3N/0OdAeucdPSKnwNEbkZKvq2PoXy9lbuN+TP+rLl NHkoRCHLxvCU1TxhlXMFjs6zm1+SyZZkIK+tK7kiFwmfqSCaNwgSvrsLgVfNYSnVgBO9 VDeMXhn2E8oX6dHI3Mlwuz0/wD4OeiLSVvdSaUh74iOqr/RupnxMGhyKfLyRNMZsHEEm EZlVWz3CimPC404ffUepxxYAex9aXt5+AxrEr3pfDtd4HsA4js1tBJiovyVW/mggN073 vhVuTbkM5+gPX3C2CAUtj2GS1zirYNOsPndWiCVkv3y3MR+M5E4PRb0Cc1eE7pLDK/7D w1kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=NmyKZy8TecwQlbkydnti4OeBH4bMCCKd10chGaw4/DQ=; b=DlbKqPu6dmXFPVInLvmAeRHrqHJ9ajBE8aKxX47azqQ+15pBrn1AiB9HUtd2GMV0sh eDJM/S/qVF71y3CI0uGyGRc4RG+/otrp1VIjbZShy2oT9BgbxgkMonxid8B8WlJY3khv nx4NII5E2YwEQGePNdwnNoXjzXpsHh7RDtVQbW3JsOqX7m72+K1s7V3WW4jDBnK9zlN4 ZQh7ENWqzVGyo6noIqhNiI5OBhAjZ2rh89/Dq0cwAhSszQovp3w/CCIYZW7ogyXayPcf GuAjrtdgXYZ/2OWuYlMf3DnvmHufPQkctLvFNvfvRN3wCEiSP6uVbQGSXEkIPRePjfFt g9fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a68-v6si18989072pla.361.2018.09.10.23.49.31; Mon, 10 Sep 2018 23:49:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727754AbeIKLpj (ORCPT + 99 others); Tue, 11 Sep 2018 07:45:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39290 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726483AbeIKLpj (ORCPT ); Tue, 11 Sep 2018 07:45:39 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5E04406F8B9; Tue, 11 Sep 2018 06:47:49 +0000 (UTC) Received: from localhost (ovpn-204-197.brq.redhat.com [10.40.204.197]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B60C2156889; Tue, 11 Sep 2018 06:47:48 +0000 (UTC) Date: Tue, 11 Sep 2018 08:47:46 +0200 From: Jiri Benc To: Haishuang Yan Cc: "David S. Miller" , Alexey Kuznetsov , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ip6_gre: simplify gre header parsing in ip6gre_err Message-ID: <20180911084746.486bc78e@redhat.com> In-Reply-To: References: <1536567909-25089-1-git-send-email-yanhaishuang@cmss.chinamobile.com> <20180910173640.117bf42f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 11 Sep 2018 06:47:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 11 Sep 2018 06:47:49 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jbenc@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Sep 2018 10:19:31 +0800, Haishuang Yan wrote: > Since csum_err may not be used outside, how about refactoring gre_parse_header function like this: > > --- a/net/ipv4/gre_demux.c > +++ b/net/ipv4/gre_demux.c > @@ -86,7 +86,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, > > options = (__be32 *)(greh + 1); > if (greh->flags & GRE_CSUM) { > - if (skb_checksum_simple_validate(skb)) { > + if (csum_err && skb_checksum_simple_validate(skb)) { Something like this, yes. Thanks! Jiri