Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1436810rwl; Wed, 12 Apr 2023 12:51:38 -0700 (PDT) X-Google-Smtp-Source: AKy350bCDp3sdc5CQMSAZ3QrD2fs2ocOnaT/eJQYA82C6QEhr8NSUmdstWJwCyPNJocX0Ue3AYhs X-Received: by 2002:aa7:8383:0:b0:635:d9e1:8e1e with SMTP id u3-20020aa78383000000b00635d9e18e1emr4168596pfm.11.1681329098646; Wed, 12 Apr 2023 12:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681329098; cv=none; d=google.com; s=arc-20160816; b=EF52y2jZqBLnTLNNLYp7OkLN49WajovcPokyEhZC7Pc0Z6fkb3EkNxilPgnDtL+tuH gtQ1/GuuHmyBef4PEkPECzO1W5Tm6uKORuA7t0/l7fBsXSYZ4oqitvueLEB5FYraiv+1 qmp18ER6UqDFLuauctuL59xTTzKSGL7MY1CUIqoNLeo4PofBmWsuwo8NEldCQED7h9GB 9bPrhan260Z0wAi9wSu2Zbsv3u1FjK/liXiIq9aYW2Hk1dYl8DCJzp4JqN0lWnQL/7Jx 8PSqOFi763LQeh+9CGXGvYIMQQ/qS3n6rjVjJzxyOc9AO+aooVfRUG/oWrCadCwVZx6I 8mVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=cSVYWifKD7SQGSjuGFZiN+et2zmCoRo8LLSGhODudbI=; b=iEonu5o15E9wwJYaJWpvh/Gv+4mPIewQKK34PvbuGtguHgRk9YNV48jxISsaGcWrSW LLozjtNSIkaBbCzdmJVdvzFgCyACZH37jgnjZKuulBJkbbN7Vq7ekNZhVuAlLkTNBdfB EiDhGEQo/Tlb8qiK+w/caxJOWgPGYm8lhXKbbIqBWxT2IOfRsvNr1Z481dy3H3LL4Svn 4FFlLfK7Iya3xKW7NFuA2MH3C0YKg/QD0KzX/9cbUcU3QnY62pVqcrbWiQHjVphHE4+O 0yOVTzS+wcuXDiNgIeNepZuUGFzCWMK1hHI3nukerg3GEYgp/f0CLOgIKTjbjwdBZDsN bIPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g47abylV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a63d242000000b005134680e477si17142151pgi.499.2023.04.12.12.51.26; Wed, 12 Apr 2023 12:51:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g47abylV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230321AbjDLTuq (ORCPT + 99 others); Wed, 12 Apr 2023 15:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbjDLTuL (ORCPT ); Wed, 12 Apr 2023 15:50:11 -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 5A0AE5B88 for ; Wed, 12 Apr 2023 12:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681328942; 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=cSVYWifKD7SQGSjuGFZiN+et2zmCoRo8LLSGhODudbI=; b=g47abylVGfd0VSMxam54UKXGS5lJcuWbVVIzN8Mx/vX5zDIPntHnWLbfsMTffc58XR29y/ aFBeZHHLGIblrFEQldO1i3lwpEUce8qO96AHI5tqsxJo1DzD9Zgmv4eI8UPkbnm24WrhdU aWTXrhTf+QqbylreMplYpZtTz2k5qjs= 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-620-5d6WFOo9Owa8ZiUh36i_fw-1; Wed, 12 Apr 2023 15:48:58 -0400 X-MC-Unique: 5d6WFOo9Owa8ZiUh36i_fw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D328F3C0F22F; Wed, 12 Apr 2023 19:48:56 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D34840C20FA; Wed, 12 Apr 2023 19:48:56 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id A262E307372E8; Wed, 12 Apr 2023 21:48:55 +0200 (CEST) Subject: [PATCH bpf V10 5/6] mlx4: bpf_xdp_metadata_rx_hash add xdp rss hash type From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= 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, tariqt@nvidia.com, saeedm@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org Date: Wed, 12 Apr 2023 21:48:55 +0200 Message-ID: <168132893562.340624.12779118462402031248.stgit@firesoul> In-Reply-To: <168132888942.340624.2449617439220153267.stgit@firesoul> References: <168132888942.340624.2449617439220153267.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update API for bpf_xdp_metadata_rx_hash() with arg for xdp rss hash type via matching individual Completion Queue Entry (CQE) status bits. Fixes: ab46182d0dcb ("net/mlx4_en: Support RX XDP metadata") Signed-off-by: Jesper Dangaard Brouer Acked-by: Toke Høiland-Jørgensen Acked-by: Stanislav Fomichev --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 73d10aa4c503..332472fe4990 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -685,11 +685,28 @@ int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash, enum xdp_rss_hash_type *rss_type) { struct mlx4_en_xdp_buff *_ctx = (void *)ctx; + struct mlx4_cqe *cqe = _ctx->cqe; + enum xdp_rss_hash_type xht = 0; + __be16 status; if (unlikely(!(_ctx->dev->features & NETIF_F_RXHASH))) return -ENODATA; - *hash = be32_to_cpu(_ctx->cqe->immed_rss_invalid); + *hash = be32_to_cpu(cqe->immed_rss_invalid); + status = cqe->status; + if (status & cpu_to_be16(MLX4_CQE_STATUS_TCP)) + xht = XDP_RSS_L4_TCP; + if (status & cpu_to_be16(MLX4_CQE_STATUS_UDP)) + xht = XDP_RSS_L4_UDP; + if (status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 | MLX4_CQE_STATUS_IPV4F)) + xht |= XDP_RSS_L3_IPV4; + if (status & cpu_to_be16(MLX4_CQE_STATUS_IPV6)) { + xht |= XDP_RSS_L3_IPV6; + if (cqe->ipv6_ext_mask) + xht |= XDP_RSS_L3_DYNHDR; + } + *rss_type = xht; + return 0; }