From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mail.toke.dk (Postfix) with ESMTPS id DF884A1ADBE for ; Wed, 19 Jul 2023 20:42:22 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Sb3snFm8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689792143; x=1721328143; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JjjmdyCf+D506lXbRYWhT9vi+GlzjpQlHqbwhgkcabw=; b=Sb3snFm8efTRyoMsrr8udMryxKvJ8863DkCGdkYf3jaYCD2K0H75Z321 tPuH0EvgnIP5DklFNWsHGpgf126Y+rk31l9WrSJHuIBoZtPG8OL53FZ4s Dh6U4fQ/nfb8T6JyqSO7xJROTokIvFv/LtM2tvjUt+l2d7v7m0fKHebpE P2je0ANiOGqZZc11TAzHBF6a1Ehynr4aVQe8x2c7HopeZ/BHliEt6aDBr fYB5UJ4+eWQFkS49XfCyMVFwklS53JoBn7Zr8s5BuI0Gos1mWRjpMVxb4 63BG5V1MY8YoSBbi56Dmdnrolav9ihaW0ICyAgF5ui4wEOtuIvQ46mLCi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="356504857" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="356504857" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2023 11:42:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="674405807" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="674405807" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2023 11:42:17 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 93FAA33BE5; Wed, 19 Jul 2023 19:42:16 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Wed, 19 Jul 2023 20:37:31 +0200 Message-ID: <20230719183734.21681-19-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719183734.21681-1-larysa.zaremba@intel.com> References: <20230719183734.21681-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: JLEOZOTX4LZQ36O3NI43LD5XVQZ7X76E X-Message-ID-Hash: JLEOZOTX4LZQ36O3NI43LD5XVQZ7X76E X-MailFrom: larysa.zaremba@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Larysa Zaremba , ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, Jesper Dangaard Brouer X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] [PATCH bpf-next v3 18/21] net: make vlan_get_tag() return -ENODATA instead of -EINVAL List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: __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 Signed-off-by: Larysa Zaremba --- 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