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 0B248A034E; Wed, 27 May 2020 17:02:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A82731DAA0; Wed, 27 May 2020 17:02:53 +0200 (CEST) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id C739F1D172 for ; Wed, 27 May 2020 17:02:52 +0200 (CEST) Received: by mail-pj1-f68.google.com with SMTP id ci21so1647384pjb.3 for ; Wed, 27 May 2020 08:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L/AnMjuCc1VVJIs5IQwXH9NUZF87gTNLtkkAa75gPqI=; b=NJVn6KFHTP1s62/332Hqt0hrNarDYfoIkX2xbMCq2cFeG++jVYHpOA8qkCy4iTeoMD WD45+KH9s3ZcdjJFGvKThabNJTka0JJe3FtAVirrhwXPJQ2jMwD9fWq6EDYP3XbH8xyd GyPxyGNJKrCQIUhGp91w4Plg05dgKRVSz42RreU+ivhKuaufuGyVBnkpa5/XC93xCBUa fGJu5cVtCewS30X510RYiw+BE3Y3G9y9l8kC7Q/PCJHYruUbf5qgSCTtVw1MChZPa2BP iZDgfj/rBjtDJuqe3PI6p77Pgwy0BTH5CdNyWSujiQ2bojPFI3xWW1GoVGM0ECQhthf8 gQpw== 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=L/AnMjuCc1VVJIs5IQwXH9NUZF87gTNLtkkAa75gPqI=; b=ppQsEHu2KKiAwob4Lfhmg4Mn5sFDO94UbUvFwK2LDwftuqstNodU0/H3x54kmGiX1M vBL1aC+v7OivFbwbqzuhdmQV3hO57ZD6fquhUr6QScMnNjRlYex234bsrxm1GYJ1uQpM jJZD4zu5OybwmyFoY/MnKQYbVvEa06RJGbhUdK7rnVxzB/WCNJXB7uJ0ezMU7J0IoVj5 qQdF7pZELHqxIJpQr0gFGDVdb1/dNCTkSMAqrxB9IMr1quN+J8/w+pEUe7NSkwt7cpTG lNHtYswUcJlqT11uaO9x1BCZd13CoDnfNtirL9HWRYBGy/WwjOucVKrp+Ryx5gr+vT9R XiUg== X-Gm-Message-State: AOAM532LjElprO80tf1DfDQ04K8qWRnbSUpLyjioZqAIcpyWYDxvwxZo 5rculqDQC96qcSmbPzFmHS7sdQ== X-Google-Smtp-Source: ABdhPJzGKvtekXopAdwjRVV3zaqyw/ww9mbJDsupLsNLz/SQEN/jIWy13efLcxBS5B9dvzR/Ji6qSQ== X-Received: by 2002:a17:90b:19d5:: with SMTP id nm21mr5591627pjb.212.1590591771853; Wed, 27 May 2020 08:02:51 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m2sm2808918pjl.45.2020.05.27.08.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 08:02:50 -0700 (PDT) Date: Wed, 27 May 2020 08:02:42 -0700 From: Stephen Hemminger To: guohongzhi Cc: , , , , , , , , , , , , Message-ID: <20200527080242.16dceeae@hermes.lan> In-Reply-To: <20200527144127.5792-1-guohongzhi1@huawei.com> References: <20200527144127.5792-1-guohongzhi1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] bugfix: udptcp_checksum should tread tcp and udp differently 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" On Wed, 27 May 2020 22:41:27 +0800 guohongzhi wrote: > + /* For Udp, if the computed checksum is zero, > + * it is transmitted as all ones.RFC768 > + */ > + if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP) > cksum = 0xffff; > The comment should be reformatted to be clearer. Maybe: /* * Per RFC768: * If the computed checksum is zero,it is transmitted as all ones * (the equivalent in one's complement arithmetic). */ There is no special case required here, it is true for TCP as well. In TCP it appears 0 is allowed but not generally used. Most implementations use common checksum for both TCP and UDP