From nobody Mon Feb 9 03:34:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA0F0C6FD18 for ; Wed, 29 Mar 2023 16:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjC2QaW (ORCPT ); Wed, 29 Mar 2023 12:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjC2QaE (ORCPT ); Wed, 29 Mar 2023 12:30:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D665FCA for ; Wed, 29 Mar 2023 09:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680107347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vnayASVoGfkPCqyQK+FSloIGuh996kv6+G+Hk7krqE4=; b=R61+TOfeC3igF5cGW2O2plyiEX8E8hKkVzRx/N6mp9CskUHD6FksnptF77xuJdmdZuPNvW vERKpZfz9qTbwfFavSFXTr59R8regaFn1I/hnJ1vt4fGjnTYH8YzKKQLnQjvzFTUioG0B5 3iDEoLqNs9vEOaU5xWOxVX7s8ig+yVI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-NmKGvAtlNLKqAHdQTB3maw-1; Wed, 29 Mar 2023 12:29:05 -0400 X-MC-Unique: NmKGvAtlNLKqAHdQTB3maw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D87B885627; Wed, 29 Mar 2023 16:29:04 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1281C4020C83; Wed, 29 Mar 2023 16:29:04 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 4B4A830736C72; Wed, 29 Mar 2023 18:29:03 +0200 (CEST) Subject: [PATCH bpf RFC-V2 1/5] xdp: rss hash types representation From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net Date: Wed, 29 Mar 2023 18:29:03 +0200 Message-ID: <168010734324.3039990.16454026957159811204.stgit@firesoul> In-Reply-To: <168010726310.3039990.2753040700813178259.stgit@firesoul> References: <168010726310.3039990.2753040700813178259.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The RSS hash type specifies what portion of packet data NIC hardware used when calculating RSS hash value. The RSS types are focused on Internet traffic protocols at OSI layers L3 and L4. L2 (e.g. ARP) often get hash value zero and no RSS type. For L3 focused on IPv4 vs. IPv6, and L4 primarily TCP vs UDP, but some hardware supports SCTP. Hardware RSS types are differently encoded for each hardware NIC. Most hardware represent RSS hash type as a number. Determining L3 vs L4 often requires a mapping table as there often isn't a pattern or sorting according to ISO layer. The patch introduce a XDP RSS hash type (xdp_rss_hash_type) that can both be seen as a number that is ordered according by ISO layer, and can be bit masked to separate IPv4 and IPv6 types for L4 protocols. Room is available for extending later while keeping these properties. This maps and unifies difference to hardware specific hashes. This proposal change the kfunc API bpf_xdp_metadata_rx_hash() to return this RSS hash type on success. Signed-off-by: Jesper Dangaard Brouer --- include/net/xdp.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ net/core/xdp.c | 4 ++- 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/include/net/xdp.h b/include/net/xdp.h index 5393b3ebe56e..1b2b17625c26 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -8,6 +8,7 @@ =20 #include /* skb_shared_info */ #include +#include =20 /** * DOC: XDP RX-queue information @@ -396,6 +397,81 @@ XDP_METADATA_KFUNC_xxx MAX_XDP_METADATA_KFUNC, }; =20 +/* For partitioning of xdp_rss_hash_type */ +#define RSS_L3 GENMASK(2,0) /* 3-bits =3D values between 1-7 */ +#define L4_BIT BIT(3) /* 1-bit - L4 indication */ +#define RSS_L4_IPV4 GENMASK(6,4) /* 3-bits */ +#define RSS_L4_IPV6 GENMASK(9,7) /* 3-bits */ +#define RSS_L4 GENMASK(9,3) /* =3D 7-bits - covering L4 IPV4+IPV6 */ +#define L4_IPV6_EX_BIT BIT(9) /* 1-bit - L4 IPv6 with Extension hdr = */ + /* 11-bits in total */ + +/* Lower 4-bits value of xdp_rss_hash_type */ +enum xdp_rss_L4 { + XDP_RSS_L4_MASK =3D GENMASK(3,0), /* 4-bits =3D values between 0-15 */ + XDP_RSS_L4_NONE =3D 0, /* Not L4 based hash */ + XDP_RSS_L4_ANY =3D 1, /* L4 based hash but protocol unknown */ + XDP_RSS_L4_TCP =3D 2, + XDP_RSS_L4_UDP =3D 3, + XDP_RSS_L4_SCTP =3D 4, + XDP_RSS_L4_IPSEC =3D 5, /* L4 based hash include IPSEC SPI */ +/* + RFC: We don't care about vasting space, then we could just store the + protocol number (8-bits) directly. See /etc/protocols + XDP_RSS_L4_TCP =3D 6, + XDP_RSS_L4_UDP =3D 17, + XDP_RSS_L4_SCTP =3D 132, + XDP_RSS_L4_IPSEC_ESP =3D 50, // Issue: mlx5 didn't say ESP or AH + XDP_RSS_L4_IPSEC_AH =3D 51, // both ESP+AH just include SPI in hash + */ +}; + +/* Values shifted for use in xdp_rss_hash_type */ +enum xdp_rss_L3 { + XDP_RSS_L3_MASK =3D GENMASK(5,4), /* 2-bits =3D values between 1-3 */ + XDP_RSS_L3_IPV4 =3D FIELD_PREP_CONST(XDP_RSS_L3_MASK, 1), + XDP_RSS_L3_IPV6 =3D FIELD_PREP_CONST(XDP_RSS_L3_MASK, 2), +}; + +/* Bits shifted for use in xdp_rss_hash_type */ +enum xdp_rss_bit { + XDP_RSS_BIT_MASK =3D GENMASK(7,6), /* 2-bits */ + /* IPv6 Extension Hdr */ + XDP_RSS_BIT_EX =3D FIELD_PREP_CONST(XDP_RSS_BIT_MASK, BIT(0)), + /* XDP_RSS_BIT_VLAN ??? =3D FIELD_PREP_CONST(XDP_RSS_BIT_MASK, BIT(1)), */ +}; + +/* RSS hash type combinations used for driver HW mapping */ +enum xdp_rss_hash_type { + XDP_RSS_TYPE_NONE =3D 0, + XDP_RSS_TYPE_L2 =3D XDP_RSS_TYPE_NONE, + + XDP_RSS_TYPE_L3_MASK =3D XDP_RSS_L3_MASK, + XDP_RSS_TYPE_L3_IPV4 =3D XDP_RSS_L3_IPV4, + XDP_RSS_TYPE_L3_IPV6 =3D XDP_RSS_L3_IPV6, + XDP_RSS_TYPE_L3_IPV6_EX =3D XDP_RSS_L3_IPV6 | XDP_RSS_BIT_EX, + + XDP_RSS_TYPE_L4_MASK =3D XDP_RSS_L4_MASK, + XDP_RSS_TYPE_L4_ANY =3D XDP_RSS_L4_ANY, + XDP_RSS_TYPE_L4_IPV4_TCP =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_TCP, + XDP_RSS_TYPE_L4_IPV4_UDP =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_UDP, + XDP_RSS_TYPE_L4_IPV4_SCTP =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_SCTP, + + XDP_RSS_TYPE_L4_IPV6_TCP =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_TCP, + XDP_RSS_TYPE_L4_IPV6_UDP =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_UDP, + XDP_RSS_TYPE_L4_IPV6_SCTP =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_UDP, + + XDP_RSS_TYPE_L4_IPV6_TCP_EX =3D XDP_RSS_TYPE_L4_IPV6_TCP |XDP_RSS_BIT_EX, + XDP_RSS_TYPE_L4_IPV6_UDP_EX =3D XDP_RSS_TYPE_L4_IPV6_UDP |XDP_RSS_BIT_EX, + XDP_RSS_TYPE_L4_IPV6_SCTP_EX =3D XDP_RSS_TYPE_L4_IPV6_SCTP|XDP_RSS_BIT_EX, +}; +#undef RSS_L3 +#undef L4_BIT +#undef RSS_L4_IPV4 +#undef RSS_L4_IPV6 +#undef RSS_L4 +#undef L4_IPV6_EX_BIT + #ifdef CONFIG_NET u32 bpf_xdp_metadata_kfunc_id(int id); bool bpf_dev_bound_kfunc_id(u32 btf_id); diff --git a/net/core/xdp.c b/net/core/xdp.c index 7133017bcd74..81d41df30695 100644 --- a/net/core/xdp.c +++ b/net/core/xdp.c @@ -721,12 +721,14 @@ __bpf_kfunc int bpf_xdp_metadata_rx_timestamp(const s= truct xdp_md *ctx, u64 *tim * @hash: Return value pointer. * * Return: - * * Returns 0 on success or ``-errno`` on error. + * * Returns (positive) RSS hash **type** on success or ``-errno`` on erro= r. + * * ``enum xdp_rss_hash_type`` : RSS hash type * * ``-EOPNOTSUPP`` : means device driver doesn't implement kfunc * * ``-ENODATA`` : means no RX-hash available for this frame */ __bpf_kfunc int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, u32 *ha= sh) { + BTF_TYPE_EMIT(enum xdp_rss_hash_type); return -EOPNOTSUPP; } From nobody Mon Feb 9 03:34:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A1A5C6FD18 for ; Wed, 29 Mar 2023 16:30:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbjC2Qa0 (ORCPT ); Wed, 29 Mar 2023 12:30:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbjC2QaL (ORCPT ); Wed, 29 Mar 2023 12:30:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E35C35240 for ; Wed, 29 Mar 2023 09:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680107357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vdLO4Y9b3BsmrzeQcmRa2KtBaNDjkTa0G8yC7xzEAHs=; b=ONlXOSmma5Wt/k0voP+RJJVRrfYaDEleAyzy1ZeBjAVOOmt5/Jst3J6cYomL2G6DNVV4Zy vkD5aVrksLbNBovZRxKGPZKSY3bes/5RetrikvNG9HXGbCO+pwLQcjwzL7W7Ii8x/8vGw1 nVBQoeZtgBilqVUigVT4cOp02PRI+lk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-147-lMCce-KrNl6Ba0Qy_Vxf1Q-1; Wed, 29 Mar 2023 12:29:10 -0400 X-MC-Unique: lMCce-KrNl6Ba0Qy_Vxf1Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82961857F81; Wed, 29 Mar 2023 16:29:09 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3913F2027040; Wed, 29 Mar 2023 16:29:09 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 5A33E30736C72; Wed, 29 Mar 2023 18:29:08 +0200 (CEST) Subject: [PATCH bpf RFC-V2 2/5] igc: bpf_xdp_metadata_rx_hash return xdp rss hash type From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net Date: Wed, 29 Mar 2023 18:29:08 +0200 Message-ID: <168010734832.3039990.11189218865563948327.stgit@firesoul> In-Reply-To: <168010726310.3039990.2753040700813178259.stgit@firesoul> References: <168010726310.3039990.2753040700813178259.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update API for bpf_xdp_metadata_rx_hash() by returning xdp rss hash type via mapping table. Signed-off-by: Jesper Dangaard Brouer --- drivers/net/ethernet/intel/igc/igc_main.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethern= et/intel/igc/igc_main.c index b382476f347c..a14f0597524a 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -6496,6 +6496,26 @@ static int igc_xdp_rx_timestamp(const struct xdp_md = *_ctx, u64 *timestamp) return -ENODATA; } =20 +/* Mapping HW RSS Type to enum xdp_rss_hash_type */ +enum xdp_rss_hash_type igc_xdp_rss_type[IGC_RSS_TYPE_MAX_TABLE] =3D { + [IGC_RSS_TYPE_NO_HASH] =3D XDP_RSS_TYPE_L2, + [IGC_RSS_TYPE_HASH_TCP_IPV4] =3D XDP_RSS_TYPE_L4_IPV4_TCP, + [IGC_RSS_TYPE_HASH_IPV4] =3D XDP_RSS_TYPE_L3_IPV4, + [IGC_RSS_TYPE_HASH_TCP_IPV6] =3D XDP_RSS_TYPE_L4_IPV6_TCP, + [IGC_RSS_TYPE_HASH_IPV6_EX] =3D XDP_RSS_TYPE_L3_IPV6_EX, + [IGC_RSS_TYPE_HASH_IPV6] =3D XDP_RSS_TYPE_L3_IPV6, + [IGC_RSS_TYPE_HASH_TCP_IPV6_EX] =3D XDP_RSS_TYPE_L4_IPV6_TCP_EX, + [IGC_RSS_TYPE_HASH_UDP_IPV4] =3D XDP_RSS_TYPE_L4_IPV4_UDP, + [IGC_RSS_TYPE_HASH_UDP_IPV6] =3D XDP_RSS_TYPE_L4_IPV6_UDP, + [IGC_RSS_TYPE_HASH_UDP_IPV6_EX] =3D XDP_RSS_TYPE_L4_IPV6_UDP_EX, + [10] =3D XDP_RSS_TYPE_NONE, /* RSS Type above 9 "Reserved" by HW */ + [11] =3D XDP_RSS_TYPE_NONE, /* keep array sized for SW bit-mask */ + [12] =3D XDP_RSS_TYPE_NONE, /* to handle future HW revisons */ + [13] =3D XDP_RSS_TYPE_NONE, + [14] =3D XDP_RSS_TYPE_NONE, + [15] =3D XDP_RSS_TYPE_NONE, +}; + static int igc_xdp_rx_hash(const struct xdp_md *_ctx, u32 *hash) { const struct igc_xdp_buff *ctx =3D (void *)_ctx; @@ -6505,7 +6525,7 @@ static int igc_xdp_rx_hash(const struct xdp_md *_ctx,= u32 *hash) =20 *hash =3D le32_to_cpu(ctx->rx_desc->wb.lower.hi_dword.rss); =20 - return 0; + return igc_xdp_rss_type[igc_rss_type(ctx->rx_desc)]; } =20 const struct xdp_metadata_ops igc_xdp_metadata_ops =3D { From nobody Mon Feb 9 03:34:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43E2CC74A5B for ; Wed, 29 Mar 2023 16:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230058AbjC2Qae (ORCPT ); Wed, 29 Mar 2023 12:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbjC2QaO (ORCPT ); Wed, 29 Mar 2023 12:30:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2E3B5B92 for ; Wed, 29 Mar 2023 09:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680107362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=phrCwuF2IZNqe/IWguOcg/v1PLS/jorujG/kF7C6s+4=; b=ghul+NnHInC5pK4mB6Kd/QSAF9kQ4aFHC40URyCjlwAprBMyuQaMomEYPOL0bwwalzsU3x RwdKrM4Qj/5hk6lJqOXyFGdPggYdZ38MxdLOWTd2dTQCmfEtNgC2e0msFV9+KPCqeVZidV 1Aowz8IbtOtrPYjYAM/aU/mntp5uiMs= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-216-22tuEMDwMvKNnNE4IGw0gw-1; Wed, 29 Mar 2023 12:29:15 -0400 X-MC-Unique: 22tuEMDwMvKNnNE4IGw0gw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 806CE3C0F22C; Wed, 29 Mar 2023 16:29:14 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45C45492B02; Wed, 29 Mar 2023 16:29:14 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 6815230736C72; Wed, 29 Mar 2023 18:29:13 +0200 (CEST) Subject: [PATCH bpf RFC-V2 3/5] veth: bpf_xdp_metadata_rx_hash return xdp rss hash type From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net Date: Wed, 29 Mar 2023 18:29:13 +0200 Message-ID: <168010735338.3039990.5752685085641326312.stgit@firesoul> In-Reply-To: <168010726310.3039990.2753040700813178259.stgit@firesoul> References: <168010726310.3039990.2753040700813178259.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update API for bpf_xdp_metadata_rx_hash() by returning xdp rss hash type. The veth driver currently only support XDP-hints based on SKB code path. The SKB have lost information about the RSS hash type, by compressing the information down to a single bitfield skb->l4_hash, that only knows if this was a L4 hash value. In preparation for veth, the xdp_rss_hash_type have an L4 indication bit that allow us to return a meaningful L4 indication when working with SKB based packets. Signed-off-by: Jesper Dangaard Brouer --- drivers/net/veth.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 046461ee42ea..770eee664b4c 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1619,12 +1619,13 @@ static int veth_xdp_rx_timestamp(const struct xdp_m= d *ctx, u64 *timestamp) static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash) { struct veth_xdp_buff *_ctx =3D (void *)ctx; + struct sk_buff *skb =3D _ctx->skb; =20 - if (!_ctx->skb) + if (!skb) return -ENODATA; =20 - *hash =3D skb_get_hash(_ctx->skb); - return 0; + *hash =3D skb_get_hash(skb); + return skb->l4_hash ? XDP_RSS_TYPE_L4_ANY : XDP_RSS_TYPE_NONE; } =20 static const struct net_device_ops veth_netdev_ops =3D { From nobody Mon Feb 9 03:34:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE69EC6FD18 for ; Wed, 29 Mar 2023 16:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229978AbjC2Qai (ORCPT ); Wed, 29 Mar 2023 12:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjC2QaS (ORCPT ); Wed, 29 Mar 2023 12:30:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F48E5B99 for ; Wed, 29 Mar 2023 09:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680107364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LbBo3JUiU9snSoTMFxXc90++kUXU++le4jRZXCUg2Kk=; b=d5Yq8yzOlD/bKAzr8EWFZDYYe8b+t/+M8UdcXHZ5zMAlugVvJxYZ8QzU8RptcLNJZjl1EQ zs0D+BqVmnC1yAsCmyX0o6SJlbWNmeBwazxxNJN2EfM81us9NMhVv0kUyCOrMP6Vjz30n/ Gq1FKXUlUVOIk4ZZ+CyeEYWcitcuOUw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-Z5bn9iCzPqqZUhygrV6jvQ-1; Wed, 29 Mar 2023 12:29:20 -0400 X-MC-Unique: Z5bn9iCzPqqZUhygrV6jvQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AC7B22806044; Wed, 29 Mar 2023 16:29:19 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51863202701E; Wed, 29 Mar 2023 16:29:19 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 7667430736C72; Wed, 29 Mar 2023 18:29:18 +0200 (CEST) Subject: [PATCH bpf RFC-V2 4/5] mlx5: bpf_xdp_metadata_rx_hash return xdp rss hash type From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net Date: Wed, 29 Mar 2023 18:29:18 +0200 Message-ID: <168010735844.3039990.17106215605594751233.stgit@firesoul> In-Reply-To: <168010726310.3039990.2753040700813178259.stgit@firesoul> References: <168010726310.3039990.2753040700813178259.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update API for bpf_xdp_metadata_rx_hash() by returning xdp rss hash type via mapping table. The mlx5 hardware can also identify and RSS hash IPSEC. This indicate hash includes SPI (Security Parameters Index) as part of IPSEC hash. Extend xdp core enum xdp_rss_hash_type with IPSEC hash type. Signed-off-by: Jesper Dangaard Brouer --- drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 61 ++++++++++++++++++= +++- include/linux/mlx5/device.h | 14 ++++- include/net/xdp.h | 3 + 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net= /ethernet/mellanox/mlx5/core/en/xdp.c index c5dae48b7932..d3dfe11f4d50 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c @@ -34,6 +34,7 @@ #include #include "en/xdp.h" #include "en/params.h" +#include =20 int mlx5e_xdp_max_mtu(struct mlx5e_params *params, struct mlx5e_xsk_param = *xsk) { @@ -169,15 +170,71 @@ static int mlx5e_xdp_rx_timestamp(const struct xdp_md= *ctx, u64 *timestamp) return 0; } =20 +/* Mapping HW RSS Type bits CQE_RSS_HTYPE_IP + CQE_RSS_HTYPE_L4 into 4-bit= s*/ +#define RSS_TYPE_MAX_TABLE 16 /* 4-bits max 16 entries */ +#define RSS_L4 GENMASK(1,0) +#define RSS_L3 GENMASK(3,2) /* Same as CQE_RSS_HTYPE_IP */ + +/* Valid combinations of CQE_RSS_HTYPE_IP + CQE_RSS_HTYPE_L4 sorted numeri= cal */ +enum mlx5_rss_hash_type { + RSS_TYPE_NO_HASH =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IP_NONE)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_NONE)), + RSS_TYPE_L3_IPV4 =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV4)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_NONE)), + RSS_TYPE_L4_IPV4_TCP =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV4)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_TCP)), + RSS_TYPE_L4_IPV4_UDP =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV4)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_UDP)), + RSS_TYPE_L4_IPV4_IPSEC =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV4)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_IPSEC)), + RSS_TYPE_L3_IPV6 =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV6)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_NONE)), + RSS_TYPE_L4_IPV6_TCP =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV6)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_TCP)), + RSS_TYPE_L4_IPV6_UDP =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV6)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_UDP)), + RSS_TYPE_L4_IPV6_IPSEC =3D (FIELD_PREP_CONST(RSS_L3, CQE_RSS_IPV6)| \ + FIELD_PREP_CONST(RSS_L4, CQE_RSS_L4_IPSEC)), +} mlx5_rss_hash_type; + +/* Invalid combinations will simply return zero, allows no boundry checks = */ +static const enum xdp_rss_hash_type mlx5_xdp_rss_type[RSS_TYPE_MAX_TABLE] = =3D { + [RSS_TYPE_NO_HASH] =3D XDP_RSS_TYPE_NONE, + [1] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ + [2] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ + [3] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ + [RSS_TYPE_L3_IPV4] =3D XDP_RSS_TYPE_L3_IPV4, + [RSS_TYPE_L4_IPV4_TCP] =3D XDP_RSS_TYPE_L4_IPV4_TCP, + [RSS_TYPE_L4_IPV4_UDP] =3D XDP_RSS_TYPE_L4_IPV4_UDP, + [RSS_TYPE_L4_IPV4_IPSEC]=3D XDP_RSS_TYPE_L4_IPV4_IPSEC, + [RSS_TYPE_L3_IPV6] =3D XDP_RSS_TYPE_L3_IPV6, + [RSS_TYPE_L4_IPV6_TCP] =3D XDP_RSS_TYPE_L4_IPV6_TCP, + [RSS_TYPE_L4_IPV6_UDP] =3D XDP_RSS_TYPE_L4_IPV6_UDP, + [RSS_TYPE_L4_IPV6_IPSEC]=3D XDP_RSS_TYPE_L4_IPV6_IPSEC, + [12] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ + [13] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ + [14] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ + [15] =3D XDP_RSS_TYPE_NONE, /* Implicit zero */ +}; + static int mlx5e_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash) { const struct mlx5e_xdp_buff *_ctx =3D (void *)ctx; + const struct mlx5_cqe64 *cqe =3D _ctx->cqe; + u32 hash_type, l4_type, ip_type, lookup; =20 if (unlikely(!(_ctx->xdp.rxq->dev->features & NETIF_F_RXHASH))) return -ENODATA; =20 - *hash =3D be32_to_cpu(_ctx->cqe->rss_hash_result); - return 0; + *hash =3D be32_to_cpu(cqe->rss_hash_result); + + hash_type =3D cqe->rss_hash_type; + BUILD_BUG_ON(CQE_RSS_HTYPE_IP !=3D RSS_L3); /* same mask */ + ip_type =3D hash_type & CQE_RSS_HTYPE_IP; + l4_type =3D FIELD_GET(CQE_RSS_HTYPE_L4, hash_type); + lookup =3D ip_type | l4_type; + + return mlx5_xdp_rss_type[lookup]; } =20 const struct xdp_metadata_ops mlx5e_xdp_metadata_ops =3D { diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 71b06ebad402..27aa9ae10996 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h @@ -36,6 +36,7 @@ #include #include #include +#include =20 #if defined(__LITTLE_ENDIAN) #define MLX5_SET_HOST_ENDIANNESS 0 @@ -980,14 +981,23 @@ enum { }; =20 enum { - CQE_RSS_HTYPE_IP =3D 0x3 << 2, + CQE_RSS_HTYPE_IP =3D GENMASK(3,2), /* cqe->rss_hash_type[3:2] - IP destination selected for hash * (00 =3D none, 01 =3D IPv4, 10 =3D IPv6, 11 =3D Reserved) */ - CQE_RSS_HTYPE_L4 =3D 0x3 << 6, + CQE_RSS_IP_NONE =3D 0x0, + CQE_RSS_IPV4 =3D 0x1, + CQE_RSS_IPV6 =3D 0x2, + CQE_RSS_RESERVED =3D 0x3, + + CQE_RSS_HTYPE_L4 =3D GENMASK(7,6), /* cqe->rss_hash_type[7:6] - L4 destination selected for hash * (00 =3D none, 01 =3D TCP. 10 =3D UDP, 11 =3D IPSEC.SPI */ + CQE_RSS_L4_NONE =3D 0x0, + CQE_RSS_L4_TCP =3D 0x1, + CQE_RSS_L4_UDP =3D 0x2, + CQE_RSS_L4_IPSEC =3D 0x3, }; =20 enum { diff --git a/include/net/xdp.h b/include/net/xdp.h index 1b2b17625c26..b9837cb378b2 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -456,14 +456,17 @@ enum xdp_rss_hash_type { XDP_RSS_TYPE_L4_IPV4_TCP =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_TCP, XDP_RSS_TYPE_L4_IPV4_UDP =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_UDP, XDP_RSS_TYPE_L4_IPV4_SCTP =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_SCTP, + XDP_RSS_TYPE_L4_IPV4_IPSEC =3D XDP_RSS_L3_IPV4 | XDP_RSS_L4_IPSEC, =20 XDP_RSS_TYPE_L4_IPV6_TCP =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_TCP, XDP_RSS_TYPE_L4_IPV6_UDP =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_UDP, XDP_RSS_TYPE_L4_IPV6_SCTP =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_UDP, + XDP_RSS_TYPE_L4_IPV6_IPSEC =3D XDP_RSS_L3_IPV6 | XDP_RSS_L4_IPSEC, =20 XDP_RSS_TYPE_L4_IPV6_TCP_EX =3D XDP_RSS_TYPE_L4_IPV6_TCP |XDP_RSS_BIT_EX, XDP_RSS_TYPE_L4_IPV6_UDP_EX =3D XDP_RSS_TYPE_L4_IPV6_UDP |XDP_RSS_BIT_EX, XDP_RSS_TYPE_L4_IPV6_SCTP_EX =3D XDP_RSS_TYPE_L4_IPV6_SCTP|XDP_RSS_BIT_EX, + XDP_RSS_TYPE_L4_IPV6_IPSEC_EX=3D XDP_RSS_TYPE_L4_IPV6_IPSEC|XDP_RSS_BIT_E= X, }; #undef RSS_L3 #undef L4_BIT From nobody Mon Feb 9 03:34:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D96FEC74A5B for ; Wed, 29 Mar 2023 16:30:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbjC2Qav (ORCPT ); Wed, 29 Mar 2023 12:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbjC2QaV (ORCPT ); Wed, 29 Mar 2023 12:30:21 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B4955BBD for ; Wed, 29 Mar 2023 09:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680107371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R04Vq+TEHO0b9S0yy8Ip00yZxPQlDgdJbbW0Gf6DdUk=; b=RpiYjKiJ1aEW/e12tza0fqWNpwZQ/nMO4i7+qVWCUeMC55zJOEBkl0OG05mY180uhHOkht EfpvautIZsFnmZWO3OcTuMydUmOk5WVt5PqNRV/kRwhgI28FmhhrJR1HOTzdFpcKo9Il2t JKIo8TJR8ZnRVfY1zCaksDcREIJSGbU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-12-58AnzNzGPmqO-eeEuGEBpA-1; Wed, 29 Mar 2023 12:29:25 -0400 X-MC-Unique: 58AnzNzGPmqO-eeEuGEBpA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D546885622; Wed, 29 Mar 2023 16:29:24 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60F541121330; Wed, 29 Mar 2023 16:29:24 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 8349430736C72; Wed, 29 Mar 2023 18:29:23 +0200 (CEST) Subject: [PATCH bpf RFC-V2 5/5] mlx4: bpf_xdp_metadata_rx_hash return xdp rss hash type From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net Date: Wed, 29 Mar 2023 18:29:23 +0200 Message-ID: <168010736349.3039990.15736472596192726923.stgit@firesoul> In-Reply-To: <168010726310.3039990.2753040700813178259.stgit@firesoul> References: <168010726310.3039990.2753040700813178259.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update API for bpf_xdp_metadata_rx_hash() by returning xdp rss hash type via matching indiviual Completion Queue Entry (CQE) status bits. Signed-off-by: Jesper Dangaard Brouer --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ether= net/mellanox/mlx4/en_rx.c index 4b5e459b6d49..f3b7351daa05 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -684,12 +684,28 @@ int mlx4_en_xdp_rx_timestamp(const struct xdp_md *ctx= , u64 *timestamp) int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash) { struct mlx4_en_xdp_buff *_ctx =3D (void *)ctx; + struct mlx4_cqe *cqe =3D _ctx->cqe; + enum xdp_rss_hash_type xht =3D 0; + __be16 status; =20 if (unlikely(!(_ctx->dev->features & NETIF_F_RXHASH))) return -ENODATA; =20 - *hash =3D be32_to_cpu(_ctx->cqe->immed_rss_invalid); - return 0; + status =3D cqe->status; + if (status & cpu_to_be16(MLX4_CQE_STATUS_TCP)) + xht =3D XDP_RSS_L4_TCP; + if (status & cpu_to_be16(MLX4_CQE_STATUS_UDP)) + xht =3D XDP_RSS_L4_UDP; + if (status & cpu_to_be16(MLX4_CQE_STATUS_IPV4|MLX4_CQE_STATUS_IPV4F)) + xht |=3D XDP_RSS_L3_IPV4; + if (status & cpu_to_be16(MLX4_CQE_STATUS_IPV6)) { + xht |=3D XDP_RSS_L3_IPV6; + if (cqe->ipv6_ext_mask) + xht |=3D XDP_RSS_BIT_EX; + } + + *hash =3D be32_to_cpu(cqe->immed_rss_invalid); + return xht; } =20 int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, i= nt budget)