From patchwork Sun Sep 27 21:59:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3521 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 9B9741C308E for ; Mon, 28 Sep 2026 00:02:19 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-26354-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-26354-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 201063085D for ; Sun, 27 Sep 2026 22:00:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BEC13E8330; Sun, 27 Sep 2026 22:00:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zja1M34r" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-oo2-f39.google.com (mail-oo2-f39.google.com [74.125.231.167]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 354E23E8C46 for ; Sun, 27 Sep 2026 22:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.167 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790546409; cv=none; b=RHwZ5TU7JgRdsIJzBUWLD9XgDBW3d9T9+IfUgvtoZ27mLM2z4Ygx6GAYaqmj4LSWMnbJY+7TG9oMukPHEy6C6+doOAm4UAOpEOjy2VGL7vtlI/mKf6ujjKVqIHeS5upwaDIPyyGWzf6Ja6cefU30HmxmuCIiXPD3hGzWwCXQbAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790546409; c=relaxed/simple; bh=3ftdV+5R08Pr8zeGSaJM/WPcfoSQPOGMA1Wv4bA6gYc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DkHgg/TdYr3bncDjDXoz/grfvrD/e8cEu72JYvyTsxl5mhAGLMtzHfWHaMokGY0qr8VWXooaSmT6wmoodMiub4L7bvvdYaVZ66fWU3SMFbxGSB+EHfo7aVK7xh3ieSX23OjT9NhIfHL7e5jYsK5F6jzvNfGdc7QJ5SBZyiBcFHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zja1M34r; arc=none smtp.client-ip=74.125.231.167 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo2-f39.google.com with SMTP id 46e09a7af769-81d10e0cc02so42110a34.0 for ; Sun, 27 Sep 2026 15:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790546398; x=1791151198; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VjhkJuFgnFRl+4PjzirvgdpItVJEMtde3SK4p8xZD1Y=; b=Zja1M34rModrVB99uzCcktMRvPnJwb8stOZZFCIc4JX46SODWQ9iumV7m6crfXyUOb 6DWtTTGALBbIkJGu/siOb7Rc63cymj6ZGRWXQzOBydn0PHV7EkXnRjtHcWVJDFPc7vcz gFV3THqJ3ZIVlKbbku0h+fIdxE3ua8SvBOzKjqUXmoQoWUMe4IehVSjiY/tCQmPPbBYS kMnk7VnZdR5+B+LmvceSvhtqNyh9jyaPoGGtuY+PBByEY6X/bMAyjHXK/CXxIjWSeTqL AIYh2zYtaKrwPVZc78/LYGGWT1ikzljXnrR9TDZ4dUnsTiA+bfARpNtdvxkTzS3BJzWL qlOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790546398; x=1791151198; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VjhkJuFgnFRl+4PjzirvgdpItVJEMtde3SK4p8xZD1Y=; b=rgXSQU6l6oJuTgkV1uXAwnyL4HAEVGDRJsG42qSicrmGUTgRzHCvTD6OViJyI7WRdw hib8qOxAmwG6HbfFpcDXjWu230DT6hpDCWYDjqq3eo1CHzS2C7V06yJYZF+XeoY6RjcV Zf2f2C48XwwnDo5bjYtwy/8sLqGsLD1791hcTCb5XoEjqwVM4U+/lps46adj6mmld5HN iwsVNO7fISPWZWRv8VylOd3DTh2sPm1L9zGkyL3q4uVfe4oMR0viyMkO1iI6Se+SaszK UIXMOvq6wEBpATQ39ZxAwNRf+5LCYJ32gcxLDuboC1H+rxxaKGcFOnOKoN6J9073BQ7B 7g9Q== X-Forwarded-Encrypted: i=1; AKwUvBziXSgC0nJYaLFVi5PbKiUAmx6AsrsOfGxhE9o6md1g7vcNXS43x6moFE2x54ynZ1mjhBHq2zEVL4z1cA==@lists.linux.dev X-Gm-Message-State: AFuF++mNDqIKt5nTRT3NiUU3EwlBm+IBehiWrhrDVt9RZ+ImbTc+9jfr 5fJ3Azda4fVNn3/gVfxGb7yViuKKuTbBsWKSteSwk33cqNkq2326JNXU X-Gm-Gg: AYBFou2BoA6DJL44mb+CPFsA8pPnzh3iEEOjgp6fCPqYEDXJ0pMOdM4z54E3xk6QaJw 8whUur552/y1W6XgfpcQTPpqkiGeGB6FSx7CXEtsFbbOO85v5RW3fJWgbJlkcHPm53Cwh4zUjre WSbiPz75uWWVzZVBveOy/Pa/a2XqOUsTtMsrBbgR5vPg0I1wagA+kQ7iSd/xoeZ3SKqD4rsya5E m9T3bVCzfzvISM8DbHRhXwDZaBxzJVWAMi6P5TF/hjWbl00pBqhWbi+7woqAHpF9JyCMoAEqB9C ZXekrk205XGf0lL1x2LkIltvcSZYIGBRwjfcIKu6g71qHSkosQi8ASqcXv3oX2YT6PxHzxsbXN/ 2ipzVdott5+GulEgRMLfIqpkkWZSez5t2L2GZpkthY3N/WeHML05Zjy7/NS4jFS4hluT+7NDVcm 0PuvVe6VCAcEHKT9eKtuEeQyqY8iiyzLPJjLjia4sIiXU4AwQUApI3wWaprheetq0cLOqDXbAFI alU8vYhj35imgmk9Oc+PHjrR9nnzu1xqFb/K8QLSxs55ed5WHxvCBsbEAMANeAf74C/UAUao2LR zd6kIj8L7EbkDSLWSLmY4W4yB2JH0LbI5CxATkCw/Iee7hBLRRrTT9iSR1Z+5fqIswLNelIqdh4 zbwKAM3oZxeKHQFUoKBWTVKYn1/Upo3c= X-Received: by 2002:a05:6830:43a0:b0:7dc:dbe4:3f21 with SMTP id 46e09a7af769-81780d9a632mr11559233a34.1.1790546398452; Sun, 27 Sep 2026 14:59:58 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-81b3de6f7e1sm4874147a34.22.2026.09.27.14.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 14:59:57 -0700 (PDT) From: James Hilliard Date: Sun, 27 Sep 2026 15:59:40 -0600 Subject: [PATCH net-next v5 05/19] net: stmmac: embed struct stmmac_est in stmmac_priv struct Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260927-submit-stmmac-reset-fixes-v1-v5-5-feec6c14dd06@gmail.com> References: <20260927-submit-stmmac-reset-fixes-v1-v5-0-feec6c14dd06@gmail.com> In-Reply-To: <20260927-submit-stmmac-reset-fixes-v1-v5-0-feec6c14dd06@gmail.com> To: Russell King , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Russell King (Oracle)" , Maxime Chevallier , Andrew Lunn , Maxime Coquelin , Alexandre Torgue , Christian Marangi , Tiezhu Yang , Huacai Chen , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Serge Semin , Suraj Jaiswal , Richard Cochran , Joao Pinto , Vladimir Oltean , Ong Boon Leong , Voon Weifeng , "Song, Yoong Siang" , Linus Walleij , Martin Blumenstingl , Magnus Karlsson , Maciej Fijalkowski , Simon Horman , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Thierry Reding , Jonathan Hunter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jose Abreu , Yao Zi , Philipp Zabel Cc: Richard Genoud , Alastair D'Silva , Maxime Ripard , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org, ZhaoJinming , Lorenzo Bianconi , Ding Hui , Linkui Xiao , Linkui Xiao , linux-tegra@vger.kernel.org, linux-sunxi@lists.linux.dev, James Hilliard X-Mailer: b4 0.15.2 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-1.16 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FORGED_SENDER_MAILLIST(0.00)[]; FROM_HAS_DN(0.00)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[kernel,netdev]; RCVD_COUNT_FIVE(0.00)[6]; FREEMAIL_CC(0.00)[bootlin.com,d-silva.org,kernel.org,vger.kernel.org,st-md-mailman.stormreply.com,lists.infradead.org,uniontech.com,oss.qualcomm.com,163.com,kylinos.cn,126.com,lists.linux.dev,gmail.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[qualcomm.com:email,tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo]; FROM_NEQ_ENVFROM(0.00)[jameshilliard1@gmail.com,linux-sunxi@lists.linux.dev]; TAGGED_FROM(0.00)[bounces-26354-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; RCPT_COUNT_GT_50(0.00)[58]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; FREEMAIL_TO(0.00)[armlinux.org.uk,lunn.ch,gmail.com,davemloft.net,google.com,kernel.org,redhat.com,bootlin.com,foss.st.com,loongson.cn,iogearbox.net,fomichev.me,quicinc.com,synopsys.com,nxp.com,intel.com,googlemail.com,nvidia.com,sholland.org,ziyao.cc,pengutronix.de]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; RCVD_TLS_LAST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 9B9741C308E X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Lorenzo Bianconi This is a preliminary change to fix EST reconfiguration in the open and resume paths: the taprio offload must be re-applied after the DMA soft reset clears the MTL_EST registers, but the current layout makes that fragile. priv->est is currently a pointer allocated with devm_kzalloc() on the first taprio REPLACE, and the mutex guarding it (priv->est_lock) is initialized at the same time. That ties the lock's validity to whether taprio has ever been configured, so the EST parameters can not be read under the lock (e.g. to check priv->est->enable in the open and resume paths) before the first offload setup. Embed struct stmmac_est into struct stmmac_priv and initialize the mutex in probe(). This makes the code simpler (no logical changes added). Moreover, the lock is now unconditionally valid, so the enable flag can be inspected under the lock from any control path. Signed-off-by: Lorenzo Bianconi Signed-off-by: James Hilliard --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 17 +++---- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 22 ++++---- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 61 ++++++++++------------- 4 files changed, 45 insertions(+), 57 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 83c30b39f704..c65d95fc4760 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -300,7 +300,7 @@ struct stmmac_priv { struct plat_stmmacenet_data *plat; /* Protect est parameters */ struct mutex est_lock; - struct stmmac_est *est; + 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 894de213b92f..b233105cb449 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2745,9 +2745,8 @@ 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->est && priv->est->enable && - priv->est->max_sdu[queue] && - xdp_desc.len > priv->est->max_sdu[queue]) { + if (priv->est.enable && priv->est.max_sdu[queue] && + xdp_desc.len > priv->est.max_sdu[queue]) { priv->xstats.max_sdu_txq_drop[queue]++; continue; } @@ -4843,13 +4842,12 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) if (skb_is_gso(skb)) return stmmac_tso_xmit(skb, dev); - if (priv->est && priv->est->enable && - priv->est->max_sdu[queue]) { + if (priv->est.enable && priv->est.max_sdu[queue]) { sdu_len = skb->len; /* Add VLAN tag length if VLAN tag insertion offload is requested */ if (priv->dma_cap.vlins && skb_vlan_tag_present(skb)) sdu_len += VLAN_HLEN; - if (sdu_len > priv->est->max_sdu[queue]) { + if (sdu_len > priv->est.max_sdu[queue]) { priv->xstats.max_sdu_txq_drop[queue]++; goto max_sdu_err; } @@ -5253,9 +5251,8 @@ 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->est && priv->est->enable && - priv->est->max_sdu[queue] && - xdpf->len > priv->est->max_sdu[queue]) { + if (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; } @@ -8106,6 +8103,7 @@ static int __stmmac_dvr_probe(struct device *device, stmmac_napi_add(ndev); mutex_init(&priv->lock); + mutex_init(&priv->est_lock); rwlock_init(&priv->ptp_lock); stmmac_fpe_init(priv); @@ -8238,6 +8236,7 @@ void stmmac_dvr_remove(struct device *dev) stmmac_mdio_unregister(ndev); destroy_workqueue(priv->wq); + mutex_destroy(&priv->est_lock); mutex_destroy(&priv->lock); bitmap_free(priv->af_xdp_zc_qps); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 3bfcc9760dce..2a4099fe470c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -69,11 +69,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->est && priv->est->enable) { + if (priv->est.enable) { est_rst = true; mutex_lock(&priv->est_lock); - priv->est->enable = false; - stmmac_est_configure(priv, priv, priv->est, + priv->est.enable = false; + stmmac_est_configure(priv, priv, &priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); } @@ -91,19 +91,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->est->btr_reserve[0]; - time.tv_sec = priv->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->est->ctr[1] * NSEC_PER_SEC + - priv->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->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->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 42a00446e9b4..357d1eaf0d7d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -959,7 +959,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++) - priv->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; } } @@ -1023,24 +1023,15 @@ static int tc_taprio_configure(struct stmmac_priv *priv, if (qopt->cycle_time_extension >= BIT(wid + 7)) return -ERANGE; - if (!priv->est) { - priv->est = devm_kzalloc(priv->device, sizeof(*priv->est), - GFP_KERNEL); - if (!priv->est) - return -ENOMEM; - - mutex_init(&priv->est_lock); - } else { - mutex_lock(&priv->est_lock); - memset(priv->est, 0, sizeof(*priv->est)); - mutex_unlock(&priv->est_lock); - } + mutex_lock(&priv->est_lock); + memset(&priv->est, 0, sizeof(priv->est)); + mutex_unlock(&priv->est_lock); size = qopt->num_entries; mutex_lock(&priv->est_lock); - priv->est->gcl_size = size; - priv->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++) { @@ -1065,7 +1056,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, return -EOPNOTSUPP; } - priv->est->gcl[i] = delta_ns | (gates << wid); + priv->est.gcl[i] = delta_ns | (gates << wid); } mutex_lock(&priv->est_lock); @@ -1075,22 +1066,22 @@ static int tc_taprio_configure(struct stmmac_priv *priv, time = stmmac_calc_tas_basetime(qopt->base_time, current_time_ns, qopt->cycle_time); - priv->est->btr[0] = (u32)time.tv_nsec; - priv->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->est->btr_reserve[0] = (u32)qopt_time.tv_nsec; - priv->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->est->ctr[0] = do_div(ctr, NSEC_PER_SEC); - priv->est->ctr[1] = (u32)ctr; + priv->est.ctr[0] = do_div(ctr, NSEC_PER_SEC); + priv->est.ctr[1] = (u32)ctr; - priv->est->ter = qopt->cycle_time_extension; + priv->est.ter = qopt->cycle_time_extension; tc_taprio_map_maxsdu_txq(priv, qopt); - ret = stmmac_est_configure(priv, priv, priv->est, + ret = stmmac_est_configure(priv, priv, &priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); if (ret) { @@ -1106,19 +1097,17 @@ static int tc_taprio_configure(struct stmmac_priv *priv, return 0; disable: - if (priv->est) { - mutex_lock(&priv->est_lock); - 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++) { - priv->xstats.max_sdu_txq_drop[i] = 0; - priv->xstats.mtl_est_txq_hlbf[i] = 0; - priv->xstats.mtl_est_txq_hlbs[i] = 0; - } - mutex_unlock(&priv->est_lock); + mutex_lock(&priv->est_lock); + 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++) { + priv->xstats.max_sdu_txq_drop[i] = 0; + priv->xstats.mtl_est_txq_hlbf[i] = 0; + priv->xstats.mtl_est_txq_hlbs[i] = 0; } + mutex_unlock(&priv->est_lock); err = stmmac_fpe_map_preemption_class(priv, priv->dev, extack, 0);