From mboxrd@z Thu Jan 1 00:00:00 1970 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 088C3C4167B for ; Thu, 30 Nov 2023 09:56:13 +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: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X9SYqXroBRQPDA7v2itFr29Kp7wEwpWr+J1NXPNA3u0=; b=4DINJiLMAZKoeU axTG7vZ4h0Fbtp3vQqZUcU7asHN6qhujTZYm6zYu6Ihfs5hp36lXYhLbziI6zHqWao/CHb/rsudvn sBy/vNURHXH0UBodsqnpH0v1Mj0mnI1A8k9rPQytTYEKb1PNK/o7BY1BorWdrTUfrSKYF9NaRmspA U7ZT/IHW8vH+JwznYEI15qdThEE16OMwTvPXOZw+4x0KGC7Emy9Ib1i0ESeyskxP83JkgCzwFwyLL XTUVgRis/J3ra1mcshdpAueBu+K2stFkDwkUCr7hFdbwM7PFeQ6UfED0dWyBtLWLK4u6QPUWOCKpW 7lvIoK1IuC8x1nD+2Y4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8dlp-00AN68-2r; Thu, 30 Nov 2023 09:55:45 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8dlm-00AN58-14 for linux-arm-kernel@lists.infradead.org; Thu, 30 Nov 2023 09:55:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701338139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nL97IYI1tBJivCOQRB2PiwCmMVwRAH5/tuzpmlKeGw=; b=il0MZpfAQh5jsfXlznsBCt57BIzAXSsninHhG0tVnIAaFGJ/SUAug6wdDwcnGZbY3aNvob 627qUebZX081Fvkf5StE35GmM1qA55mG213nQui5u8lEw4LYjA0K2IMQJSx4sIcVZrl4YE iQvwJTcBtePLe9AHLwbXHm9sE8pBKJo= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-131-jdYqmkQVPd-y9j1aDxpr1Q-1; Thu, 30 Nov 2023 04:55:38 -0500 X-MC-Unique: jdYqmkQVPd-y9j1aDxpr1Q-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-544f174ccccso124747a12.0 for ; Thu, 30 Nov 2023 01:55:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701338137; x=1701942937; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Za4sJve0w/4uyVCmAF/v91nTDwdldnwMa4Hd6aawqsI=; b=gFH3FccDqpQG2RMO2z+pik26gK1/tvK8zdQm4eneH82k34VOr0+ElFrv828JaMYnn8 +zoTU9DNdi4akpGqW8iTF79/3LXYtKWHFXZuNLTynltyfznJb9I7Ks17r2zPOGoOO1cr oxMO+uphzyrSIXCnOQdp1zJ2aJxJYYbI8MXFwKv6Gi89ZF2VOZgQyPin8JxFteFjcJnX S4Pn9oUXBx5p3OaSzGu18EKrMddUp0+tCQ3+KxW/ByHWNYDkw7h75ZqALG4J0i2cMTs/ Z3wDdaKZcKheI0ZMeJ6obH8i0JcUv6dHA1Bh6N/IbqfD/EUdkDQcz725yN+leeU4D3/O sNHA== X-Gm-Message-State: AOJu0Yz3ISepR37xlk0IxDyT9JINqmeuMyYkfxUDol3UMmYQ5pUYdF5m wNzod+kr+0t9AGMqzM6bxIbSgIehu2oZC05JXaw8vURjVDZW7atGtktTGncc8mo+aOWMQl0eJSz BiMFo9NPLu6YoTYLYJ65wkDS7vClTXEtT6eI= X-Received: by 2002:a17:906:3a50:b0:9e6:c282:5bd5 with SMTP id a16-20020a1709063a5000b009e6c2825bd5mr13208730ejf.3.1701338137066; Thu, 30 Nov 2023 01:55:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhfQ/rCbsijEdqj8NNrZdyThnnKJUi1IYycp9pCcdpcBskxx8OHIbdnAZXab11CUzP0ZDViQ== X-Received: by 2002:a17:906:3a50:b0:9e6:c282:5bd5 with SMTP id a16-20020a1709063a5000b009e6c2825bd5mr13208709ejf.3.1701338136699; Thu, 30 Nov 2023 01:55:36 -0800 (PST) Received: from gerbillo.redhat.com (146-241-254-39.dyn.eolo.it. [146.241.254.39]) by smtp.gmail.com with ESMTPSA id q20-20020a170906145400b009fc927023bcsm495253ejc.34.2023.11.30.01.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 01:55:36 -0800 (PST) Message-ID: <1716792a3881338b1a416b1f4dd85a9437746ec2.camel@redhat.com> Subject: Re: [PATCH v3] net: stmmac: fix FPE events losing From: Paolo Abeni To: Jianheng Zhang , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Maxime Coquelin , Simon Horman , Andrew Halaney , Bartosz Golaszewski , Shenwei Wang , Johannes Zink , "Russell King (Oracle" , Jochen Henneberg , Voon Weifeng , Mohammad Athari Bin Ismail , Ong Boon Leong , Tan Tee Min Cc: "open list:STMMAC ETHERNET DRIVER" , "moderated list:ARM/STM32 ARCHITECTURE" , "moderated list:ARM/STM32 ARCHITECTURE" , open list , James Li , Martin McKenny Date: Thu, 30 Nov 2023 10:55:34 +0100 In-Reply-To: References: User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231130_015542_462301_24911A01 X-CRM114-Status: GOOD ( 20.86 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 2023-11-28 at 05:56 +0000, Jianheng Zhang wrote: > The status bits of register MAC_FPE_CTRL_STS are clear on read. Using > 32-bit read for MAC_FPE_CTRL_STS in dwmac5_fpe_configure() and > dwmac5_fpe_send_mpacket() clear the status bits. Then the stmmac interrupt > handler missing FPE event status and leads to FPE handshaking failure and > retries. > To avoid clear status bits of MAC_FPE_CTRL_STS in dwmac5_fpe_configure() > and dwmac5_fpe_send_mpacket(), add fpe_csr to stmmac_fpe_cfg structure to > cache the control bits of MAC_FPE_CTRL_STS and to avoid reading > MAC_FPE_CTRL_STS in those methods. > > Fixes: 5a5586112b92 ("net: stmmac: support FPE link partner hand-shaking procedure") > Reviewed-by: Serge Semin > Signed-off-by: Jianheng Zhang > --- > drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 45 +++++++++------------- > drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 4 +- > .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 3 +- > drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 +- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++- > drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 1 + > include/linux/stmmac.h | 1 + > 7 files changed, 36 insertions(+), 30 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c > index e95d35f..8fd1675 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c > @@ -710,28 +710,22 @@ void dwmac5_est_irq_status(void __iomem *ioaddr, struct net_device *dev, > } > } > > -void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, > +void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, > + u32 num_txq, u32 num_rxq, > bool enable) > { > u32 value; > > - if (!enable) { > - value = readl(ioaddr + MAC_FPE_CTRL_STS); > - > - value &= ~EFPE; > - > - writel(value, ioaddr + MAC_FPE_CTRL_STS); > - return; > + if (enable) { > + cfg->fpe_csr = EFPE; > + value = readl(ioaddr + GMAC_RXQ_CTRL1); > + value &= ~GMAC_RXQCTRL_FPRQ; > + value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; > + writel(value, ioaddr + GMAC_RXQ_CTRL1); > + } else { > + cfg->fpe_csr = 0; > } > - > - value = readl(ioaddr + GMAC_RXQ_CTRL1); > - value &= ~GMAC_RXQCTRL_FPRQ; > - value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; > - writel(value, ioaddr + GMAC_RXQ_CTRL1); > - > - value = readl(ioaddr + MAC_FPE_CTRL_STS); > - value |= EFPE; > - writel(value, ioaddr + MAC_FPE_CTRL_STS); > + writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS); > } > > int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) > @@ -741,6 +735,9 @@ int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) > > status = FPE_EVENT_UNKNOWN; > > + /* Reads from the MAC_FPE_CTRL_STS register should only be performed > + * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read" > + */ > value = readl(ioaddr + MAC_FPE_CTRL_STS); > > if (value & TRSP) { > @@ -766,19 +763,15 @@ int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) > return status; > } > > -void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, enum stmmac_mpacket_type type) > +void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, > + enum stmmac_mpacket_type type) > { > - u32 value; > + u32 value = cfg->fpe_csr; > > - value = readl(ioaddr + MAC_FPE_CTRL_STS); > - > - if (type == MPACKET_VERIFY) { > - value &= ~SRSP; > + if (type == MPACKET_VERIFY) > value |= SVER; > - } else { > - value &= ~SVER; > + else if (type == MPACKET_RESPONSE) > value |= SRSP; > - } > > writel(value, ioaddr + MAC_FPE_CTRL_STS); > } It's unclear to me why it's not necessary to preserve the SVER/SRSP bits across MAC_FPE_CTRL_STS writes. I guess they are not part of the status bits? perhaps an explicit comment somewhere will help? Thanks Paolo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel