From patchwork Mon May 13 01:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xiaolei wang X-Patchwork-Id: 13662966 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 656ECC25B4F for ; Mon, 13 May 2024 01:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8qHdC7z1RPhXLhfYWXeCy+NtrmgNp39PL941+pynz/s=; b=QgFHtZBwQ0jrqv Lanj/3ClxyRazw79T8qqzTdhgdj80Mzl9jAp1G5Mpxbi+DQhIWEUqgrePFu9bUXMyzeWaT6hdNP7V wUBDNjGYf8hu+ZeXYVicRpPuUCtGNl/H3FXO4abpbFgqh5yNjaZV58T9r1cwhn9A5LNY70ADoPXek MoktcbtXH3foEQrpDryaE/X1KcqnxgsAY5GuUD9SO9QFG8/YWaBx/IXNYoRp2cccyJkcCO5Kwd5hm 1OzPCFoaapur1V1LTDnywilkMVRRTlycdho5mJ3CVa9dtYSOPhS9+FgrQCAnvAVA9RKvWmdLeT4Iq nmjFDhahBAFWTBoQ35+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6KkA-0000000BIno-0YPx; Mon, 13 May 2024 01:44:46 +0000 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6Kk4-0000000BIlp-3dTZ for linux-arm-kernel@lists.infradead.org; Mon, 13 May 2024 01:44:44 +0000 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44D1WjZx026985; Sun, 12 May 2024 18:44:18 -0700 Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3y286frxrs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 12 May 2024 18:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iu7Pegy1Cx/w1f5AeZU54NilcKlGiXBbxfVZZFZhyV1BDSzzA9mGZMM1jWWNnqSzJELMJI9MJnJKgqLOlIh/zAPNg2YcHneUZ/dcifXdKvrQEkQ1OlSRUheSqiu84RRiMafv+H+8Jf70YJMBWIM6RNa57H760tUf2cjB019Gi7m9fyac17/R3UEoi4+R67E23T+SsPy6eWWTAisvix81ve+GIseUGqOL9m0oOXXNmqSeXpNYK2gfMhpO8XYxEIk6/elhR9nXyKjm0vcZzAhARxjJJcVXpBWOaaEdlN5TKNXgPBdRNNadkg91n+yEI5VlR5l8BiPXasFvJ1HZuXKLPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5Z+HR2dG5qVR12p2+7Ib6LqM9ccp2WvkFUBOkQ681Kk=; b=is6PTPCE8aBNXBl84yoUCO0WKwK1wSZr93exGIW6b+plV91d+VeRmWmw55x2W3NYxBVZCDSSPuirRG2tR7BTM3ObYLcsXmiPB5+9gnv1zOKfznp1GsEtp/vclx6RvWwWcUANzCABEhS/l0p45R9pqbme93v8ntYGLwFMjx8aVx75vXpeo5rLGseQVkD1Blc5/hSOhz45eofhV6jCMRyBNENwBweGZF3oBzI6V1N5t2kRC3G7iYzqP97sFQMkRFQPxyb/iFL5KZ3w+CKVu6IiFU5xetyWuqeBH0CEYMAZzFAuB7JfCbzVOE0vwVFWgjWthcwR1qcJyl4iV9qJWvlIoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from SJ0PR11MB5769.namprd11.prod.outlook.com (2603:10b6:a03:420::8) by PH7PR11MB7477.namprd11.prod.outlook.com (2603:10b6:510:279::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 01:44:16 +0000 Received: from SJ0PR11MB5769.namprd11.prod.outlook.com ([fe80::4ebe:8375:ccb:b4ad]) by SJ0PR11MB5769.namprd11.prod.outlook.com ([fe80::4ebe:8375:ccb:b4ad%5]) with mapi id 15.20.7544.046; Mon, 13 May 2024 01:44:16 +0000 From: Xiaolei Wang To: alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, richardcochran@gmail.com, bartosz.golaszewski@linaro.org, horms@kernel.org, rohan.g.thomas@intel.com, rmk+kernel@armlinux.org.uk, fancer.lancer@gmail.com, ahalaney@redhat.com Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH v6 2/2] net: stmmac: move the EST structure to struct stmmac_priv Date: Mon, 13 May 2024 09:43:46 +0800 Message-Id: <20240513014346.1718740-3-xiaolei.wang@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240513014346.1718740-1-xiaolei.wang@windriver.com> References: <20240513014346.1718740-1-xiaolei.wang@windriver.com> X-ClientProxiedBy: TYCP286CA0189.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:382::15) To SJ0PR11MB5769.namprd11.prod.outlook.com (2603:10b6:a03:420::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5769:EE_|PH7PR11MB7477:EE_ X-MS-Office365-Filtering-Correlation-Id: f21b92e9-f6b2-4ab9-3054-08dc72ee32e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|7416005|1800799015|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: fDgssn/pGQnbWnIm7fkiXEZGW7spxJ7tvvYpvNSFHIykwaxUcZXjtSHYG1YKXfJiYV47aaXziTQdrhS0QBPzSqv9S5gZj/vTRWoY0byUPa6VTL/luQbsqPe+E8wQqEcXqwRFODesZn7FFriDQXpSWEvVPe1anSTbJ71l3nrY/HoDu2+MF0Q/dcVD8m4DDEbD0eswDQoorVbqruanwuLx186AqnLqNI0fP/RsTGP9Y5V/OJwBHVYd1PCj83Y3Zek9cPgm60qK1ktcKNiUlwlNmxOPHD5xPvx0xAFQ57gjwQvP90n55E3fUOVDPiGdChv/bLFNQmEjaf6kglJTy5e3fuL/yp4bkzijb+VJFYnaxhgpg544SFp0+gtwS0Sf64iSLNxv/IOMsLVQxLVOG7dLgnFECB+gE22woGBEHja8jXfAlVcN1GZeSNtaJGLq7HPuj04cFa1EnsJm+M8wtC2xd39f0i8vTT7uZcR3WQkb/FOI2yBOho3shhhzQIAxASrnM7n4I4o1wCTr7g6DRhVncq430p55gaLBu0zteHNWMMWlmeeup4JRZBQyb3wlbf54XFgrOzhFoIkDUAW+Mo9XViXgj1Bt8u+4qswlKzTQORcsTDNpmUeKZLkMPAciV9aQD+qs/6vLgwd1vd3fHql8z7As9wNLW+pdfwKjkW/jpj24DUTHdYbGApJh7dLKZ0pFO1WFCqho8uLsf+5RGnJnk654Qy5K0eJXi7prnINkVl8hFDRLyORIU2oDS5AI2DH+m5XrGhc9h1UF9TxzvEACZuwyXYAbFL6ZZQkE4ct9hSNZplZldmVRJVuY3w35GbSXVEM31toJVfKP8uYXDXwRSqBgpUZydLVeSBs8gUIO3TOR7Py0+cf4jvEFcvXEmRtPJhqJG6rlO5AveIxwXWXtE7eSeo4jD4K+bkc2o4KppOtlQGhM4wD9fOIBdOoeiq83B7SdrkPRrbfO8eXIyc4OENP6waysPY4vT9WtsLcEDlKS8vLoDDRNrdREHvwYVGR+1oJCy4PLor73w0T5e3Q/jlw/BCQR5dQSzzsO2Vybzsd4/WGDi4g9Tf3Jb1WoyL6LCuGZQpXJY5hv3ZNqhD2t+rIHIceVR46LoxdUPXI2XitkweJ/ufBgDwPr2uzB1odTPkW6cfklNTCExDsKDRgeEe/+ymovJpxPFrQ+fUbSw02pS8A7vJXAm0mBAVLHwEclhGV78GQdOrcdH2/Bqa+y5u1bp+goT58hL8sRiTZEkoLBP1MqoD1Ftxx1EC/bNj55LAzfe8Nmg9eSIAQ/KiVrhTdcumRMB7MBnW7Hb2tFn6PvFwF1ZgKZZB8+8FwsU+oSWwhKI6aPsmES1BvpepGeMS4Lz+dLSLqVdKhBqMJUfwo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB5769.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(7416005)(1800799015)(52116005)(38350700005)(921011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7hKTS5fN8qoIPRBuLl82pzFWr/b0PjwfB1AfUkC/y/EABaDz3itatwl/uodjtNxJZZWFC1OLyI/JezYM5vcTKc0xVnWk85KZ/GGyEwR5l9RUok1R67ceYG9LwMPXfBconlbSERtglXDqiKz0UBTCrncrUrRj3V19UsqBPKIP+6lf8LEgcX5SG86e0IoTMJRckFM75IoZ7ESPa3FfAMMDx0WNNsDWa9Yx1kDmSpH1c/CyETCZROT5HhfbhHVP5e1BFjz0YfBD5l5ckxt6/F4Gp08NPvjeJJBhS6b2hJhSfGkJ043PXBFz56OFTH1o50aVnocM35KCi+MUBC9uBJFFP4TcsQRRxGas554dVQ8qknLcxB1siAUzrknvpv0YzRm9V6WZ1OJthIRe2c85JK04bYEqoxg+A/f6D82fIQDprmPB+RqbjycVQMBxPVSWL1O7V6A542ZRq3Lo2p0Vu8/zBa/q+oEYuHDu7EUCuaMaMPqMEfyIRv1Db302eyROSFprpeq4CDDgnuLIwTlbtLqBK9L7A55gV1EAF32JZg6IjCRpPDlSbwJ+nmw9uBOgVsmUzhEzIrds9wIhGO+DKA+jwtGxKuvrvraDcwYao+ZFnfEDWTTTyngFEKfUk+M/r5Me9xbtqgPCZn3TgmjDBvqUT7G1AVADnrSlORpllrFZuAzyx/wZ1zCRb9YpTX3Vs4EHwjIYQ4u2Cq5AwoWe/VbB0VJKMOUaNmj1HbQFRj5GiubMp4uHLOC56g+3XEDp3fBJe66C0WQFD7I2RCCSzzSG/aNGgBcIeqJ5ZhWulc4IuQXbXOxSkTbKuhtNNKj1mye+wp7ZozUrw7BzOufdOmKe/1YBl6P2VibEG8/7Hi0Ns4FN0/b2cDBdDna92oTcrNYSy2n/6HeqruCKINY4tWXqwUHMJbaCJVRvi0feObJ5bnMwoAVQJgt6ZM5gk2xpuP/bgD4HA7w+7Ncs8q+U0PaVYzgBFZDBniuGRPJuMxVrqAhfi9duLYBSQ4Ig2kRU1lVuhEUDTjt1va4neuTreDKEhSBxwxWK/vrb7f5oQWoJOOKQ8B+XOf6l+ro82dtSZPPdUJH9WWtHHw8XCKo190FNhxkZn98rIbikRzB2LP6QyhJPbqVY6IrBBobDS3oX2eiv+ClgfSHk7lhB+99bckhT8TUEz/H87ZtdbIA16agNAaSno0LtA3F9GtdHiEYF6WQuBSwdvuqGvvuSG51oEKjjBKCRaAPhgKfIGIOEMQIB2L04ZfeXBCuYVlJIv+QX3jxVUqrfUpEl1nMuH3n+l/j5M1+IjYr+gU0usECUeVVJOrfVuE6Pln76PFlYrvjvfXhNss0X5p0P3rxjeV1/0dA68FKJjG27BA10eC17nmZwBiiyY+O2yBnPOBKJHwo6W+QcyLrLhbnGEq4YJVbg8ednO4n7VidSYusMf5e8ZwZs5ocEa3VkKbkpgEDI1PUwtGLksFLfub4f9Cod0oV6/EIPM3T9ZvaKoRD5WksvDspInYw8X2YAfmnfJJ3xplUqNcsZhUChc9BL6QK2j5PgTPFXoixrlIFyaPOsswB8oF2BugTtrw8sa4rYnPN8qO0IcRYGHlgywlsIA7X2F2av1PFE/Q== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: f21b92e9-f6b2-4ab9-3054-08dc72ee32e4 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5769.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 01:44:16.4217 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S+tzT+Bq/6VW/TemC5AcWhPFYoufMlW9RuMRqVev+0+u8gFA0p9xn9+fsrUvz/e0vsvxw4jeuMd/3qPGxSpmcGZFuyzwasdf2H2QHJjlqAY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7477 X-Proofpoint-ORIG-GUID: rZgV1wD_InYwmkpXlhbiL23_hdNiQL-F X-Proofpoint-GUID: rZgV1wD_InYwmkpXlhbiL23_hdNiQL-F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-12_15,2024-05-10_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 spamscore=0 suspectscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405130010 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240512_184440_959076_140714A1 X-CRM114-Status: GOOD ( 18.68 ) 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 Move the EST structure to struct stmmac_priv, because the EST configs don't look like platform config, but EST is enabled in runtime with the settings retrieved for the TC TAPRIO feature also in runtime. So it's better to have the EST-data preserved in the driver private data instead of the platform data storage. Signed-off-by: Xiaolei Wang Reviewed-by: Simon Horman Reviewed-by: Serge Semin Reviewed-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 15 +++++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++----- .../net/ethernet/stmicro/stmmac/stmmac_ptp.c | 22 +++++----- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 40 +++++++++---------- include/linux/stmmac.h | 15 ------- 5 files changed, 54 insertions(+), 56 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 64b21c83e2b8..011683abf97f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -221,6 +221,20 @@ struct stmmac_dma_conf { unsigned int dma_tx_size; }; +#define EST_GCL 1024 +struct stmmac_est { + int enable; + u32 btr_reserve[2]; + u32 btr_offset[2]; + u32 btr[2]; + u32 ctr[2]; + u32 ter; + u32 gcl_unaligned[EST_GCL]; + u32 gcl[EST_GCL]; + u32 gcl_size; + u32 max_sdu[MTL_MAX_TX_QUEUES]; +}; + struct stmmac_priv { /* Frequently used values are kept adjacent for cache effect */ u32 tx_coal_frames[MTL_MAX_TX_QUEUES]; @@ -263,6 +277,7 @@ struct stmmac_priv { struct plat_stmmacenet_data *plat; /* Protect est parameters */ struct mutex est_lock; + struct stmmac_est *est; struct dma_features dma_cap; struct stmmac_counters mmc; int hw_cap_support; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7c6fb14b5555..0eafd609bf53 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2491,9 +2491,9 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) if (!xsk_tx_peek_desc(pool, &xdp_desc)) break; - if (priv->plat->est && priv->plat->est->enable && - priv->plat->est->max_sdu[queue] && - xdp_desc.len > priv->plat->est->max_sdu[queue]) { + if (priv->est && priv->est->enable && + priv->est->max_sdu[queue] && + xdp_desc.len > priv->est->max_sdu[queue]) { priv->xstats.max_sdu_txq_drop[queue]++; continue; } @@ -4528,9 +4528,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) return stmmac_tso_xmit(skb, dev); } - if (priv->plat->est && priv->plat->est->enable && - priv->plat->est->max_sdu[queue] && - skb->len > priv->plat->est->max_sdu[queue]){ + if (priv->est && priv->est->enable && + priv->est->max_sdu[queue] && + skb->len > priv->est->max_sdu[queue]){ priv->xstats.max_sdu_txq_drop[queue]++; goto max_sdu_err; } @@ -4909,9 +4909,9 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, if (stmmac_tx_avail(priv, queue) < STMMAC_TX_THRESH(priv)) return STMMAC_XDP_CONSUMED; - if (priv->plat->est && priv->plat->est->enable && - priv->plat->est->max_sdu[queue] && - xdpf->len > priv->plat->est->max_sdu[queue]) { + if (priv->est && priv->est->enable && + priv->est->max_sdu[queue] && + xdpf->len > priv->est->max_sdu[queue]) { priv->xstats.max_sdu_txq_drop[queue]++; return STMMAC_XDP_CONSUMED; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 0c5aab6dd7a7..a6b1de9a251d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -68,11 +68,11 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) nsec = reminder; /* If EST is enabled, disabled it before adjust ptp time. */ - if (priv->plat->est && priv->plat->est->enable) { + if (priv->est && priv->est->enable) { est_rst = true; mutex_lock(&priv->est_lock); - priv->plat->est->enable = false; - stmmac_est_configure(priv, priv, priv->plat->est, + priv->est->enable = false; + stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); } @@ -90,19 +90,19 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) mutex_lock(&priv->est_lock); priv->ptp_clock_ops.gettime64(&priv->ptp_clock_ops, ¤t_time); current_time_ns = timespec64_to_ktime(current_time); - time.tv_nsec = priv->plat->est->btr_reserve[0]; - time.tv_sec = priv->plat->est->btr_reserve[1]; + time.tv_nsec = priv->est->btr_reserve[0]; + time.tv_sec = priv->est->btr_reserve[1]; basetime = timespec64_to_ktime(time); - cycle_time = (u64)priv->plat->est->ctr[1] * NSEC_PER_SEC + - priv->plat->est->ctr[0]; + cycle_time = (u64)priv->est->ctr[1] * NSEC_PER_SEC + + priv->est->ctr[0]; time = stmmac_calc_tas_basetime(basetime, current_time_ns, cycle_time); - priv->plat->est->btr[0] = (u32)time.tv_nsec; - priv->plat->est->btr[1] = (u32)time.tv_sec; - priv->plat->est->enable = true; - ret = stmmac_est_configure(priv, priv, priv->plat->est, + priv->est->btr[0] = (u32)time.tv_nsec; + priv->est->btr[1] = (u32)time.tv_sec; + priv->est->enable = true; + ret = stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); if (ret) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 620c16e9be3a..222540b55480 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -918,7 +918,6 @@ struct timespec64 stmmac_calc_tas_basetime(ktime_t old_base_time, static void tc_taprio_map_maxsdu_txq(struct stmmac_priv *priv, struct tc_taprio_qopt_offload *qopt) { - struct plat_stmmacenet_data *plat = priv->plat; u32 num_tc = qopt->mqprio.qopt.num_tc; u32 offset, count, i, j; @@ -933,7 +932,7 @@ static void tc_taprio_map_maxsdu_txq(struct stmmac_priv *priv, count = qopt->mqprio.qopt.count[i]; for (j = offset; j < offset + count; j++) - plat->est->max_sdu[j] = qopt->max_sdu[i] + ETH_HLEN - ETH_TLEN; + priv->est->max_sdu[j] = qopt->max_sdu[i] + ETH_HLEN - ETH_TLEN; } } @@ -941,7 +940,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, struct tc_taprio_qopt_offload *qopt) { u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep; - struct plat_stmmacenet_data *plat = priv->plat; struct timespec64 time, current_time, qopt_time; ktime_t current_time_ns; bool fpe = false; @@ -998,24 +996,24 @@ static int tc_taprio_configure(struct stmmac_priv *priv, if (qopt->cycle_time_extension >= BIT(wid + 7)) return -ERANGE; - if (!plat->est) { - plat->est = devm_kzalloc(priv->device, sizeof(*plat->est), + if (!priv->est) { + priv->est = devm_kzalloc(priv->device, sizeof(*priv->est), GFP_KERNEL); - if (!plat->est) + if (!priv->est) return -ENOMEM; mutex_init(&priv->est_lock); } else { mutex_lock(&priv->est_lock); - memset(plat->est, 0, sizeof(*plat->est)); + memset(priv->est, 0, sizeof(*priv->est)); mutex_unlock(&priv->est_lock); } size = qopt->num_entries; mutex_lock(&priv->est_lock); - priv->plat->est->gcl_size = size; - priv->plat->est->enable = qopt->cmd == TAPRIO_CMD_REPLACE; + priv->est->gcl_size = size; + priv->est->enable = qopt->cmd == TAPRIO_CMD_REPLACE; mutex_unlock(&priv->est_lock); for (i = 0; i < size; i++) { @@ -1044,7 +1042,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, return -EOPNOTSUPP; } - priv->plat->est->gcl[i] = delta_ns | (gates << wid); + priv->est->gcl[i] = delta_ns | (gates << wid); } mutex_lock(&priv->est_lock); @@ -1054,18 +1052,18 @@ static int tc_taprio_configure(struct stmmac_priv *priv, time = stmmac_calc_tas_basetime(qopt->base_time, current_time_ns, qopt->cycle_time); - priv->plat->est->btr[0] = (u32)time.tv_nsec; - priv->plat->est->btr[1] = (u32)time.tv_sec; + priv->est->btr[0] = (u32)time.tv_nsec; + priv->est->btr[1] = (u32)time.tv_sec; qopt_time = ktime_to_timespec64(qopt->base_time); - priv->plat->est->btr_reserve[0] = (u32)qopt_time.tv_nsec; - priv->plat->est->btr_reserve[1] = (u32)qopt_time.tv_sec; + priv->est->btr_reserve[0] = (u32)qopt_time.tv_nsec; + priv->est->btr_reserve[1] = (u32)qopt_time.tv_sec; ctr = qopt->cycle_time; - priv->plat->est->ctr[0] = do_div(ctr, NSEC_PER_SEC); - priv->plat->est->ctr[1] = (u32)ctr; + priv->est->ctr[0] = do_div(ctr, NSEC_PER_SEC); + priv->est->ctr[1] = (u32)ctr; - priv->plat->est->ter = qopt->cycle_time_extension; + priv->est->ter = qopt->cycle_time_extension; tc_taprio_map_maxsdu_txq(priv, qopt); @@ -1079,7 +1077,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, */ priv->plat->fpe_cfg->enable = fpe; - ret = stmmac_est_configure(priv, priv, priv->plat->est, + ret = stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); if (ret) { @@ -1097,10 +1095,10 @@ static int tc_taprio_configure(struct stmmac_priv *priv, return 0; disable: - if (priv->plat->est) { + if (priv->est) { mutex_lock(&priv->est_lock); - priv->plat->est->enable = false; - stmmac_est_configure(priv, priv, priv->plat->est, + priv->est->enable = false; + stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); /* Reset taprio status */ for (i = 0; i < priv->plat->tx_queues_to_use; i++) { diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index c0d74f97fd18..5da45d025601 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -115,20 +115,6 @@ struct stmmac_axi { bool axi_rb; }; -#define EST_GCL 1024 -struct stmmac_est { - int enable; - u32 btr_reserve[2]; - u32 btr_offset[2]; - u32 btr[2]; - u32 ctr[2]; - u32 ter; - u32 gcl_unaligned[EST_GCL]; - u32 gcl[EST_GCL]; - u32 gcl_size; - u32 max_sdu[MTL_MAX_TX_QUEUES]; -}; - struct stmmac_rxq_cfg { u8 mode_to_use; u32 chan; @@ -245,7 +231,6 @@ struct plat_stmmacenet_data { struct fwnode_handle *port_node; struct device_node *mdio_node; struct stmmac_dma_cfg *dma_cfg; - struct stmmac_est *est; struct stmmac_fpe_cfg *fpe_cfg; struct stmmac_safety_feature_cfg *safety_feat_cfg; int clk_csr;