Skip to content

Commit a72922a

Browse files
orospivecera
authored andcommitted
net: make vlan_get_tag() return -ENODATA instead of -EINVAL
JIRA: https://issues.redhat.com/browse/RHEL-31890 Upstream commit(s): commit 537fec0 Author: Larysa Zaremba <larysa.zaremba@intel.com> Date: Tue Dec 5 22:08:42 2023 +0100 net: make vlan_get_tag() return -ENODATA instead of -EINVAL __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@redhat.com> Acked-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> Link: https://lore.kernel.org/r/20231205210847.28460-14-larysa.zaremba@intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent 5a34443 commit a72922a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/if_vlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
543543
struct vlan_ethhdr *veth = skb_vlan_eth_hdr(skb);
544544

545545
if (!eth_type_vlan(veth->h_vlan_proto))
546-
return -EINVAL;
546+
return -ENODATA;
547547

548548
*vlan_tci = ntohs(veth->h_vlan_TCI);
549549
return 0;
@@ -564,7 +564,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
564564
return 0;
565565
} else {
566566
*vlan_tci = 0;
567-
return -EINVAL;
567+
return -ENODATA;
568568
}
569569
}
570570

0 commit comments

Comments
 (0)