Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp701131pxb; Tue, 5 Apr 2022 19:23:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB1sNG7X99WJPibyugJyWjyG9KO0fh2qs/PiH57/+NEhJxu5YPuk4HcZRu1L1WRbPPut9I X-Received: by 2002:a65:6713:0:b0:382:3e2e:9ae9 with SMTP id u19-20020a656713000000b003823e2e9ae9mr5126332pgf.469.1649211797226; Tue, 05 Apr 2022 19:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649211797; cv=none; d=google.com; s=arc-20160816; b=oc57Zdl1xbrdk37McFP9YbrL7qq/aBvlmQnL9M9pmcdOCYbYML/IP3G4LVVFPHyEQN w8yirBwSyMKoxxVjDCQ+eFV7z5F79ya9Dtmo+a2jmEppOM/7dhfe3dpbIZmzvZuwZ+Fq 7LZzVxQxASiUgDUxVzbEN+hBepFTEfm3X/4UqnfouB3uni4ciqs/Ltd/ZV/p4Srwatn3 jSjt8ELDcXny8EPjf9nPIlqR3sfDcLm1qXAQfOCFCQxFc1PtL4vn5ME2/LPMdn7sDbOn br8zYzxtVyn5breYfmTcur038wxFFSGZkchQ11y/x8yyQd+9Dk6V5I3/x+f9Avl/ymnX sirA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zI1mwU2iCCCi2/S81VO7mfp2isuL8KrDWzDvnlLdths=; b=wcRCWcjgKedBaXKDxCEUv4fGIUM8TLx8Gd9VFz1oAUB4BBM1CfwyKLez2kBDXv3pox moGmpUhyo6st3nixsUZT5QCGtCs3hXJKGL5Bf9/ruY5CDAK8sWNQtk8I9aUZ1vx4+dgc h93uq1JTa2Aba/JrMMEzvCFno+g1vGxQK5VYKXY/LY18J2JuvTUiBkw0SjOyWisS3m/w yjTSLmQy/6vfYh1y79KFsRC5ph0MQu5ebETvoevZDVN9gEFVuacsNy4zANCGVt3AHkK4 emHeoEcdBzMHlyPnu92KFbly/xLY0OKvxSJ+qzOAdB2A3c9QMY+xeF3IWUL1l6QUnRoG wg0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGjdvf8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a656c03000000b0039961d076f8si2388010pgu.51.2022.04.05.19.23.02; Tue, 05 Apr 2022 19:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGjdvf8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238814AbiDEIo3 (ORCPT + 99 others); Tue, 5 Apr 2022 04:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbiDEIEt (ORCPT ); Tue, 5 Apr 2022 04:04:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A44535DE40; Tue, 5 Apr 2022 01:01:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 238DDB81B7F; Tue, 5 Apr 2022 08:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73FC3C34110; Tue, 5 Apr 2022 08:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145661; bh=/DkuEIkKqYZFg68mkVHbRa4zRExkRLDIv7OXgoOxsQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGjdvf8M//xzLclYoIp195chg82Qh+GIHo9O61TUYDamVaktAzIV37TDCQ/xK4gK/ ycKleI/50vL2syQly/znPBdh2LZL3dy9aLtyS15vpN5aMA0AIM/1GZKRk5LtBgD0E0 L6kXSxACf9zM2cLYvv/E7kSR1510VckaAjanJD94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Alexander Lobakin , Sandeep Penigalapati , Tony Nguyen , Sasha Levin Subject: [PATCH 5.17 0484/1126] ixgbe: pass bi->xdp to ixgbe_construct_skb_zc() directly Date: Tue, 5 Apr 2022 09:20:31 +0200 Message-Id: <20220405070421.833628189@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Lobakin [ Upstream commit 1fbdaa13386804a31eefd3db3c5fe00e80ce9bc3 ] To not dereference bi->xdp each time in ixgbe_construct_skb_zc(), pass bi->xdp as an argument instead of bi. We can also call xsk_buff_free() outside of the function as well as assign bi->xdp to NULL, which seems to make it closer to its name. Suggested-by: Maciej Fijalkowski Signed-off-by: Alexander Lobakin Tested-by: Sandeep Penigalapati Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c index 6a5e9cf6b5da..422ea6aa5831 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -207,26 +207,24 @@ bool ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 count) } static struct sk_buff *ixgbe_construct_skb_zc(struct ixgbe_ring *rx_ring, - struct ixgbe_rx_buffer *bi) + const struct xdp_buff *xdp) { - unsigned int metasize = bi->xdp->data - bi->xdp->data_meta; - unsigned int datasize = bi->xdp->data_end - bi->xdp->data; + unsigned int metasize = xdp->data - xdp->data_meta; + unsigned int datasize = xdp->data_end - xdp->data; struct sk_buff *skb; /* allocate a skb to store the frags */ skb = __napi_alloc_skb(&rx_ring->q_vector->napi, - bi->xdp->data_end - bi->xdp->data_hard_start, + xdp->data_end - xdp->data_hard_start, GFP_ATOMIC | __GFP_NOWARN); if (unlikely(!skb)) return NULL; - skb_reserve(skb, bi->xdp->data - bi->xdp->data_hard_start); - memcpy(__skb_put(skb, datasize), bi->xdp->data, datasize); + skb_reserve(skb, xdp->data - xdp->data_hard_start); + memcpy(__skb_put(skb, datasize), xdp->data, datasize); if (metasize) skb_metadata_set(skb, metasize); - xsk_buff_free(bi->xdp); - bi->xdp = NULL; return skb; } @@ -317,12 +315,15 @@ int ixgbe_clean_rx_irq_zc(struct ixgbe_q_vector *q_vector, } /* XDP_PASS path */ - skb = ixgbe_construct_skb_zc(rx_ring, bi); + skb = ixgbe_construct_skb_zc(rx_ring, bi->xdp); if (!skb) { rx_ring->rx_stats.alloc_rx_buff_failed++; break; } + xsk_buff_free(bi->xdp); + bi->xdp = NULL; + cleaned_count++; ixgbe_inc_ntc(rx_ring); -- 2.34.1