From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 709FDC282CE for ; Tue, 4 Jun 2019 17:42:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3560920693 for ; Tue, 4 Jun 2019 17:42:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tmKyt2Fu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbfFDRmL (ORCPT ); Tue, 4 Jun 2019 13:42:11 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36303 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfFDRmK (ORCPT ); Tue, 4 Jun 2019 13:42:10 -0400 Received: by mail-pl1-f193.google.com with SMTP id d21so8632666plr.3 for ; Tue, 04 Jun 2019 10:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IygS5cd4afLZ/eHKi5Vh6iMu/8qrdd2XyzjRxs/VsFA=; b=tmKyt2FumcXJ1+CJD8UpDtFqISapiyuM2cs1zIcEDw4QcYZOdDQ6+yhk8wyiCLcQLb B69hOrzfF0nMKsqH1eRQWCigxt4B+HutIvp2qmdx83qfyeJZa2qIHP3rf/MV3Gyh6M7K mYiPyD5OGhSupCDaSn6mZOk2cooUs5I7efHHYOXy0KUKjCs4WpGO69el2x59sWSzZumq sXPgMr2QVrR5qaDTYna+/fTJuAGJaJ6T3griQNZDXbifIg/iw1vvi/63KwFUFilpNVgo ZVvNzzvwtSThCi+g86vFMplAAIfiCtBw29Ba6HxSD0XrbjMUz+ea0SBKNKslWV1/w3os PaxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IygS5cd4afLZ/eHKi5Vh6iMu/8qrdd2XyzjRxs/VsFA=; b=Cv25/GPKq4HFmsmpG0oM8xgvnTHOISD9x5TSTcWihYXKR5nalYA9M+OXnFOLShCU4K +x2hNyuQ1QFMF7JGnpZSyQRv9tLOHg83ilbgz3yO9pZq6gqBHVbFskIt98/fsqsg/fmM 6Vz7idF/jSNcdMn/jelrtXZ9EDJ+AoRcNdFpzZoqDCgTl8AgFkyZHQvoKk/d1eyLSAX2 8TDd5m6yoStHwAhwD6/HKpzXPZkRurTXMDUVjj65t8uP2IEUI+XWMMEuvqO/GeRjofH8 HsOC6dllkodljvqL8yeM3bqQXYiVy2nCdpcJgd0oXFFduxIqNDyUo3R/7ki+C7PwSyMg mJGA== X-Gm-Message-State: APjAAAWpw45o7jDc37ueCc1cJdDZUdzXZjhCgPjPyrvfAVXINbrtl5zP Lyw21mbJvgpeO9kdMQ3GtRoagp5GfYOMUXlgyJs= X-Google-Smtp-Source: APXvYqwXBKZLYvRYRsxmbvmSS9kiKYWc/QyldzLYJYMuphwSeJOKgXQ0HDSRuALiIM/SakKK9TaCnq8hfWa0nUsy/Bw= X-Received: by 2002:a17:902:d701:: with SMTP id w1mr32124418ply.12.1559670130198; Tue, 04 Jun 2019 10:42:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Cong Wang Date: Tue, 4 Jun 2019 10:41:58 -0700 Message-ID: Subject: Re: [PATCH net v3 1/3] net/sched: act_csum: pull all VLAN headers before checksumming To: Eli Britstein Cc: Davide Caratti , Eric Dumazet , Jiri Pirko , Jamal Hadi Salim , "David S . Miller" , Linux Kernel Network Developers , Shuang Li , Stephen Hemminger Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, Jun 1, 2019 at 9:22 PM Eli Britstein wrote: > > > On 6/1/2019 1:50 AM, Cong Wang wrote: > > On Fri, May 31, 2019 at 3:01 PM Davide Caratti wrote: > >> Please note: this loop was here also before this patch (the 'goto again;' > >> line is only patch context). It has been introduced with commit > >> 2ecba2d1e45b ("net: sched: act_csum: Fix csum calc for tagged packets"). > >> > > This is exactly why I ask... > > > > > >>> Why do you still need to loop here? tc_skb_pull_vlans() already > >>> contains a loop to pop all vlan tags? > >> The reason why the loop is here is: > >> 1) in case there is a stripped vlan tag, it replaces tc_skb_protocol(skb) > >> with the inner ethertype (i.e. skb->protocol) > >> > >> 2) in case there is one or more unstripped VLAN tags, it pulls them. At > >> the last iteration, when it does: > > Let me ask it in another way: > > > > The original code, without your patch, has a loop (the "goto again") to > > pop all vlan tags. > > > > The code with your patch adds yet another loop (the while loop inside your > > tc_skb_pull_vlans()) to pop all vlan tags. > > > > So, after your patch, we have both loops. So, I am confused why we need > > these two nested loops to just pop all vlan tags? I think one is sufficient. > After Davide's patch, the "goto again" is needed to re-enter the switch > case, and guaranteed to be done only once, as all the VLAN tags were > already pulled. The alternative is having a dedicated if before the switch. Yeah, I think that can be simply moved before the switch so that we don't have to use two loops, which should be easier to understand too. Thanks.