Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp613017pxb; Tue, 5 Apr 2022 15:59:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwButTJVIwr/6EN3N7PZoGFk77HMdRQmWAhWRfV5GhGlb02IuEhwgj+kMGqWlNgMICrH8Qu X-Received: by 2002:a05:6a00:190a:b0:4fa:e4e9:7126 with SMTP id y10-20020a056a00190a00b004fae4e97126mr5888599pfi.65.1649199557755; Tue, 05 Apr 2022 15:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649199557; cv=none; d=google.com; s=arc-20160816; b=sUIo3e8B04OBvR68TGvSka15r0sZpL9yE/9GR7guC6Zlm4XfwvdzvRIgarg7maXj2q NYp50ddF1LKpovE0SHmNOhK4zJpBnoKolXQdmh+eXQ+IzWkefRO1wIwUimgnBinyH6ni +z2C/4wQMRSa2fIJbbzTlkxLhSw3i12ykixYbK5W8IjCyQ8aHSkaa7uBUUuVuNLLVO4a cReEYkl46bUR33AFLT3CkP06SHIl/+5vDuh2+S097cX32RZBqO7vsGTbDzbrbV36Y9LX /7JgFGP/wzw49xv0LteFmM85+poym6FF/xeje5a8MATyfw09hmTg/78qH9L/G2jvyw6T sylQ== 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=NDBb9Kcpy8XZ6DJLswk/hiArAB/iJ+rTQezyByfErxs=; b=HkuJFIPH2Lk95m/FEqJZp0yI9ULoKjorlIXUYwrem7KKRIXiMSqoZdgODlPElKEDgJ bHXfam95OMa6ncT97PAc1woyRi6jvawjBXuyzZwXetSiXkXlrEPxfcfDV4y8jAKgNIKa KlosXe3YZ7jlCGEUMoKGAxSq+okNI7/NXQe7JKTZsOxglShjZjjIbx40jmZSTVojXo82 MwPWxXwwxaMS4ByyVkQDw1+jG/btLBQ728Htx8/D8TibXLwJinED/efc1zACO7x9xPyO PzBp4IqtYLiH7IErO6r5N7tk0l+XqhNCWHyiaNii7Q7I2XFBknhI8bHylM6lHpsgEKSP LZIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KgXfDnY+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m1-20020a6545c1000000b0038234dbb532si14545348pgr.378.2022.04.05.15.59.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:59:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KgXfDnY+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8D6113E0B; Tue, 5 Apr 2022 15:40:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383453AbiDEMZu (ORCPT + 99 others); Tue, 5 Apr 2022 08:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232014AbiDEIxS (ORCPT ); Tue, 5 Apr 2022 04:53:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FF6E20E; Tue, 5 Apr 2022 01:51:19 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 68286614FD; Tue, 5 Apr 2022 08:51:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77F98C385A1; Tue, 5 Apr 2022 08:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148678; bh=yhUfmQ7iuLGgVfcfW/WD7nfKw5/vrSQEykgxUa0+gLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgXfDnY+MDftnqQAS+ppKVmZowN4P17SNnMMY1Ex6IXzqRXJyFqglscv7BN2pNgyE Glbe5/9sWrTpY5FuyAW5Dbz9d5TfSIeC9A0x2oQZoPT3RFd/vAqTKnDy1KrvKFMtIo YFhnGiLgiq2eknigNVKsauWFbKYyOYCrEdPuyIpQ= 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.16 0443/1017] ixgbe: pass bi->xdp to ixgbe_construct_skb_zc() directly Date: Tue, 5 Apr 2022 09:22:36 +0200 Message-Id: <20220405070407.445948031@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 666ff2c07ab9..ab96d7ce1aa0 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