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=-12.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 DCD1CC433EF for ; Mon, 20 Sep 2021 08:45:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C640F610CE for ; Mon, 20 Sep 2021 08:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235970AbhITIrO (ORCPT ); Mon, 20 Sep 2021 04:47:14 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:41607 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbhITIrK (ORCPT ); Mon, 20 Sep 2021 04:47:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1632127545; x=1663663545; h=references:from:to:cc:in-reply-to:date:message-id: mime-version:subject; bh=Plc447rOnwLbbiZzTvbrt3Upf5NEGhNTpdAwDVBvNqI=; b=Y+UnzZ+MMLTz5oZT8UibggrSJzmp7bWvCTo9x2g1lfUG9kz6UD/+1z/g fgQodGjtOR++G125vLPatt2msHc/MmkEXdEsX3PtP3/87673OJKF2wSVw ru7p5vCBmuwK4fGSOoC2a8v24obSNTKaw7UnofO4NU1cAA+73TXvlOIRd o=; X-IronPort-AV: E=Sophos;i="5.85,307,1624320000"; d="scan'208";a="148762280" Subject: Re: [PATCH v14 bpf-next 03/18] net: mvneta: update mb bit before passing the xdp buffer to eBPF layer Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1e-42f764a0.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-33001.sea14.amazon.com with ESMTP; 20 Sep 2021 08:45:36 +0000 Received: from EX13D28EUC001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1e-42f764a0.us-east-1.amazon.com (Postfix) with ESMTPS id 6029DC01A2; Mon, 20 Sep 2021 08:45:34 +0000 (UTC) Received: from u570694869fb251.ant.amazon.com.amazon.com (10.43.161.43) by EX13D28EUC001.ant.amazon.com (10.43.164.4) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 20 Sep 2021 08:45:25 +0000 References: User-agent: mu4e 1.4.15; emacs 28.0.50 From: Shay Agroskin To: Lorenzo Bianconi CC: Lorenzo Bianconi , , , , , , , , , , , , , , , , , In-Reply-To: Date: Mon, 20 Sep 2021 11:45:20 +0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Originating-IP: [10.43.161.43] X-ClientProxiedBy: EX13D13UWA001.ant.amazon.com (10.43.160.136) To EX13D28EUC001.ant.amazon.com (10.43.164.4) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Lorenzo Bianconi writes: >> >> Lorenzo Bianconi writes: >> >> > ... >> > diff --git a/drivers/net/ethernet/marvell/mvneta.c >> > b/drivers/net/ethernet/marvell/mvneta.c >> > index 9d460a270601..0c7b84ca6efc 100644 >> > --- a/drivers/net/ethernet/marvell/mvneta.c >> > +++ b/drivers/net/ethernet/marvell/mvneta.c >> > ... >> > @@ -2320,8 +2325,12 @@ mvneta_swbm_build_skb(struct >> > mvneta_port *pp, >> > struct page_pool *pool, >> > struct xdp_buff *xdp, u32 desc_status) >> > { >> > struct skb_shared_info *sinfo = >> > xdp_get_shared_info_from_buff(xdp); >> > - int i, num_frags = sinfo->nr_frags; >> > struct sk_buff *skb; >> > + u8 num_frags; >> > + int i; >> > + >> > + if (unlikely(xdp_buff_is_mb(xdp))) >> > + num_frags = sinfo->nr_frags; >> >> Hi, >> nit, it seems that the num_frags assignment can be moved after >> the other >> 'if' condition you added (right before the 'for' for >> num_frags), or even be >> eliminated completely so that sinfo->nr_frags is used directly. >> Either way it looks like you can remove one 'if'. >> >> Shay > > Hi Shay, > > we can't move nr_frags assignement after build_skb() since this > field will be > overwritten by that call. > > Regards, > Lorenzo > Sorry, silly mistake of me. Guess this assignment can be done anyway since there doesn't seem to be new cache misses introduced by it. Anyway, nice catch, sorry for misleading you >> >> > skb = build_skb(xdp->data_hard_start, PAGE_SIZE); >> > if (!skb) >> > @@ -2333,6 +2342,9 @@ mvneta_swbm_build_skb(struct >> > mvneta_port *pp, >> > struct page_pool *pool, >> > skb_put(skb, xdp->data_end - xdp->data); >> > skb->ip_summed = mvneta_rx_csum(pp, desc_status); >> > + if (likely(!xdp_buff_is_mb(xdp))) >> > + goto out; >> > + >> > for (i = 0; i < num_frags; i++) { >> > skb_frag_t *frag = &sinfo->frags[i]; >> > @@ -2341,6 +2353,7 @@ mvneta_swbm_build_skb(struct >> > mvneta_port *pp, >> > struct page_pool *pool, >> > skb_frag_size(frag), PAGE_SIZE); >> > } >> > +out: >> > return skb; >> > } >>