From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id 1001E25A1 for ; Thu, 20 Jul 2017 11:09:20 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id 12so68156893wrb.1 for ; Thu, 20 Jul 2017 02:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IEyS6q6wa85CvScuwJfcXfx1Kd9IvHydYMXL1654oJE=; b=Kg1OsGr4TkqEP1tQ4N++wIMEBDljfz5lQxP6qHT8Q5TM+AfLdMa9Nx95HAQFkOc9PQ rPHOy2/r/N0Qs1RF9Kd5jHHiSvjioRwqfWQyUopFKB0gAyfRWt86w7VxMp/mjDjfwskl iKd1HLsbc4L1t9vdu3U0HXAlT+a8EWlE5hzwjUSOsKjV9F4B6cy9u2wm9xfZEPZobc6y +VeOXIEIt7VYvPFRnHkTqZTirhq0JX4WuGH/+NOSpHppKdrFNOeBMstN7ZJ8mgSDebnP FEL9WvmyFVU9vQJztaTHbZvm/SufkuN+O6MsLs7xll2MZOPpbM07DN4dCmI/+2KQb4KL b8Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IEyS6q6wa85CvScuwJfcXfx1Kd9IvHydYMXL1654oJE=; b=rePZeddp/LC9BiNd3hCOW1QRfF1JKkDCHgKtDYQjWW3kKASeRn7CQn7rfw/doN+JdH 5NtUVnzJN29wq43u6J6bWUcO6gVwVQe5rSPpyzC5i1S4FslWSyzGn+5gHgAs3EL60hFK LrDFzIvbRmrHSVqcVNJtG5nQZqXK0xokPZquJ8yaxEQcsrCF4xskzV8Ri4CmXpgF3heq NLeGXheI2JIhuEG/abm5l5CvRtc1PQjXUkjUH/E42sSl/BgL4YGKNVMvUZHDBLFXFuBJ 9gN8cCrKkTAHP0fgw4hPnqmPVtPA3mjZju2IHDXPPg1RC+n+pPCzCIO+9rTw3TYQH2lw c1lg== X-Gm-Message-State: AIVw111w3Pj1LTNrFC6MGpyWcZBXyQ0wSnnXFyZZw5f6hOYHqPjlurl6 4jMUoRpzX5y4Epkk X-Received: by 10.223.146.65 with SMTP id 59mr1916575wrj.152.1500541759723; Thu, 20 Jul 2017 02:09:19 -0700 (PDT) Received: from platinum (2a01cb0c03c651000226b0fffeed02fc.ipv6.abo.wanadoo.fr. [2a01:cb0c:3c6:5100:226:b0ff:feed:2fc]) by smtp.gmail.com with ESMTPSA id 93sm3811646wra.82.2017.07.20.02.09.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jul 2017 02:09:19 -0700 (PDT) Date: Thu, 20 Jul 2017 11:09:17 +0200 From: Olivier Matz To: "Ido Barnea (ibarnea)" Cc: "konstantin.ananyev@intel.com" , "Hanoch Haim (hhaim)" , "dev@dpdk.org" Message-ID: <20170720110917.4ec188eb@platinum> In-Reply-To: <4E60939B-45FA-45C6-B6C7-1643CB6285D2@cisco.com> References: <4E60939B-45FA-45C6-B6C7-1643CB6285D2@cisco.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] librte_net/rte_ip.h checksum functions question 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: , X-List-Received-Date: Thu, 20 Jul 2017 09:09:20 -0000 Hi Ido, On Tue, 18 Jul 2017 12:18:20 +0000, "Ido Barnea (ibarnea)" wrote: > Hi, > Is it intentional that rte_ipv4_phdr_cksum and others in this file assume that ipv4 header is sizeof(struct ipv4_hdr), actually assuming that there are no IPv4 options? > If not, I would like to submit a patch changing that. > Something in the line of: > sizeof(struct ipv4_hdr) changes to ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER) > I agree we should have other functions that take the real ip header len in account. What about the following: static inline uint16_t rte_ipv4ext_cksum(const struct ipv4_hdr *ipv4_hdr, size_t hdrlen) static inline uint16_t rte_ipv4ext_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, size_t hdrlen, uint64_t ol_flags) ... The current function rte_ipv4_cksum() can call rte_ipv4ext_cksum(.., 5) without additional cost, since 5 will be a constant, resolved at compilation time. I also noticed that some functions are not properly documented (it should be announced that options are not supported). Also, the api comment of rte_ipv6_udptcp_cksum() talks about ipv4... Thanks, Olivier