[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLmvESUU0Gt5HgKU@google.com>
Date: Thu, 20 Jul 2023 15:02:57 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Larysa Zaremba <larysa.zaremba@...el.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org, haoluo@...gle.com,
jolsa@...nel.org, David Ahern <dsahern@...il.com>, Jakub Kicinski <kuba@...nel.org>,
Willem de Bruijn <willemb@...gle.com>, Jesper Dangaard Brouer <brouer@...hat.com>,
Anatoly Burakov <anatoly.burakov@...el.com>, Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>, Maryam Tahhan <mtahhan@...hat.com>,
xdp-hints@...-project.net, netdev@...r.kernel.org,
Jesper Dangaard Brouer <jbrouer@...hat.com>
Subject: Re: [PATCH bpf-next v3 18/21] net: make vlan_get_tag() return
-ENODATA instead of -EINVAL
On 07/19, Larysa Zaremba wrote:
> __vlan_hwaccel_get_tag() is used in veth XDP hints implementation,
> its return value (-EINVAL if skb is not VLAN tagged) is passed to bpf code,
> but XDP hints specification requires drivers to return -ENODATA, if a hint
> cannot be provided for a particular packet.
>
> Solve this inconsistency by changing error return value of
> __vlan_hwaccel_get_tag() from -EINVAL to -ENODATA, do the same thing to
> __vlan_get_tag(), because this function is supposed to follow the same
> convention. This, in turn, makes -ENODATA the only non-zero value
> vlan_get_tag() can return. We can do this with no side effects, because
> none of the users of the 3 above-mentioned functions rely on the exact
> value.
>
> Suggested-by: Jesper Dangaard Brouer <jbrouer@...hat.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
Acked-by: Stanislav Fomichev <sdf@...gle.com>
> ---
> include/linux/if_vlan.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
> index 6ba71957851e..fb35d7dd77a2 100644
> --- a/include/linux/if_vlan.h
> +++ b/include/linux/if_vlan.h
> @@ -540,7 +540,7 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
> struct vlan_ethhdr *veth = skb_vlan_eth_hdr(skb);
>
> if (!eth_type_vlan(veth->h_vlan_proto))
> - return -EINVAL;
> + return -ENODATA;
>
> *vlan_tci = ntohs(veth->h_vlan_TCI);
> return 0;
> @@ -561,7 +561,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
> return 0;
> } else {
> *vlan_tci = 0;
> - return -EINVAL;
> + return -ENODATA;
> }
> }
>
> --
> 2.41.0
>
Powered by blists - more mailing lists