Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1435827rwl; Wed, 12 Apr 2023 12:50:40 -0700 (PDT) X-Google-Smtp-Source: AKy350ZzmV7DNf4yWQI+aNEATLgwk2aG74cv4CBwRUR0IFXczmxXSg/3YZGXfOdORld1WQTcpLB6 X-Received: by 2002:a17:903:41c7:b0:1a5:1e15:9291 with SMTP id u7-20020a17090341c700b001a51e159291mr60943ple.22.1681329039919; Wed, 12 Apr 2023 12:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681329039; cv=none; d=google.com; s=arc-20160816; b=OzCE/6lm2nau6lERtrMkwCjepy7b8lcK4tBoMnfymvbZ1NX8p6pqNft+b1KfgmpIik USrm8JSCD39o5oqcgyfw145qohSpfkZ11TRMdGM6azKnrdwEXYYyOebZLeh4Sz4pZzh3 itodQyCPBCEJGZlmlAMuu2O4WaiwyiIhU5pDJKuQnY5dNb/KyHP7KJvh1ENBsDPpgZji 6/KhZQCT4vb+a5YSKkgrAgyYSDeF4x3EAWv377DUD9jPBJYTXhMYF+mDi+GuBDsS4dZu TOc33AyVS6Q0DlJ8Qo6BVwom0kM0JYj5p2wrgzgow9WVVh60pd+fvbf0ELxc7hqrWFfj As5A== 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=KMxLHr1nEJDBRCg1B8L488/y3xeAF5pIZJtw2W0lrWE=; b=scs9KB4iM2v/WNi/dxLAvCQU0VBPTXuNxAPsmDSkHBZse1SBoX7Thkj/5EwcDElOP3 pr5SL2fAdoh8jiLpoahqh3TG0Y4WZF1/7tXajuQiKQWROJ3ak6c4W9cgE1gsVbv5iTsN tcIZFY+3oyIbEa1OsgjthxyQBEsGziiNraJ5L7XxZxG0xs59fFnpsJp6aymC9A+osQQz I8pmCFbqM/JWtvZFxqF3BM2ngVhT9J8IyhTulupWaU/FjyUIOwMH0JPYxsiX9osRYjer plY8RZgur6AlYrtv3/ngpNXBqpdrcOon9/nTS5AOAAzlNTFfPSXUiwcRpEAmHM48xF4D xCGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cjUVa/9t"; 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 bd11-20020a170902830b00b001a1d987fe28si16741409plb.405.2023.04.12.12.50.28; Wed, 12 Apr 2023 12:50:39 -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="cjUVa/9t"; 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 S230340AbjDLTuM (ORCPT + 99 others); Wed, 12 Apr 2023 15:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230170AbjDLTtq (ORCPT ); Wed, 12 Apr 2023 15:49:46 -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 D23E544B6 for ; Wed, 12 Apr 2023 12:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681328938; 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=KMxLHr1nEJDBRCg1B8L488/y3xeAF5pIZJtw2W0lrWE=; b=cjUVa/9tRqhBNg1d6ieGPtMr+ZsM5Va5MbFButUdYIIg1yDBr5oef4PDxIYWuFcxhezuCu tD6Pr/jmwl2MlowCW9nPm6vPd6G58WMIN8el8bZnLxrflImLDrrDR8pRzByaSbgmIGgBW8 BnbC0XutcDM35KiVkIBhwpq0AE3mEQg= 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-448-f-9wXQd9Nza05UQKUibRKw-1; Wed, 12 Apr 2023 15:48:53 -0400 X-MC-Unique: f-9wXQd9Nza05UQKUibRKw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0700280BF65; Wed, 12 Apr 2023 19:48:51 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AB22FD6E; Wed, 12 Apr 2023 19:48:51 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 93601307372E8; Wed, 12 Apr 2023 21:48:50 +0200 (CEST) Subject: [PATCH bpf V10 4/6] veth: 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:50 +0200 Message-ID: <168132893055.340624.16209448340644513469.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.5 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. 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. Fixes: 306531f0249f ("veth: Support RX XDP metadata") Signed-off-by: Jesper Dangaard Brouer Acked-by: Toke Høiland-Jørgensen Acked-by: Stanislav Fomichev --- drivers/net/veth.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 424e8876a16b..e1b38fbf1dd9 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1652,11 +1652,14 @@ static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash, enum xdp_rss_hash_type *rss_type) { struct veth_xdp_buff *_ctx = (void *)ctx; + struct sk_buff *skb = _ctx->skb; - if (!_ctx->skb) + if (!skb) return -ENODATA; - *hash = skb_get_hash(_ctx->skb); + *hash = skb_get_hash(skb); + *rss_type = skb->l4_hash ? XDP_RSS_TYPE_L4_ANY : XDP_RSS_TYPE_NONE; + return 0; }