From patchwork Fri Sep 13 11:02:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13803288 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21DBFFA3743 for ; Fri, 13 Sep 2024 11:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=kekk9n1SKeIq8mwQfBadmC6X0rQ17ZPly6vPtHna6So=; b=OocFmkEbk3aKZR+j8Brlp1pTzF inc3GAh3rH8/P5MJYXDliAe+Wz4+yWuE8QUc4d/9wbKBixqPviuBiIU2w7fF88Sp7IKSx7IFc6O+o sdQo/tYiv3HNKVhS1tAF9G2+pdmJYddN7tJHUZOFxANBX36DIXB9HS7dS4kF3TYoVrtPvu+6q3Yx8 5EaDA7xoaQ7w+P58s8LLB5bfdOxykfYSEiEHQfrxFSqxhXjlOqOGAAmjnwQJZNT6+XtO0j2EDUzu0 Fv5RNv52uTr86hd82quyZJvfDX3Ysz4vylk59C0RxXxj+TMOYo9ah8ufOXaJXBsBjdfWuwv2Zcd3Y K3TzBqVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp46V-0000000FhFS-3cuR; Fri, 13 Sep 2024 11:04:43 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp45R-0000000Fh9P-207a for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2024 11:03:39 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-718a3b8a2dcso625989b3a.2 for ; Fri, 13 Sep 2024 04:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726225416; x=1726830216; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kekk9n1SKeIq8mwQfBadmC6X0rQ17ZPly6vPtHna6So=; b=K9AJmp6jLsr2eWZJp9uBG6GTwRghTp8xxacVvzl+rtNi7scEVenHROj7skyJXrkw4l Bp1FeiEflhelmC8qjP3y8RJQ36ISKaT3GA6jR6ercqyMfRotRjbS+7FxcRMDcTZRIorW JNQ3vDOch7rCg2iPdfWExDKwlZSqQ275TpX35RQ/ZSMmpcnSHHkto/eXh4dazwpnHpJO VAJPsSs4JXyEIF6ga/1RJ+KX9YmFsV2OR0eO8myOWSJd/uQlF7ZChWIuv6FnS19dhVRk ZZhg7ThofK0G2eyvg/62ZpxyCW/09E7+eDSatTc2Wn8vKzAzxGukPMMCKMA3MuUVLxt5 fykg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726225416; x=1726830216; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kekk9n1SKeIq8mwQfBadmC6X0rQ17ZPly6vPtHna6So=; b=PBAIQBFISMsSePNxCcwwAp2BQTCqZFR+Q2KaLkX8xJ+LumAsTMs697pTfRyDXPPNn+ qKCnAYIo1viXcgGUTOTJNGZVRrhvQVhy3dIQFIk76WohWbillkkDZHtskLnAdi/mdKaU voO+W063dtUn0hXMffNHLEsUX14s7GlujuPy49qk6lqYq23wH7CFH/v141CSrUXbAISh L0xe+yfuCR1cfJR9qq2QOtJPWwAUB1RwvAyJXXYFWFUe6/E+g41uy6BtLWDkmBFTd4c6 NS3QnsFfY2Wbv1xswGRvREZSyyy+t4vVYwH79Yg547O/6FW4UkxnNujn6ocFrZwY207c tWiA== X-Forwarded-Encrypted: i=1; AJvYcCW9p9JZ1XfWu0fMdNtpD2Gtkb/y1lX6Ftn/EuaRiFGOitME3VafZ/hYJnTiT/0XJZ3d5qzGXfmiDaNUpXE6RMNK@lists.infradead.org X-Gm-Message-State: AOJu0YzSKsWZ/M5B+pjIxO2Yar296TLAXql9OzWVugWfIhSoI6Z3gPL6 tciWF5uEKONc+m0eomHzgJwk5kyTgtgVm9Y5Wbw1Mw7IGVRDXjYl X-Google-Smtp-Source: AGHT+IGwEoyrvESSqovr/1cjtEp4lX2jChUMznGaRwX1hjVp0qpnhQ9RUdRvLc6shj18XvoBOrPGEg== X-Received: by 2002:a05:6a00:23c3:b0:718:ea3c:35c3 with SMTP id d2e1a72fcca58-71936a5e2d6mr3704608b3a.15.1726225415732; Fri, 13 Sep 2024 04:03:35 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-71909092560sm5882778b3a.138.2024.09.13.04.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 04:03:35 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Ong Boon Leong , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rmk+kernel@armlinux.org.uk, linux@armlinux.org.uk, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net v1] net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled Date: Fri, 13 Sep 2024 19:02:59 +0800 Message-Id: <20240913110259.1220314-1-0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240913_040337_554377_C9B6461A X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When XDP is not enabled, the page which holds the received buffer will be recycled once the buffer is copied into SKB by skb_copy_to_linear_data(), then the MAC core will never reuse this page any longer. Set PP_FLAG_DMA_SYNC_DEV wastes CPU cycles. This patch brings up to 9% noticeable performance improvement on certain platforms. Fixes: 5fabb01207a2 ("net: stmmac: Add initial XDP support") Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f3a1b179aaea..95d3d1081727 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2022,7 +2022,7 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv, rx_q->queue_index = queue; rx_q->priv_data = priv; - pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; + pp_params.flags = PP_FLAG_DMA_MAP | (xdp_prog ? PP_FLAG_DMA_SYNC_DEV : 0); pp_params.pool_size = dma_conf->dma_rx_size; num_pages = DIV_ROUND_UP(dma_conf->dma_buf_sz, PAGE_SIZE); pp_params.order = ilog2(num_pages);