From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6793DC433E6 for ; Wed, 2 Sep 2020 02:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F2882068F for ; Wed, 2 Sep 2020 02:09:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rqVZsP1z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbgIBCJk (ORCPT ); Tue, 1 Sep 2020 22:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726131AbgIBCJj (ORCPT ); Tue, 1 Sep 2020 22:09:39 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71D30C061244; Tue, 1 Sep 2020 19:09:39 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id q6so3624550ild.12; Tue, 01 Sep 2020 19:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RvQ64wf9Wh48WwQaP0R20+deCJqQguDL1Pk8BjaeB6k=; b=rqVZsP1zNJwZge4J3LP/4FGgzBO6lS/rO8tsBJDUetULTiPbGk/4n64Rx2x5JIJ8Rp 56R+bbvq3hZ6PU2P8bnZRrrhTKHek2i8ddAkYBzZTXjDtEs+V1LHGhpQVhLZr4oxwoPl 4hLuWeChldiGFPtP3ZcwHaxMIDmlhD9WXfWemEoalUqAFrfHy39JLVL+Ed6L2n82YmOb gt27PHd5kIMgoIVsEaz7rRlFYLzx5mRBFa+GsGSX9TI8rGnH2OHG3auChxEnYiMd2HKi MSDm2N5KLRq5vR//qRpIX7u7YbguY6Hoa4RXGc2xpNxaaspPknin7chzU9G9zX24+I7t SMyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RvQ64wf9Wh48WwQaP0R20+deCJqQguDL1Pk8BjaeB6k=; b=OvayyAoLRBe5NYAYsH42xNMitPKGEdSuV58fWNbgp+qExwr5dINMPuFV7cIYT9Ljbt 4C4g3bNpfts3qQimDkCQ5dupFfbQhu8+muLRRy2wJeWReSBxZAxPeUU26d+6Z5/uZKBz t96X6LceSx4UjIuiTqV3KMxrCfS2piTRE9FbqhAHgUIuuokFh0zalomRg+Xa0ked/zQo Equg8QObhY1Xz7QgbT6FCapKmtAANjuJG0kuG9+Z8S6WEdHrBE8MFin0MLYPR5OA0tGt P7BvtJwttQh9vZGQDCYYkuxmopaXiqgepSgFOBlD/dNBQxeqX8OX4DBBJT4boArwxZ0R HWsQ== X-Gm-Message-State: AOAM530Bs44QvJBa+D7czLYNh7PXDSyjjVdNdLZSfKioheffc4u1NFU4 Y4Hvaa6L/jJKfftFKIPTiQc= X-Google-Smtp-Source: ABdhPJxhDXZmvtt9rkjrKrsYRiB+nEvoM99FzH6pQ2xKBFG1M9226fII1Uu5ADK0A308ODrJldCMNA== X-Received: by 2002:a92:bad9:: with SMTP id t86mr1749383ill.308.1599012578388; Tue, 01 Sep 2020 19:09:38 -0700 (PDT) Received: from Davids-MacBook-Pro.local ([2601:282:803:7700:883e:eb9e:60a1:7cfb]) by smtp.googlemail.com with ESMTPSA id o17sm1453888ila.35.2020.09.01.19.09.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Sep 2020 19:09:37 -0700 (PDT) Subject: Re: [PATCH bpf-next] bpf: add bpf_get_xdp_hash helper function To: "Ramamurthy, Harshitha" , "bpf@vger.kernel.org" , "netdev@vger.kernel.org" , "ast@kernel.org" , "daniel@iogearbox.net" , "davem@davemloft.net" , "kuba@kernel.org" Cc: "Duyck, Alexander H" , "Herbert, Tom" References: <20200831192506.28896-1-harshitha.ramamurthy@intel.com> <04856bca-0952-4dd7-3313-a13be6b2e95a@gmail.com> From: David Ahern Message-ID: Date: Tue, 1 Sep 2020 20:09:36 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 9/1/20 6:52 PM, Ramamurthy, Harshitha wrote: >> On 8/31/20 1:25 PM, Harshitha Ramamurthy wrote: >>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index >>> a613750d5515..bffe93b526e7 100644 >>> --- a/include/uapi/linux/bpf.h >>> +++ b/include/uapi/linux/bpf.h >>> @@ -3576,6 +3576,14 @@ union bpf_attr { >>> * the data in *dst*. This is a wrapper of copy_from_user(). >>> * Return >>> * 0 on success, or a negative error in case of failure. >>> + * >>> + * u32 bpf_get_xdp_hash(struct xdp_buff *xdp_md) >> >> I thought there was a change recently making the uapi reference xdp_md; >> xdp_buff is not exported as part of the uapi. > > Not sure what you mean - other xdp related helper functions still use xdp_buff as an argument. Could you point me to an example of what you are referring to? a patch from Jakub that is apparently not committed yet. >> >>> + memset(&keys, 0, sizeof(keys)); >>> + __skb_flow_dissect(dev_net(xdp->rxq->dev), NULL, >> &flow_keys_dissector, >>> + &keys, data, eth->h_proto, sizeof(*eth), len, >>> + FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL); >> >> By STOP_AT_FLOW_LABEL I take it you want this to be an L3 hash. Why not >> add a flags argument to the helper and let the hash be L3 or L4? > > I wrote this exactly how skb_get_hash calls skb_flow_dissect - with the same flag STOP_AT_FLOW_LABEL. So it should already cover L3 and L4 hash, right? From what I understand STOP_AT_FLOW_LABEL flag is used to only stop parsing when a flow label is seen in ipv6 packets. right; missed that. That means this new helper will always do an L4 hash for tcp/udp. Adding a flags argument now for the uapi allows a later change to make it an L3 hash.