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=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 9A556C433EF for ; Fri, 17 Sep 2021 19:07:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A5146124B for ; Fri, 17 Sep 2021 19:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232080AbhIQTCS (ORCPT ); Fri, 17 Sep 2021 15:02:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:52828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbhIQTCR (ORCPT ); Fri, 17 Sep 2021 15:02:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 78EB76124B; Fri, 17 Sep 2021 19:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631905255; bh=kKf4ItxdG+UjjBE1sBXkIgFyl6ZGWXdYFTvHNTsK2NI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Why6fEV2bbQ99exKBeMq9gUJgiVLjSQDClBa6/qDE8yM9ZZifuPN1zyJ+hAAAp3/V Nr0OiRxaUUj1CygUbyBW7atJ3Ut3Weg9iXDkUk7QNHKk4nVThFJ+Gq5PltO3xoIoQn PMMl3jsmemdaGIdwp3/DJUJUWEz2dwERsarZDJwaQZAlNo2Jzc20bniNTTKy+sXhD/ ayhKfFG/cVAKDWMpIsNo97UQ70wPyPuXcemeeVpoaWEYMrx3Q7+KA0Bv9qu0XBHGAO GJv9CDsYJ1+NIMkY9XOUSA2tdR/xZn8r3UxMclO7hjrJjrZO/aOMk+DefCzStXGM9h KV1HXob0RHMzA== Date: Fri, 17 Sep 2021 12:00:53 -0700 From: Jakub Kicinski To: Alexei Starovoitov Cc: Lorenzo Bianconi , bpf , Network Development , Lorenzo Bianconi , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , shayagr@amazon.com, John Fastabend , David Ahern , Jesper Dangaard Brouer , Eelco Chaudron , Jason Wang , Alexander Duyck , Saeed Mahameed , "Fijalkowski, Maciej" , "Karlsson, Magnus" , tirthendu.sarkar@intel.com, Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Subject: Re: [PATCH v14 bpf-next 00/18] mvneta: introduce XDP multi-buffer support Message-ID: <20210917120053.1ec617c2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20210916095539.4696ae27@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20210917113310.4be9b586@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, 17 Sep 2021 11:43:07 -0700 Alexei Starovoitov wrote: > > If bpf_xdp_load_bytes() / bpf_xdp_store_bytes() works for most we > > can start with that. In all honesty I don't know what the exact > > use cases for looking at data are, either. I'm primarily worried > > about exposing the kernel internals too early. > > I don't mind the xdp equivalent of skb_load_bytes, > but skb_header_pointer() idea is superior. > When we did xdp with data/data_end there was no refine_retval_range > concept in the verifier (iirc or we just missed that opportunity). > We'd need something more advanced: a pointer with valid range > refined by input argument 'len' or NULL. > The verifier doesn't have such thing yet, but it fits as a combination of > value_or_null plus refine_retval_range. > The bpf_xdp_header_pointer() and bpf_skb_header_pointer() > would probably simplify bpf programs as well. > There would be no need to deal with data/data_end. What are your thoughts on inlining? Can we inline the common case of the header being in the "head"? Otherwise data/end comparisons would be faster.