Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2445624rwl; Thu, 30 Mar 2023 10:21:18 -0700 (PDT) X-Google-Smtp-Source: AKy350YaneoyArb7mVFN4OuACSuJkEmZqwmQZTOv2ezLSqy6RO+EV6EYTu/Yyg5UqGx97epk0wW+ X-Received: by 2002:a05:6a00:2987:b0:624:bf7e:9d8c with SMTP id cj7-20020a056a00298700b00624bf7e9d8cmr3169668pfb.1.1680196878258; Thu, 30 Mar 2023 10:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680196878; cv=none; d=google.com; s=arc-20160816; b=gwm5YGFvCXhgENqRh1fGIn9mdg3GGrNnifpy0lTjb1tlqQPnM/LEqITznDnbO6GEB4 ONWVrEbqq1KDKw4ZO0rF4kCOZqpRtfkH4R4dOVI/ZyymskyKU5a9gLDbsOHqeJa92nw5 IBrWXM4kpicuIODBtP9xWu04ox+qgBU6cv1iebE7vnuJsdCe/O7Pc8kZ5jD1VIjdq8oi Mc71MCdR8KsGp46L1m6kmk2WYJSQHR1uiqPfyRUlRe34BKqoBpxSsI1TTo4WwrFWWg/S DJnibsWzI6Zj3K6xwqHfmE63ZC3tO+4XqmeHhlRaTO57jjcumi/hQRcUJoJfTvFdRhSO hLYw== 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=NZoFlTLlLEFnWNA/e5RUGygzU5KPyB6B2U1PTeQjWe4=; b=ybV3tVQH9/TWWmTbvh1YK3uvKtlK4kC51ETCLxtqUsoSp9CxsSp9s4932KaYAjxBzC FBvazoj28GcYEa3L0aGJ1nlqCCMorMX06JFsIPhK24MYO7zQqFFLV1yruAX2zX+wL5Pb EZl1y3UamJVfO1545xcuQQ00pGzgEtB1t9qYogUUHN1lov+kheXoI38wMnxrHSSxURRZ 2BjeMHlISq5j94iWYIdxH08uTGMG2DCirl6MxMHLH8pxouoZVFOJ1xzGaZdfBg9hUf1Y axb1CbTPkEhOMNWaaZxLamahdxuCBH9sTm2pR6yIbhgvtzGzFaVXwyNPz0vucleYDtfA DWnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WnwgCtqp; 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 z15-20020aa79f8f000000b005a91e757a39si246184pfr.169.2023.03.30.10.21.01; Thu, 30 Mar 2023 10:21:18 -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=WnwgCtqp; 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 S232269AbjC3RJB (ORCPT + 99 others); Thu, 30 Mar 2023 13:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232184AbjC3RIx (ORCPT ); Thu, 30 Mar 2023 13:08:53 -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 27BB7CDDC for ; Thu, 30 Mar 2023 10:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680196082; 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=NZoFlTLlLEFnWNA/e5RUGygzU5KPyB6B2U1PTeQjWe4=; b=WnwgCtqppdJ3oYYa9rQu5zfxaDug4Mwud25OD+uZ43Mbst0KcS2ZMQuLxp9zK+SnKMW9D6 3+OjuqkDo4XJCj/UcosW80MGtX6P3mz0WRAfVY5zMaDBRZKDWSUIowbiH3vtkmPE0Hxa4R 60URHSgIkWCPHi7rnWiCoPQJ2LxrduQ= 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-452-aug2f9xDNsKg0k9hF4gfzg-1; Thu, 30 Mar 2023 13:07:58 -0400 X-MC-Unique: aug2f9xDNsKg0k9hF4gfzg-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 C643A101A54F; Thu, 30 Mar 2023 17:07:56 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 860244042AC0; Thu, 30 Mar 2023 17:07:56 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id E2D5430736C72; Thu, 30 Mar 2023 19:07:55 +0200 (CEST) Subject: [PATCH bpf RFC-V3 3/5] veth: bpf_xdp_metadata_rx_hash add 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: Thu, 30 Mar 2023 19:07:55 +0200 Message-ID: <168019607588.3557870.8079404138352729694.stgit@firesoul> In-Reply-To: <168019602958.3557870.9960387532660882277.stgit@firesoul> References: <168019602958.3557870.9960387532660882277.stgit@firesoul> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-0.2 required=5.0 tests=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. Signed-off-by: Jesper Dangaard Brouer --- drivers/net/veth.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index c1178915496d..f5381e7c9310 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1648,14 +1648,19 @@ static int veth_xdp_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp) return 0; } -static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash) +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; }