Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp796696rwl; Wed, 12 Apr 2023 04:23:32 -0700 (PDT) X-Google-Smtp-Source: AKy350ZuexVQ1j636s54OrJV05/KRHRD81JHk1KSK5gFYQD/RxwbOSvi3Md2NAdosNrLvq8+MAfR X-Received: by 2002:a17:906:f2c2:b0:93e:fa12:aa1a with SMTP id gz2-20020a170906f2c200b0093efa12aa1amr5455845ejb.1.1681298612233; Wed, 12 Apr 2023 04:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681298612; cv=none; d=google.com; s=arc-20160816; b=vuaHav/FwWxWDWo90Y+RqzX6LLFgA9j5U9tV8topsjAiwHAAP0zVlhsyVRXILSOiDD hrtfipthy1HiNK5NLMHBsn0k/hXJa3ogpVQ32H46JMvDNG0JRT0fkjDC+TUzneZg8FUP 9+kY+RZiYyfzqtwL5ZYyA/iEHYmHMVLD2aJWSHNARqKxLTxkN7p4cLe+Xz3knsic2NU1 UVBObgAElUXYmZV1mQ/viQiIh32fPffrep+UAXVrmUFpISDtxkvE8dt71Xh5XGkCXB2B 8Xze0AdKI0/kkvk5ks0B4/YpuidF2ySLED+VeCNL3SF+Xtr37v+OgWkf1PBJQuo88NzB vgcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :to:content-language:subject:cc:user-agent:mime-version:date :message-id:from:dkim-signature; bh=ehvr1d/jbxZ+YWSEUG0+v0Njo7GXylIVh8YAQAeYlBM=; b=XOjD2+kaUEHGM5Fhi0dd1I2Uv6oGnliBNcEhjemWhUu3zxAmT0/NJ3tXQvXNjcaih2 66K/1TAwqGe7WJDiaqM/Z3rH1zpwMO3LXdMfxT0lbaqx4bohLwOyU9OrPC3jcdcYB9MP zQnq5ZSlEcU5L0KIc7NPsNFyTeWWUJ1vckfE0U4Cb+4s/eAfGC9Ec25CXQd1RF68lYWr 8/42wJfJ/OGi/olbyx/DDQ1roH+/QOwdgBNNglruiiWvAlcUXF/YsFmka6KfxlyVpP0C 8zGlCrtl75xYZYKRSCax2c8PlyHLHqVE9kEL31opcExb5PVUgPaLJlS/v318m/BzCiqB AAfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AlLChYMS; 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 c23-20020a1709060fd700b009497c0571b4si12648691ejk.26.2023.04.12.04.23.07; Wed, 12 Apr 2023 04:23:32 -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=AlLChYMS; 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 S230151AbjDLLWJ (ORCPT + 99 others); Wed, 12 Apr 2023 07:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbjDLLWH (ORCPT ); Wed, 12 Apr 2023 07:22:07 -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 D060C7D82 for ; Wed, 12 Apr 2023 04:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681298406; 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=ehvr1d/jbxZ+YWSEUG0+v0Njo7GXylIVh8YAQAeYlBM=; b=AlLChYMSJjMHTD9sp43Vk1IMnFxJDr9TU09hXfN+KEBc1en82CQnQ0RHmAYSdC9FoagClP tYneBK/BN3AwhYtvnfKHdR01hUVIs9AmNlfyIz0rZBeMiv/FkADhyz3qSp9fC22gMPqeCs qNUUI15gK3+7uZJO1IuBuCwFc5Fpl/Y= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-255--f40Fw0OOHCursHT0QfhNg-1; Wed, 12 Apr 2023 07:16:56 -0400 X-MC-Unique: -f40Fw0OOHCursHT0QfhNg-1 Received: by mail-ed1-f70.google.com with SMTP id y95-20020a50bb68000000b004fd23c238beso6329272ede.0 for ; Wed, 12 Apr 2023 04:16:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681298216; x=1683890216; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ehvr1d/jbxZ+YWSEUG0+v0Njo7GXylIVh8YAQAeYlBM=; b=ObH0aJBMYUeiUUBqT3UUa3yAQYHVkre8aQ2b/SmCpkUGPrEa8deY8UngeesgfFpgAI NOz3KcNHMk2m46t1csxIscX8LVOODEJsCySYbLYq2wY0Fgda1WjadaNVk1m7dCny2AMB CmVyPKsflPsPlhoA/PsT5IZLprt90fcTgbl3bG7SLrhNdirBRpy/SlWAqKThjE/NZArx vxIYsw+1kYYHoMALBS8VtatJWNfag51AloNyJJYcdihbTM+L69dlAJqq1UimB3mylK+P SYeZBBmE1ffGmohBrWb582YQyygqHbpjh0OB8llLt5cSvnumEuIqUiHYIo66DEROjn+s Rcjg== X-Gm-Message-State: AAQBX9fd+mWvB66FIgqzBcsDOt76jOTOY8PQBim9QfXhyacJqx9CDwEN qy8Pqn572T6SOXkBo+/NINnujDdSzX4VOmmz34samPEeDhz/2arNgDu8+O3EF5Q7Het0Sy3QzxL 7Mv9VxJcc3p8wTaeGqY2guAQp X-Received: by 2002:a17:906:fae0:b0:931:624b:680c with SMTP id lu32-20020a170906fae000b00931624b680cmr5523416ejb.29.1681298215782; Wed, 12 Apr 2023 04:16:55 -0700 (PDT) X-Received: by 2002:a17:906:fae0:b0:931:624b:680c with SMTP id lu32-20020a170906fae000b00931624b680cmr5523398ejb.29.1681298215440; Wed, 12 Apr 2023 04:16:55 -0700 (PDT) Received: from [192.168.42.222] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id hz16-20020a1709072cf000b0094e09ceafc9sm1978330ejc.44.2023.04.12.04.16.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Apr 2023 04:16:54 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <474201b2-d98c-f3ab-aed9-b008bb188d0b@redhat.com> Date: Wed, 12 Apr 2023 13:16:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cc: brouer@redhat.com, bpf@vger.kernel.org, Stanislav Fomichev , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vu?= =?UTF-8?Q?sen?= , 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 Subject: Re: [PATCH bpf V7 3/7] xdp: rss hash types representation Content-Language: en-US To: Simon Horman References: <168098183268.96582.7852359418481981062.stgit@firesoul> <168098189148.96582.2939096178283411428.stgit@firesoul> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 On 10/04/2023 17.04, Simon Horman wrote: > On Sat, Apr 08, 2023 at 09:24:51PM +0200, Jesper Dangaard Brouer wrote: >> The RSS hash type specifies what portion of packet data NIC hardware used >> when calculating RSS hash value. The RSS types are focused on Internet >> traffic protocols at OSI layers L3 and L4. L2 (e.g. ARP) often get hash >> value zero and no RSS type. For L3 focused on IPv4 vs. IPv6, and L4 >> primarily TCP vs UDP, but some hardware supports SCTP. >> >> Hardware RSS types are differently encoded for each hardware NIC. Most >> hardware represent RSS hash type as a number. Determining L3 vs L4 often >> requires a mapping table as there often isn't a pattern or sorting >> according to ISO layer. >> >> The patch introduce a XDP RSS hash type (enum xdp_rss_hash_type) that >> contain combinations to be used by drivers, which gets build up with bits >> from enum xdp_rss_type_bits. Both enum xdp_rss_type_bits and >> xdp_rss_hash_type get exposed to BPF via BTF, and it is up to the >> BPF-programmer to match using these defines. >> >> This proposal change the kfunc API bpf_xdp_metadata_rx_hash() adding >> a pointer value argument for provide the RSS hash type. >> >> Change function signature for all xmo_rx_hash calls in drivers to make it >> compile. The RSS type implementations for each driver comes as separate >> patches. >> >> Fixes: 3d76a4d3d4e5 ("bpf: XDP metadata RX kfuncs") >> 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 | 3 + >> drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 + >> drivers/net/veth.c | 3 + >> include/linux/netdevice.h | 3 + >> include/net/xdp.h | 45 ++++++++++++++++++++++ >> net/core/xdp.c | 10 ++++- >> 6 files changed, 62 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c >> index 4b5e459b6d49..73d10aa4c503 100644 >> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c >> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c >> @@ -681,7 +681,8 @@ int mlx4_en_xdp_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp) >> return 0; >> } >> >> -int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash) >> +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; >> > > Hi Jesper, > > I think you also need to update the declaration of mlx4_en_xdp_rx_hash() > in mlx4_en.h. > Thanks a lot for spotting this. fixed in V8. --Jesper