From patchwork Wed Mar 29 16:29:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 1762913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=bh7oIY/l; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PmsT2700Xz1yYb for ; Thu, 30 Mar 2023 03:29:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6119D8405B; Wed, 29 Mar 2023 16:29:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6119D8405B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1680107365; bh=ZSlBqdU8H9P2kXa5hLVpjWmyQMpBTplFyBrQgitsTpw=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=bh7oIY/l5REy1Bx1B7jNUx5mKjHa1vu7cWE9pcZ1UIkJMi3cBs9dpev089KfSBxGJ WwB0/mVjVWiCJrYsvpUDx25nCENwqZhvmMlmnDRdGRbzSb0E2QMDZVEnuX+QK5OIL5 KiAF5IkZ0umdhSVgqJr3G6JYfSe3f4PxM84i9jwrwgs6yQxYt8YbfhjxikE8iOc0/o AuGMOwEvQ1JFYeQ3KdIYIV9q9x7uZNMGBwCDng7easgU3VJ70ukG8cf+tYcPG8F8iH LJ2FfItKiqd7l4s1OHoWxmIti4B/KTGJZ0+jvFjuXJ+G4cKnOuvyTXjwEsyOqv6ELn WaZa0W9A35iOQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mPzdugJVVoVQ; Wed, 29 Mar 2023 16:29:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 694348413D; Wed, 29 Mar 2023 16:29:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 694348413D X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id CBD211BF294 for ; Wed, 29 Mar 2023 16:29:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A48FD41D3A for ; Wed, 29 Mar 2023 16:29:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A48FD41D3A X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h7x9aCOCZw4K for ; Wed, 29 Mar 2023 16:29:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EEF5C4000B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id EEF5C4000B for ; Wed, 29 Mar 2023 16:29:20 +0000 (UTC) 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) From: Jesper Dangaard Brouer To: bpf@vger.kernel.org, Stanislav Fomichev 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680107360; 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=LXyV5LA0G10WKeXhsZ3o/XxzgxMDrgvsrGlvMnnRW7qO3SrvznAJkPTtbfT9pg4ebZus4k fMR4x/2p5h1TsI846KEEb6qnG60OXp/CaEzMVqdOfBeWzx4nlTwI1LNDC13Em/P7XfeI2T N48PguBX0ujy+L3JTDsoVne0jHGDP8Q= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LXyV5LA0 Subject: [Intel-wired-lan] [PATCH bpf RFC-V2 3/5] veth: bpf_xdp_metadata_rx_hash return xdp rss hash type X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xdp-hints@xdp-project.net, martin.lau@kernel.org, daniel@iogearbox.net, larysa.zaremba@intel.com, netdev@vger.kernel.org, john.fastabend@gmail.com, ast@kernel.org, linux-kernel@vger.kernel.org, jesse.brandeburg@intel.com, kuba@kernel.org, pabeni@redhat.com, yoong.siang.song@intel.com, Jesper Dangaard Brouer , boon.leong.ong@intel.com, anthony.l.nguyen@intel.com, intel-wired-lan@lists.osuosl.org, davem@davemloft.net, edumazet@google.com, hawk@kernel.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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_md *ctx, u64 *timestamp) static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash) { 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); - return 0; + *hash = skb_get_hash(skb); + return skb->l4_hash ? XDP_RSS_TYPE_L4_ANY : XDP_RSS_TYPE_NONE; } static const struct net_device_ops veth_netdev_ops = {