From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A984EA04BB; Tue, 6 Oct 2020 11:51:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27C8C25B3; Tue, 6 Oct 2020 11:51:08 +0200 (CEST) Received: from smail.rz.tu-ilmenau.de (smail.rz.tu-ilmenau.de [141.24.186.67]) by dpdk.org (Postfix) with ESMTP id 431F21E35 for ; Tue, 6 Oct 2020 11:51:06 +0200 (CEST) Received: from [192.168.1.40] (unknown [91.137.63.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 6FA6E580060; Tue, 6 Oct 2020 11:51:05 +0200 (CEST) Message-ID: <0dcef0e7cdc02b88f55aa33fdf5e50ca56178b3b.camel@tu-ilmenau.de> From: Michael Pfeiffer To: Olivier Matz , Stephen Hemminger Cc: Thomas Monjalon , Andrew Rybchenko , dev@dpdk.org Date: Tue, 06 Oct 2020 11:51:04 +0200 In-Reply-To: <20201006081013.GE21395@platinum> References: <20200821113210.307175-1-michael.pfeiffer@tu-ilmenau.de> <20200901094755.561661-1-michael.pfeiffer@tu-ilmenau.de> <7417467.3Ncg9TYYCI@thomas> <20201005193945.19aebfb5@hermes.local> <20201006081013.GE21395@platinum> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, On Tue, 2020-10-06 at 10:10 +0200, Olivier Matz wrote: > On Mon, Oct 05, 2020 at 07:39:45PM -0700, Stephen Hemminger wrote: > > On Tue, 06 Oct 2020 00:55:19 +0200 > > Thomas Monjalon wrote: > > > > > > On 9/1/20 12:47 PM, Michael Pfeiffer wrote: > > > > Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all IPv4 > > > > headers have sizeof(struct rte_ipv4_hdr) bytes. This is not true for > > > > those (rare) packets with IPv4 options. Thus, both IPv4 and TCP/UDP > > > > checksums are calculated wrong. > > > > > > > > This patch fixes the issue by using the actual IPv4 header length from > > > > the packet's IHL field. > > > > > > > > Signed-off-by: Michael Pfeiffer > > Acked-by: Olivier Matz > > > > > -       cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); > > > > +       cksum = rte_raw_cksum(ipv4_hdr, (ipv4_hdr->version_ihl & 0xf) * > > > > 4); > > > > > > Truly naive questions: > > > - doesn't it deserve a static inline function rte_ipv4_hdr_len()? > > > > Makes sense to have that. > > +1 > > However it could be in another patch: there are ~15 places where it > could be replaced in dpdk. Thank you very much for your feedback. I will prepare a second patch for that function.