From patchwork Mon Sep 30 12:33:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13816470 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 A59D6CE8343 for ; Mon, 30 Sep 2024 13:44: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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Jp9HBVqhY6dvREuID819AYIzD472pXkGDZsYYpNo37s=; b=UL6iRAVMADV5sEFz8SGXhJcKUo XV0UkX5kgOgg13UZ7K/E0HFiVl1qE0kvKCBp8dFDkkqFiCqUFPG0XgCVry1q8Qsnx8k49Qnsu4EFs /vrRjlYntK2hltFam4Hw4uExSFTUeJiqtRoziNokm23o8Wo7/nkf86cRis9jUDSRFLSMIF0DdzHpn XogJ/mSmhIQVOonZ4NSZAb7pDSjskVU+Cv8LDEpBkGYJrXeR2b7j608iFpKoKPC6oTXBWqxUUsBPM H9WJhFmLO0Qs9vGGUrlUTepSr9PrSKgZdMZ+oC2YPW4bZFuWl32PQMGMlCmgIhMdhvLAGr5prqOEL ixCLnSdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svGhj-0000000HMGf-054J; Mon, 30 Sep 2024 13:44:47 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svFbY-0000000H4Gs-41Rb; Mon, 30 Sep 2024 12:34:23 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 480CA5C4673; Mon, 30 Sep 2024 12:34:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC11FC4CEC7; Mon, 30 Sep 2024 12:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727699660; bh=Z/4YAYam6JnULP3t1IK5jI6tEWcPLOHTYHfr4Vko5D8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GyfpVD7ieTL/0P/lAUCh6H8l6dIZfCYFefix1Vw/fkB2v0GkvRdaVpYMY4MZA6/EM 7zf9P8nTL9cqZfdea7b2zecl9v2q3x/WykpCJYyJYwkSn2C4ZTKlG5QiPBjIN9bBA/ 3YJrGFvfI5PV+LH9egc0Lhsk4jwiBnRma+jUAVff/kUz9+nkq9BFMXvxNedAup2pGE TYpquaOyALB6lgtTrP4PGgZc4aySyz+UWcLtZnRgM+OkmDCiKGfBnqXzyWgdMHU3RP gxB2gRgXH19loPhp3QvRPBKMyixV5XraWQR/LpOACGNJbMRhb/K+lb24XOcaimHYzZ XaKmVpCJmGPiw== From: Lorenzo Bianconi Date: Mon, 30 Sep 2024 14:33:48 +0200 Subject: [PATCH net-next 1/2] net: airoha: read default PSE reserved pages value before updating MIME-Version: 1.0 Message-Id: <20240930-airoha-eth-pse-fix-v1-1-f41f2f35abb9@kernel.org> References: <20240930-airoha-eth-pse-fix-v1-0-f41f2f35abb9@kernel.org> In-Reply-To: <20240930-airoha-eth-pse-fix-v1-0-f41f2f35abb9@kernel.org> To: Lorenzo Bianconi , Felix Fietkau , Sean Wang , Mark Lee , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Simon Horman , upstream@airoha.com X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240930_053421_170453_DFB4B372 X-CRM114-Status: GOOD ( 10.15 ) 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 Store the default value for the number of PSE reserved pages in orig_val at the beginning of airoha_fe_set_pse_oq_rsv routine, before updating it with airoha_fe_set_pse_queue_rsv_pages(). Introduce airoha_fe_get_pse_all_rsv utility routine. commit 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") Signed-off-by: Lorenzo Bianconi Signed-off-by: ... --- drivers/net/ethernet/mediatek/airoha_eth.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c index 930f180688e5..480540526bdb 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c @@ -1116,17 +1116,23 @@ static void airoha_fe_set_pse_queue_rsv_pages(struct airoha_eth *eth, PSE_CFG_WR_EN_MASK | PSE_CFG_OQRSV_SEL_MASK); } +static u32 airoha_fe_get_pse_all_rsv(struct airoha_eth *eth) +{ + u32 val = airoha_fe_rr(eth, REG_FE_PSE_BUF_SET); + + return FIELD_GET(PSE_ALLRSV_MASK, val); +} + static int airoha_fe_set_pse_oq_rsv(struct airoha_eth *eth, u32 port, u32 queue, u32 val) { - u32 orig_val, tmp, all_rsv, fq_limit; + u32 orig_val = airoha_fe_get_pse_queue_rsv_pages(eth, port, queue); + u32 tmp, all_rsv, fq_limit; airoha_fe_set_pse_queue_rsv_pages(eth, port, queue, val); /* modify all rsv */ - orig_val = airoha_fe_get_pse_queue_rsv_pages(eth, port, queue); - tmp = airoha_fe_rr(eth, REG_FE_PSE_BUF_SET); - all_rsv = FIELD_GET(PSE_ALLRSV_MASK, tmp); + all_rsv = airoha_fe_get_pse_all_rsv(eth); all_rsv += (val - orig_val); airoha_fe_rmw(eth, REG_FE_PSE_BUF_SET, PSE_ALLRSV_MASK, FIELD_PREP(PSE_ALLRSV_MASK, all_rsv)); From patchwork Mon Sep 30 12:33:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13816391 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 601CECE8342 for ; Mon, 30 Sep 2024 13:15:52 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0Echq6iYdi8xXOiwQNXOIod/aTn7Fh4/OT5C9qG6Rag=; b=VCy0yCxrnfv7hvEOg5+HkpJcL4 qNZXP2OqDEXvoIqOagiecBKEOmJAeb2UK5te/YjK2/G2UG2OBxg0fT2fe+ldBfhLxzmKsT+MFwqoU OgLF+atN3m4MShmsEgEjf5rQhRivI1i4tTodwDEWfEys1mF+a5Ept+hc2qCzehPVRBv+RZMKZcW1i 7nAsZo/+EN4N55UpPJ3DiZ/LVrHsnnNDu2wYjZyiEIsj3uKF19wlcrLGU8vomsYGvLjUWEw3Wx5CQ xGFA4UpTV4bcNqiA+Mw/vD+4BXQj2vFmj9gpB8vk9Ro74dnDR3B4DVL+wOH/Qi0nySAmXiN1vGsBz ralZXwcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svGFZ-0000000HFVr-20Ju; Mon, 30 Sep 2024 13:15:41 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svFbb-0000000H4IK-2NYE; Mon, 30 Sep 2024 12:34:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 058F35C1191; Mon, 30 Sep 2024 12:34:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41ECDC4CEC7; Mon, 30 Sep 2024 12:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727699662; bh=qTB9g6Mdenjq1zRKKss5v3af9DwJHerHGR2vXvjGRHs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FY50tftipJWwI6IGb+PAARkL12B7fochTa2vApQ4msqXoVsKecvwGWQj7sf9jDe15 SWZFf7SRc0ySXu4332vsKX9Cu1+jG4J+M8u5m0iCnba/J/ax2jPzsTegKVi2sB/nRd qZDcRtAO1TXh2/TWFkhI71zilIdqJYKwy3Lcwq5Gja/T2PKoHsj28k/qdk+al6OLoh Qw9Gfc+exWLprRRLeegDzqUD1lHJEvvlMeIKV1i9/S1ijiCHKsnixQnk8OX198xEt+ FOhfB7uyMRuYR5+SIfW6CqtQBEnbj9jSlE+TcFzz7UHIjTRt6rQwaSaYTlTJIsgFzF rIZWku+q33AkA== From: Lorenzo Bianconi Date: Mon, 30 Sep 2024 14:33:49 +0200 Subject: [PATCH net-next 2/2] net: airoha: fix PSE memory configuration in airoha_fe_pse_ports_init() MIME-Version: 1.0 Message-Id: <20240930-airoha-eth-pse-fix-v1-2-f41f2f35abb9@kernel.org> References: <20240930-airoha-eth-pse-fix-v1-0-f41f2f35abb9@kernel.org> In-Reply-To: <20240930-airoha-eth-pse-fix-v1-0-f41f2f35abb9@kernel.org> To: Lorenzo Bianconi , Felix Fietkau , Sean Wang , Mark Lee , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Simon Horman , upstream@airoha.com X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240930_053423_732162_C0FDC632 X-CRM114-Status: GOOD ( 10.62 ) 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 Align PSE memory configuration to vendor SDK. In particular, increase initial value of PSE reserved memory in airoha_fe_pse_ports_init() routine by the value used for the second Packet Processor Engine (PPE2) and do not overwrite the default value. commit 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/mediatek/airoha_eth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c index 480540526bdb..2e01abc70c17 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c @@ -1172,11 +1172,13 @@ static void airoha_fe_pse_ports_init(struct airoha_eth *eth) [FE_PSE_PORT_GDM4] = 2, [FE_PSE_PORT_CDM5] = 2, }; + u32 all_rsv; int q; + all_rsv = airoha_fe_get_pse_all_rsv(eth); /* hw misses PPE2 oq rsv */ - airoha_fe_set(eth, REG_FE_PSE_BUF_SET, - PSE_RSV_PAGES * pse_port_num_queues[FE_PSE_PORT_PPE2]); + all_rsv += PSE_RSV_PAGES * pse_port_num_queues[FE_PSE_PORT_PPE2]; + airoha_fe_set(eth, REG_FE_PSE_BUF_SET, all_rsv); /* CMD1 */ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM1]; q++)