Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: David Miller <davem@davemloft.net>,
	 Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Cake List <cake@lists.bufferbloat.net>,
	 Davide Caratti <dcaratti@redhat.com>,
	Jiri Pirko <jiri@resnulli.us>,
	 Jamal Hadi Salim <jhs@mojatatu.com>,
	Ilya Ponetayev <i.ponetaev@ndmsystems.com>
Subject: Re: [Cake] [PATCH net v2] sched: consistently handle layer3 header accesses in the presence of VLANs
Date: Fri, 3 Jul 2020 12:19:38 -0700	[thread overview]
Message-ID: <CAM_iQpVbm0DGGjsdtJD0esuyx9Xmjo=3VCg=C5feqDDbFM+6XQ@mail.gmail.com> (raw)
In-Reply-To: <20200703152239.471624-1-toke@redhat.com>

On Fri, Jul 3, 2020 at 8:22 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
> index b05e855f1ddd..d0c1cb0d264d 100644
> --- a/include/linux/if_vlan.h
> +++ b/include/linux/if_vlan.h
> @@ -308,6 +308,35 @@ static inline bool eth_type_vlan(__be16 ethertype)
>         }
>  }
>
> +/* A getter for the SKB protocol field which will handle VLAN tags consistently
> + * whether VLAN acceleration is enabled or not.
> + */
> +static inline __be16 skb_protocol(const struct sk_buff *skb, bool skip_vlan)
> +{
> +       unsigned int offset = skb_mac_offset(skb) + sizeof(struct ethhdr);
> +       __be16 proto = skb->protocol;
> +       struct vlan_hdr vhdr, *vh;
> +
> +       if (!skip_vlan)
> +               /* VLAN acceleration strips the VLAN header from the skb and
> +                * moves it to skb->vlan_proto
> +                */
> +               return skb_vlan_tag_present(skb) ? skb->vlan_proto : proto;
> +
> +       while (eth_type_vlan(proto)) {
> +               vh = skb_header_pointer(skb, offset, sizeof(vhdr), &vhdr);
> +               if (!vh)
> +                       break;
> +
> +               proto = vh->h_vlan_encapsulated_proto;
> +               offset += sizeof(vhdr);
> +       }
> +
> +       return proto;
> +}
> +
> +
> +

Just nit: too many newlines here. Please run checkpatch.pl.


>  static inline bool vlan_hw_offload_capable(netdev_features_t features,
>                                            __be16 proto)
>  {
> diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
> index 0f0d1efe06dd..82763ba597f2 100644
> --- a/include/net/inet_ecn.h
> +++ b/include/net/inet_ecn.h
> @@ -4,6 +4,7 @@
>
>  #include <linux/ip.h>
>  #include <linux/skbuff.h>
> +#include <linux/if_vlan.h>
>
>  #include <net/inet_sock.h>
>  #include <net/dsfield.h>
> @@ -172,7 +173,7 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
>
>  static inline int INET_ECN_set_ce(struct sk_buff *skb)
>  {
> -       switch (skb->protocol) {
> +       switch (skb_protocol(skb, true)) {
>         case cpu_to_be16(ETH_P_IP):
>                 if (skb_network_header(skb) + sizeof(struct iphdr) <=
>                     skb_tail_pointer(skb))
> @@ -191,7 +192,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
>
>  static inline int INET_ECN_set_ect1(struct sk_buff *skb)
>  {
> -       switch (skb->protocol) {
> +       switch (skb_protocol(skb, true)) {
>         case cpu_to_be16(ETH_P_IP):
>                 if (skb_network_header(skb) + sizeof(struct iphdr) <=
>                     skb_tail_pointer(skb))

These two helpers are called by non-net_sched too, are you sure
your change is correct for them too?

For example, IP6_ECN_decapsulate() uses skb->protocol then calls
INET_ECN_decapsulate() which calls the above, after your change
they use skb_protocol(). This looks inconsistent to me.

Thanks.

  reply	other threads:[~2020-07-03 19:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 15:22 Toke Høiland-Jørgensen
2020-07-03 19:19 ` Cong Wang [this message]
2020-07-03 20:09   ` Toke Høiland-Jørgensen
2020-07-03 20:16 ` Roman Mashak
2020-07-03 20:22   ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM_iQpVbm0DGGjsdtJD0esuyx9Xmjo=3VCg=C5feqDDbFM+6XQ@mail.gmail.com' \
    --to=xiyou.wangcong@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=i.ponetaev@ndmsystems.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox