From patchwork Thu Aug 5 17:11:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12421727 X-Patchwork-Delegate: kuba@kernel.org 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 D563BC4338F for ; Thu, 5 Aug 2021 17:11:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDAED60F14 for ; Thu, 5 Aug 2021 17:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238221AbhHERLc (ORCPT ); Thu, 5 Aug 2021 13:11:32 -0400 Received: from mail-ej1-f44.google.com ([209.85.218.44]:46600 "EHLO mail-ej1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbhHERLb (ORCPT ); Thu, 5 Aug 2021 13:11:31 -0400 Received: by mail-ej1-f44.google.com with SMTP id gs8so10669941ejc.13; Thu, 05 Aug 2021 10:11:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D7+jxX/JlbsLDgJC0GgP7ELLd+nfENBJ343/im26+GM=; b=Xx+/Wn+dQDyGDn4eOM/NYetuH/jvHii2M4D6mhruGiPUA6zmqobFve36IKyfHfga9p 3h1dKJ7fgG8wwPm30VcZca1bnNJCCixE/rHDgzkxN0q+yUxaBDPC42japzPCVskawbFt p0P70+dF5uHpBq4Mp3T3OZBZvyNQHltjsZE2ThRiiKO47IhJZlrwfdigE2uR0qjq0S4S 73ln8/k2koy0DQYH8TBkDLMhNYeyvOvtgDY7oPBkvpkedFFEVfoCHhtgPNk9cZcRU1rL 0dBkmE+ZUbE8nIsBCU+MU5jPwwkgjqQOtd79HC1zdVlWViGJyNkr3U0M+NmoAnaDcZi6 Epug== X-Gm-Message-State: AOAM531UPjSeI3Hiz0u4wQuWdwmnKAAr9dptMnwmM298CDJiQEyUR74y o4AqLZyHW7neESVwk+hVb3aq5MheEb3IAA== X-Google-Smtp-Source: ABdhPJygIfEvBUqlx0/X5AzYLa/bnmtDp5d4zz7lx3m8P24V0rWS5lGo5uMBsVpMwgA+mF2pSX/rQg== X-Received: by 2002:a17:906:fb0a:: with SMTP id lz10mr5878137ejb.502.1628183475524; Thu, 05 Aug 2021 10:11:15 -0700 (PDT) Received: from msft-t490s.fritz.box (host-80-116-27-227.retail.telecomitalia.it. [80.116.27.227]) by smtp.gmail.com with ESMTPSA id n2sm2592655edi.32.2021.08.05.10.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 10:11:15 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFT net-next 1/2] stmmac: use build_skb() Date: Thu, 5 Aug 2021 19:11:00 +0200 Message-Id: <20210805171101.13776-2-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210805171101.13776-1-mcroce@linux.microsoft.com> References: <20210805171101.13776-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matteo Croce Signed-off-by: Matteo Croce --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a2aa75cb184e..30a0d915cd4b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5208,7 +5208,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) /* XDP program may expand or reduce tail */ buf1_len = xdp.data_end - xdp.data; - skb = napi_alloc_skb(&ch->rx_napi, buf1_len); + skb = build_skb(xdp.data_hard_start, PAGE_SIZE); if (!skb) { priv->dev->stats.rx_dropped++; count++; @@ -5216,11 +5216,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) } /* XDP program may adjust header */ - skb_copy_to_linear_data(skb, xdp.data, buf1_len); + skb_reserve(skb, buf->page_offset); skb_put(skb, buf1_len); - /* Data payload copied into SKB, page ready for recycle */ - page_pool_recycle_direct(rx_q->page_pool, buf->page); + page_pool_release_page(rx_q->page_pool, buf->page); buf->page = NULL; } else if (buf1_len) { dma_sync_single_for_cpu(priv->device, buf->addr, From patchwork Thu Aug 5 17:11:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12421729 X-Patchwork-Delegate: kuba@kernel.org 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 B5408C4338F for ; Thu, 5 Aug 2021 17:11:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B65361154 for ; Thu, 5 Aug 2021 17:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238493AbhHERLg (ORCPT ); Thu, 5 Aug 2021 13:11:36 -0400 Received: from mail-ed1-f53.google.com ([209.85.208.53]:44666 "EHLO mail-ed1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbhHERLg (ORCPT ); Thu, 5 Aug 2021 13:11:36 -0400 Received: by mail-ed1-f53.google.com with SMTP id z11so9380644edb.11; Thu, 05 Aug 2021 10:11:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3Zmyx7SsE2CZ1f1aWOzazG1eiYj3hoTl2IjNLvtlL+c=; b=qgnyCcg/el3xzLC+YMccrG8L9cy6IW6bD4bYqpQOhunlwwY5QOWK2HT6EmBBc6MTTU Qn+xOdqbXc/IaAhJ8JfVH2NGFyXMeAX7E2NlxJoSU37Zb2y5D6Andfi/l2rnUTHtMpDu xf6mMI4SHtDTC4wiUXGF9P88kRoOCzD3eXJeeYlDG8XdaG140yDHpjc4T0pfCrQkbaMy 4s/q33IpiSfNb6cbn7/9Lz9e+ZSzifE6eC4piW0zx56ZjU2pnNkeQRYT+hr+clUXy2/0 G6/32aPY1wIeSyGhFA4R7F6JR77nmUXejSteiJWf1KM2uX3MX5FcUC4CjcMdnjGxhF2x J57g== X-Gm-Message-State: AOAM5314wRR0s2LCL4O3YEYVKZXCyAEXqcusBkDbxpgi6YNlkGqedVPw +dkmxb7gdtroGbBJ3yJs/tKnzrPzxDMXLw== X-Google-Smtp-Source: ABdhPJzLqHFvCFevmrya4YFKb6AejF9zs+3Of0jN857PIM+ynmoddWFCAw8SdwMdoDtjp3aQ+rbMlw== X-Received: by 2002:a05:6402:13d8:: with SMTP id a24mr7911446edx.158.1628183479714; Thu, 05 Aug 2021 10:11:19 -0700 (PDT) Received: from msft-t490s.fritz.box (host-80-116-27-227.retail.telecomitalia.it. [80.116.27.227]) by smtp.gmail.com with ESMTPSA id n2sm2592655edi.32.2021.08.05.10.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 10:11:19 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFT net-next 2/2] stmmac: skb recycling Date: Thu, 5 Aug 2021 19:11:01 +0200 Message-Id: <20210805171101.13776-3-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210805171101.13776-1-mcroce@linux.microsoft.com> References: <20210805171101.13776-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matteo Croce Signed-off-by: Matteo Croce --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 30a0d915cd4b..2c48f1b5e9e9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5219,7 +5219,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) skb_reserve(skb, buf->page_offset); skb_put(skb, buf1_len); - page_pool_release_page(rx_q->page_pool, buf->page); + skb_mark_for_recycle(skb, buf->page, rx_q->page_pool); buf->page = NULL; } else if (buf1_len) { dma_sync_single_for_cpu(priv->device, buf->addr, @@ -5229,7 +5229,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) priv->dma_buf_sz); /* Data payload appended into SKB */ - page_pool_release_page(rx_q->page_pool, buf->page); + page_pool_store_mem_info(buf->page, rx_q->page_pool); buf->page = NULL; } @@ -5241,7 +5241,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) priv->dma_buf_sz); /* Data payload appended into SKB */ - page_pool_release_page(rx_q->page_pool, buf->sec_page); + page_pool_store_mem_info(buf->sec_page, rx_q->page_pool); buf->sec_page = NULL; }