On Sat, Jun 1, 2019 at 9:22 PM Eli Britstein <el...@mellanox.com> wrote: > > > On 6/1/2019 1:50 AM, Cong Wang wrote: > > On Fri, May 31, 2019 at 3:01 PM Davide Caratti <dcara...@redhat.com> 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.