Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1221460rwl; Fri, 31 Mar 2023 08:13:07 -0700 (PDT) X-Google-Smtp-Source: AK7set8tKSL3XUZW/V/V0wRo1Idb3cPYFkZcMMg8jOYqdoxkq7/UcW4/33v6YONPtAfUHsDXX+PH X-Received: by 2002:a05:6a20:748c:b0:cd:fc47:dd73 with SMTP id p12-20020a056a20748c00b000cdfc47dd73mr32676835pzd.2.1680275587073; Fri, 31 Mar 2023 08:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680275587; cv=none; d=google.com; s=arc-20160816; b=pSCsTVc96AzDSTQFcaxqA9A7GxVlfHyqUosqqyF2JO8+tjWTHsnM053jG0qnzyvunF prTLHfv416M1Xqyl1inJmlzANi4+x9p4qXpUKR/5r7pm7LDQYh23MOKAhtYblTfpdqJ3 kyhxtJ6LlgcAnobUEh3a/tIcdgBY39u77Rq5L2F2BYAxqLxt/+GUb7ZhpM/5xWtjKGLY gm1ubvTjlhxtOrHc2RkhfjEDY9YakdGDJEou20k1YNleGut2OeuB/7fq1UBwoAenl/l9 ft88LImhdHVE1CJtP/g4LkV2lojSE3OcVwbgchXr8zcgI3jJ/fmqveq3YTwOQJNQ6rAA eZKg== 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=NTHm0roWAf7TQFvInPD+g2gqpP2BBJVAUuG4X2BR8/k=; b=LKrFeYhdexiPt+0l9/Ej3I5LGfDTvnUghzG0TezkFwseCQVeI0QD/1t3yCixryDj3X Z1RpGMuN45BFOyUQYnm/Qtc8V/o2MHCqDnpay1fShAFjLhBej7U4Gd31QUqs5ZD4R10e BgoVMjANnJIb2iZVDUETHIRmm1Cl+2LN46m4OdOAdyUbvE0WN/2R2+OOz63A1oQXhNO/ lfEjbw5Ksb+1EDjCRpUnQuJFQNlMp9eFrqDdpazgsFX0gWpuuQGwiGioiCBiVny8aVwx 8URjwfQyVnvrfKRhktVxZjqYyl5QTBCFkh1r07QbkEWD2cjggCowf85G1yWRW/QcXWfv z0eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iCtjILw2; 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 j190-20020a6380c7000000b0051358b5c887si450606pgd.843.2023.03.31.08.12.53; Fri, 31 Mar 2023 08:13:07 -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=iCtjILw2; 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 S233169AbjCaPEY (ORCPT + 99 others); Fri, 31 Mar 2023 11:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbjCaPEM (ORCPT ); Fri, 31 Mar 2023 11:04:12 -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 2A13D1D843 for ; Fri, 31 Mar 2023 08:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680275004; 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=NTHm0roWAf7TQFvInPD+g2gqpP2BBJVAUuG4X2BR8/k=; b=iCtjILw2it45V2gRVBK4zYo3Ld0md7C5AP3Zm9Vm5IemLmuGdg+tPC8K1Ylg0667VieGI1 YrJtopldFoOyb3UiTr0D0P3IkSzWQxgX+zjYoycMl31ooI8UD1BjcjxUmI9rPUhOV2n2Kj Uql+xsAVCUlFUHD6+ZeZdofL0KIRqzE= 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-27-FDIny1NROJGiQI5iw8F-Iw-1; Fri, 31 Mar 2023 11:03:19 -0400 X-MC-Unique: FDIny1NROJGiQI5iw8F-Iw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E46029ABA03; Fri, 31 Mar 2023 15:03:18 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 036B0492C3E; Fri, 31 Mar 2023 15:03:18 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 1A22830736C72; Fri, 31 Mar 2023 17:03:17 +0200 (CEST) Subject: [PATCH bpf V4 3/5] 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 Date: Fri, 31 Mar 2023 17:03:17 +0200 Message-ID: <168027499706.3941176.15786196864241739433.stgit@firesoul> In-Reply-To: <168027495947.3941176.6690238098903275241.stgit@firesoul> References: <168027495947.3941176.6690238098903275241.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.10 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. Fixes: 306531f0249f ("veth: Support RX XDP metadata") Signed-off-by: Jesper Dangaard Brouer Acked-by: Toke Høiland-Jørgensen --- 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; }