[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ada37763-16cd-7b51-f9ce-41e8d313bf96@gmail.com>
Date: Sat, 4 Jul 2020 12:24:41 +0900
From: Toshiaki Makita <toshiaki.makita1@...il.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, bpf@...r.kernel.org,
cake@...ts.bufferbloat.net, Davide Caratti <dcaratti@...hat.com>,
Jiri Pirko <jiri@...nulli.us>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Roman Mashak <mrv@...atatu.com>,
Lawrence Brakmo <brakmo@...com>,
Ilya Ponetayev <i.ponetaev@...systems.com>
Subject: Re: [PATCH net v3] sched: consistently handle layer3 header accesses
in the presence of VLANs
On 2020/07/04 5:26, Toke Høiland-Jørgensen wrote:
...
> +/* 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;
> +
> + 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)) {
> + struct vlan_hdr vhdr, *vh;
> +
> + vh = skb_header_pointer(skb, offset, sizeof(vhdr), &vhdr);
> + if (!vh)
> + break;
> +
> + proto = vh->h_vlan_encapsulated_proto;
> + offset += sizeof(vhdr);
> + }
Why don't you use __vlan_get_protocol() here? It looks quite similar.
Is there any problem with using that?
Toshiaki Makita
Powered by blists - more mailing lists