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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 4AE14C2BBCD for ; Sun, 20 Dec 2020 17:57:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EDEB22C9E for ; Sun, 20 Dec 2020 17:57:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbgLTR5l (ORCPT ); Sun, 20 Dec 2020 12:57:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33133 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726772AbgLTR5l (ORCPT ); Sun, 20 Dec 2020 12:57:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608486974; 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: in-reply-to:in-reply-to:references:references; bh=LCmK0g+hEJlNqpZfmeNoL1Zzda9xUQE2Tu/lOz3fGGU=; b=QyQ8/zZKvrHsLyssSG8A10MaJk/0FfLXkZbKhep1vHJk0o3VTBKauMGlCim1AsssRYfu2O jKO/Npg8s3gozphH266lBJhDcRn/cTZfyH1/q9kOglEKhux+T2rrWmoGUqLgIKHZYwIVht ijRVqz/ymzM7KfUSsJ0kLliC/cRyraE= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-_RxCL4mcM6GKukLiirC3CQ-1; Sun, 20 Dec 2020 12:56:12 -0500 X-MC-Unique: _RxCL4mcM6GKukLiirC3CQ-1 Received: by mail-yb1-f198.google.com with SMTP id z62so11287947yba.23 for ; Sun, 20 Dec 2020 09:56:12 -0800 (PST) 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=LCmK0g+hEJlNqpZfmeNoL1Zzda9xUQE2Tu/lOz3fGGU=; b=tg9ykbdsMcMMUmhh0X7R86cOXO1Q9bb3IcU0hUx+aHlWeDC/r+DQLFV+S6OgsjDaKQ b4t3dlRprxO9Abd0u825nl7F0lZrRaeULaikJiYXSMJqUWMha1FDL811KYwDQtBXFFnK 4olIwYxYfhd2pEgwrWKJt8SJhgM3ZUf+I/EBrymlQ4xTZBtX7PkuSZjoPfp+b+tW873C tYoJVsX7sP7Ur/+Su07PUSB0EM8OKM7qFrEomkIyvGhCWiBfGMbz5jkmxn7JvyBzBMQL rU+/cgKfR2P0/yq4SNdqlgLAXk7j4dU0V4CnrjRq9+hTLsSMiSFxpZOxYaR/y2MGnfmf AKvw== X-Gm-Message-State: AOAM532uGbrWPaBbqopxqVYSs3uheW1wrTv/WRzEf+sJIlg+Z4WhKYH9 0HaKcJvBBIYlmIxMAX3ZGBjEOjVN7jpV0h/IzvD4J7wQbjZ6sSi/eterX0VUJu/tIIpxoWP8ogb vq3A0/I6qbsQWciaDYNnfyhe7GwRgTU+b X-Received: by 2002:a25:76d2:: with SMTP id r201mr17876127ybc.107.1608486972281; Sun, 20 Dec 2020 09:56:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZAO2PtXbI9hLd0CBlv4eoDVGdGIgeRyNO9tRffiFJDk0lLl8dYVpQa8K4XuNWY/1wHNmpW13bJ3I1+9jMxaE= X-Received: by 2002:a25:76d2:: with SMTP id r201mr17876115ybc.107.1608486972108; Sun, 20 Dec 2020 09:56:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Lorenzo Bianconi Date: Sun, 20 Dec 2020 18:56:07 +0100 Message-ID: Subject: Re: [PATCH v5 bpf-next 11/14] bpf: cpumap: introduce xdp multi-buff support To: Shay Agroskin Cc: Lorenzo Bianconi , BPF-dev-list , Network Development , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , "Jubran, Samih" , John Fastabend , David Ahern , Jesper Brouer , Eelco Chaudron , Jason Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > > Lorenzo Bianconi writes: > > > Introduce __xdp_build_skb_from_frame and > > xdp_build_skb_from_frame > > utility routines to build the skb from xdp_frame. > > Add xdp multi-buff support to cpumap > > > > Signed-off-by: Lorenzo Bianconi > > --- > > include/net/xdp.h | 5 ++++ > > kernel/bpf/cpumap.c | 45 +--------------------------- > > net/core/xdp.c | 73 > > +++++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 79 insertions(+), 44 deletions(-) > > > [...] > > diff --git a/net/core/xdp.c b/net/core/xdp.c > > index 6c8e743ad03a..55f3e9c69427 100644 > > --- a/net/core/xdp.c > > +++ b/net/core/xdp.c > > @@ -597,3 +597,76 @@ void xdp_warn(const char *msg, const char > > *func, const int line) > > WARN(1, "XDP_WARN: %s(line:%d): %s\n", func, line, msg); > > }; > > EXPORT_SYMBOL_GPL(xdp_warn); > > + > > +struct sk_buff *__xdp_build_skb_from_frame(struct xdp_frame > > *xdpf, > > + struct sk_buff *skb, > > + struct net_device *dev) > > +{ > > + unsigned int headroom = sizeof(*xdpf) + xdpf->headroom; > > + void *hard_start = xdpf->data - headroom; > > + skb_frag_t frag_list[MAX_SKB_FRAGS]; > > + struct xdp_shared_info *xdp_sinfo; > > + int i, num_frags = 0; > > + > > + xdp_sinfo = xdp_get_shared_info_from_frame(xdpf); > > + if (unlikely(xdpf->mb)) { > > + num_frags = xdp_sinfo->nr_frags; > > + memcpy(frag_list, xdp_sinfo->frags, > > + sizeof(skb_frag_t) * num_frags); > > + } > > nit, can you please move the xdp_sinfo assignment inside this 'if' > ? This would help to emphasize that regarding xdp_frame tailroom > as xdp_shared_info struct (rather than skb_shared_info) is correct > only when the mb bit is set > > thanks, > Shay ack, will do in v6. Regards, Lorenzo > > > + > > + skb = build_skb_around(skb, hard_start, xdpf->frame_sz); > > + if (unlikely(!skb)) > > + return NULL; > [...] >