From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id EEDB13B29D for ; Sat, 4 Jul 2020 07:33:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593862434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k1xDOxnW3xmUX81X4QGvTZ5jM/EECvOfpllGJAAplKU=; b=J14cDo+zqlqTrLE21mKVXwrPEdrsuJnDwEHB6fD9YIfT2QIJXzOdbShAPrMQwzUI7tUyeR 8ZYE/UOFPoS8gBJaw3YgbEcWgNvFWLzUERFdHaENH3RCnEu+7VTl4VLqzHupNF9p4DRNYG 9bp3jJl24YSC1dOGrsnpwMoAKznNVas= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-344-0AcGveRnOLKlU-wP8kYuEw-1; Sat, 04 Jul 2020 07:33:50 -0400 X-MC-Unique: 0AcGveRnOLKlU-wP8kYuEw-1 Received: by mail-pg1-f200.google.com with SMTP id o15so25365491pgn.15 for ; Sat, 04 Jul 2020 04:33:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=4HB36sjhmx4bYypIIg0QrKY9T+pJQwvtAds11G9bSlA=; b=Wc3cuAA8xu6BGozjXp9YmJv0YeohfZb6bqDT1MU64+gjwdSY14N1bExc2Y8GVP9r+f snVGrxmaXdzF3gHokvdm6B3On4g2e4an1dSWM2CAMz6DKUJLmfp6CvdxIeWWml+PvnJl UdDvilSloa1IadTSgFQNwB/xb4GzzETw4GuKJ1Gk0eQT7kizgC2GW7bzYhsU0Sdg7ho/ 0WQOSSCJv6FxLP3PD26y/cWh6JBx3dffUaBRi0ozYI/h/J4kWD9XU4Ja4OrZ+Jp5X1kh 7A187pVYA5tF4FUZ2V5CopJo4LasytX7ABjeNgq25f1ibd+Mbb9MSis+J+jPQ9OKK4hp phEA== X-Gm-Message-State: AOAM533QBf3Fjlm9VdLgoSQutAGopzLP7HVAKxLj46VLO+LLN+xogw/D avr5JV+J15ZDsizATO7/PJ3hL05x/m9SMZJMYpafqudjVa5IyhY1K1AUS7WUlH55b5jhD8pYMg2 +lG7SJFkFmJ4u8peXtooATg== X-Received: by 2002:a17:902:a515:: with SMTP id s21mr26753040plq.192.1593862428096; Sat, 04 Jul 2020 04:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0K4ul/+ya1hBFl7f4gxJwUZBehZNesHyGf1bbzBMtCiOpFmsnFFSkDnlXDOVgqHCF/Oj8fA== X-Received: by 2002:a17:902:a515:: with SMTP id s21mr26753021plq.192.1593862427886; Sat, 04 Jul 2020 04:33:47 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id np5sm13817593pjb.43.2020.07.04.04.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 04:33:47 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 4DA2B1804A8; Sat, 4 Jul 2020 13:33:42 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Toshiaki Makita Cc: davem@davemloft.net, netdev@vger.kernel.org, bpf@vger.kernel.org, cake@lists.bufferbloat.net, Davide Caratti , Jiri Pirko , Jamal Hadi Salim , Cong Wang , Roman Mashak , Lawrence Brakmo , Ilya Ponetayev In-Reply-To: References: <20200703202643.12919-1-toke@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Sat, 04 Jul 2020 13:33:42 +0200 Message-ID: <878sfzms4p.fsf@toke.dk> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=toke@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Sat, 04 Jul 2020 07:42:48 -0400 Subject: Re: [Cake] [PATCH net v3] sched: consistently handle layer3 header accesses in the presence of VLANs X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2020 11:33:55 -0000 Toshiaki Makita writes: > On 2020/07/04 5:26, Toke H=C3=B8iland-J=C3=B8rgensen wrote: > ... >> +/* A getter for the SKB protocol field which will handle VLAN tags cons= istently >> + * whether VLAN acceleration is enabled or not. >> + */ >> +static inline __be16 skb_protocol(const struct sk_buff *skb, bool skip_= vlan) >> +{ >> +=09unsigned int offset =3D skb_mac_offset(skb) + sizeof(struct ethhdr); >> +=09__be16 proto =3D skb->protocol; >> + >> +=09if (!skip_vlan) >> +=09=09/* VLAN acceleration strips the VLAN header from the skb and >> +=09=09 * moves it to skb->vlan_proto >> +=09=09 */ >> +=09=09return skb_vlan_tag_present(skb) ? skb->vlan_proto : proto; >> + >> +=09while (eth_type_vlan(proto)) { >> +=09=09struct vlan_hdr vhdr, *vh; >> + >> +=09=09vh =3D skb_header_pointer(skb, offset, sizeof(vhdr), &vhdr); >> +=09=09if (!vh) >> +=09=09=09break; >> + >> +=09=09proto =3D vh->h_vlan_encapsulated_proto; >> +=09=09offset +=3D sizeof(vhdr); >> +=09} > > Why don't you use __vlan_get_protocol() here? It looks quite similar. > Is there any problem with using that? TBH, I completely missed that helper. It seems to have side effects, though (pskb_may_pull()), which is one of the things the original patch to sch_cake that initiated all of this was trying to avoid. I guess I could just fix that, though, and switch __vlan_get_protocol() over to using skb_header_pointer(). Will send a follow-up to do that. Any opinion on whether it's a good idea to limit the max parse depth while I'm at it (see Daniel's reply)? -Toke