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=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 49D8EC07E96 for ; Tue, 6 Jul 2021 15:02:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E2AD61C1C for ; Tue, 6 Jul 2021 15:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231400AbhGFPFc (ORCPT ); Tue, 6 Jul 2021 11:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbhGFPFc (ORCPT ); Tue, 6 Jul 2021 11:05:32 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8408C061788; Tue, 6 Jul 2021 07:04:43 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id t3so28162311edc.7; Tue, 06 Jul 2021 07:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P2YpnvVFTcqnm3T4OIfBBmLwbYwnj6OekGoEs3hm+8A=; b=Pg7vg6d+zq8rYY/qr+eHDhCTW68T8Soz3s3tjrtXpNb1DV60YocaZhaQUk6ux+0p92 ZTaLD7IB5BGvkRyqG8rh4abSfhPIOwU5QIKetcmvk6TH4zrhrRLIMeuQ72JdsVdAtva4 hM6myJEG+5YU51IsKhEp8N/h3Vg3AGxC9waCWayc8KDBvAeCjv3IkA64YgI+RAkA3Md4 5Cp2K2YjsRtIQMc2gDrWUywbgRtEI2cGW8cnRSPNFmF8ouObi0QGPKu9ECxHaj9FOB3J UrZoYqDs3vemaJJJsROfERcK1rX4kziCwUl4Ic5HaCQJms+8KJkeFDnDHhEoF7v2OjpH VZEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P2YpnvVFTcqnm3T4OIfBBmLwbYwnj6OekGoEs3hm+8A=; b=sw2TmDmDYoh6CyLrn1Ko/PJhhkNck5bnShaCgEvMYRIR8j6pUhfUKZXivwnxdztZnN +kQzVYeJbuuca3FPmRE2XsNobVygswoNEpVyYqqBzY2Zya4Btmw9IQzJjP7pjofWFBCK ZnEqGspDfCCBFo3X9gYjwUbz45Y4Lc6wYLtWHlxnmqvk04F33FsJszeoyCYUyn2lLXey 0qS2HTse3vfXZ6mpAlxFwNa4OdLTrPgFsKVpB8e6asELnCpFxJf4v4MkGw0GaNiUqR29 GnVFZ1L27p7XleSq5s647dLxY5zjHcIF3U2363LFeA+SNDENlVl1YrYu54rQGF7XEE40 o20Q== X-Gm-Message-State: AOAM530MtQ9tVS3Be4P5hX9q7eiBy5Is0306aJjySlDoLI/Bzk5UkO2o /h96D06HTR3x/rrTC3w9Ab9VqBB91a/UQKbZvZA= X-Google-Smtp-Source: ABdhPJw8z0ZSaEn+fu6H7vuSFPmrvSZlGm3Ck8hqWZBKEnzeW15b5CXKFpd/vYCvqqjqkZSNNIZoDmv1RtM8i7kvyqA= X-Received: by 2002:aa7:d554:: with SMTP id u20mr23354485edr.50.1625580282310; Tue, 06 Jul 2021 07:04:42 -0700 (PDT) MIME-Version: 1.0 References: <1316f3ef2763ff4c02244fb726c61568c972514c.1623674025.git.lorenzo@kernel.org> In-Reply-To: From: Alexander Duyck Date: Tue, 6 Jul 2021 07:04:31 -0700 Message-ID: Subject: Re: [PATCH v9 bpf-next 02/14] xdp: introduce flags field in xdp_buff/xdp_frame To: Lorenzo Bianconi Cc: Lorenzo Bianconi , bpf , Netdev , David Miller , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , shayagr@amazon.com, "Jubran, Samih" , John Fastabend , David Ahern , Jesper Dangaard Brouer , Eelco Chaudron , Jason Wang , Saeed Mahameed , Maciej Fijalkowski , "Karlsson, Magnus" , Tirthendu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Jul 6, 2021 at 4:53 AM Lorenzo Bianconi wrote: > > > On Mon, Jul 5, 2021 at 8:52 AM Lorenzo Bianconi > > wrote: > > > > > > > On Tue, Jun 29, 2021 at 5:43 AM Lorenzo Bianconi > > > > wrote: > > [...] > > > > Hi Lorenzo, > > > > What about doing something like breaking up the type value in > > xdp_mem_info? The fact is having it as an enum doesn't get us much > > since we have a 32b type field but are only storing 4 possible values > > there currently > > > > The way I see it, scatter-gather is just another memory model > > attribute rather than being something entirely new. It makes as much > > sense to have a bit there for MEM_TYPE_PAGE_SG as it does for > > MEM_TYPE_PAGE_SHARED. I would consider either splitting the type field > > into two 16b fields. For example you might have one field that > > describes the source pool which is currently either allocated page > > (ORDER0, SHARED), page_pool (PAGE_POOL), or XSK pool (XSK_BUFF_POOL), > > and then two flags for type with there being either shared and/or > > scatter-gather. > > Hi Alex, > > I am fine reducing the xdp_mem_info size defining type field as u16 instead of > u32 but I think mb is a per-xdp_buff/xdp_frame property since at runtime we can > receive a tiny single page xdp_buff/xdp_frame and a "jumbo" xdp_buff/xdp_frame > composed by multiple pages. According to the documentation available in > include/net/xdp.h, xdp_rxq_info (where xdp_mem_info is contained for xdp_buff) > is "associated with the driver level RX-ring queues and it is information that > is specific to how the driver have configured a given RX-ring queue" so I guess > it is a little bit counterintuitive to add this info there. It isn't really all that counterintuitive. However it does put the onus on the driver to be consistent about things. So even a single-buffer xdp_buff would technically have to be a scatter-gather buff, but it would have no fragments in it. So the requirement would be to initialize the frags and data_len fields to 0 for all xdp_buff structures. > Moreover we have the "issue" for devmap in dev_map_bpf_prog_run() when we > perform XDP_REDIRECT with the approach you proposed and last we can reuse this > new flags filed for XDP hw-hints support. > What about reducing xdp_mem_info and add the flags field in xdp_buff/xdp_frame > in order to avoid increasing the xdp_buff/xdp_frame size? Am I missing > something? The problem is there isn't a mem_info field in the xdp_buff. It is in the Rx queue info structure. Thanks, - Alex