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 73086D3C93E for ; Mon, 21 Oct 2024 05:07: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: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ia8mDRf0t3XivCUQZ/+4vX8Trnl04korBJf9mPFCzns=; b=pcNB78ErIfJTDwgl5nMAb0Ieyh ZtyTNhiCtwtGm//dfjTW60pOi+nB1vLoBEzKq3A3UTHg3wjlTzP6dizyWamiqtHdOmTEhSmdC0mh6 LtMMl1Cdl7D2fzm9/64UG1C5M1FymJakwmfvE74YEK53A1qqXSMmbx2tOcY8L8ySzjMOJcnoVZdGP wFjsMlWL+yIyko4fnX3xxT1cmA3XECxkvmSNy3Z9EQZmOyQA/3pd/0hhkSu7NwUh8vwLYKyV8WWgL 23vLYX0r1I9igg5AgEszolqI9AGAqNae8ZeITzb5Igp+kO9e5+f1zKdgCvI3J+EzmIxbjZAWEN+Hw byaHtVwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2kdp-000000064En-0cAE; Mon, 21 Oct 2024 05:07:41 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2kcI-0000000642S-0vTy for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 05:06:08 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20c803787abso30510835ad.0 for ; Sun, 20 Oct 2024 22:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729487165; x=1730091965; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ia8mDRf0t3XivCUQZ/+4vX8Trnl04korBJf9mPFCzns=; b=TnaG8PcH/Z88iWzWO2+hwQFrcwRDK5+7SwQ6/5bWIrGrKAZlLsnvrmLoRBkbYfIiRd vGdm2TjY7Pp6VIpoaf4AqWzLQIhtYBXacmS5AgoT2zPz5HsCk8ploQ0G8orlyqE78Ots hes4ZywYcCowMgKW/pjqtK3i8AzAhxGJ2197OIzIJ3dCGZYgNy3Oyl95wmgU5+6yAZMI EIuqmbGQMbWaiHB4n3h+94k0YIU3p62BkbWwC7oe7dAbSYVdnLyV/kAx352icvbolBTf jyDbiZCno+6F+Q8LWkFD2OCackt8aWyEto7RSlYlTENKY4uzYB71eeyhFRGb5tEgcH3k MBkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729487165; x=1730091965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ia8mDRf0t3XivCUQZ/+4vX8Trnl04korBJf9mPFCzns=; b=SyT0Ap1Wu/69TB1oE2HteTM6B74I5+BSTKHDWH44WLcdzUpiWvix7MqUfplg6C7Ktw GGD9P0eBhCEQqCONsKiWcjvozyYMeBc62TF9LbJHUHuoIIF0OrpV5SBGVyACFXJvylFw BKEGRt4AdxrQjuLDkJ+SByEaiPBxZ6hDzVbRpFMIwxHzgay4kqoxp5a9p4Tta/GPMRD0 fn1fem46B4PWVuVzQPr8d8LC9tAiUnUwY1GZ7PG5qw/2RL+5Q5iZ/z2yQ9luGTvkyyTQ tVt8ySvhPFm/shoHtlTsnKLUszYVdZ3owhVUR0mXHcOOvi4xv4e0aFD1YS5nPlyDAixl kxjw== X-Forwarded-Encrypted: i=1; AJvYcCXpBXSIZM7neP7WuF77aDO8xMCAZu+4p94HcEZlFKRl82w3+e34sRYhN63801xW5+efZSR522hMtwj+8P00WskP@lists.infradead.org X-Gm-Message-State: AOJu0YyUoYmK1dAaezmxcR0quzMP6utXOk3cVmBsU84/C9OiZyRg0x/P hzldKh5UfndMyCWuvQJB0jOZHjYZiQDdd/xrXq1SdkhbB0A248TT X-Google-Smtp-Source: AGHT+IFduHHYOeGnIjHKPhqSRTid9Q8opnKcs7z5l4h7HwBhUORtSS/HEc6X+MCCWiyS/K7HSNxigA== X-Received: by 2002:a17:903:244c:b0:20c:f39e:4c04 with SMTP id d9443c01a7336-20d471ec6ddmr224478475ad.2.1729487164568; Sun, 20 Oct 2024 22:06:04 -0700 (PDT) Received: from localhost ([129.146.253.192]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e7f0e1ba7sm17686565ad.238.2024.10.20.22.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2024 22:06:04 -0700 (PDT) Date: Mon, 21 Oct 2024 13:05:54 +0800 From: Furong Xu <0x1207@gmail.com> To: 2694439648@qq.com Cc: alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, hailong.fan@siengine.com Subject: Re: [PATCH v1] net: stmmac: enable MAC after MTL configuring Message-ID: <20241021130554.00005cf5@gmail.com> In-Reply-To: References: X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241020_220606_458415_393F2A9F X-CRM114-Status: GOOD ( 20.87 ) 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 On Mon, 21 Oct 2024 09:03:05 +0800, 2694439648@qq.com wrote: > From: "hailong.fan" > > DMA maybe block while ETH is opening, > Adjust the enable sequence, put the MAC enable last > > For example, ETH is directly connected to the switch, > which never power down and sends broadcast packets at regular intervals. > During the process of opening ETH, data may flow into the MTL FIFO, > once MAC RX is enabled. and then, MTL will be set, such as FIFO size. > Once enable DMA, There is a certain probability that DMA will read > incorrect data from MTL FIFO, causing DMA to hang up. > By read DMA_Debug_Status, you can be observed that the RPS remains at > a certain value forever. The correct process should be to configure > MAC/MTL/DMA before enabling DMA/MAC > > Signed-off-by: hailong.fan > A Fixes: tag should be added. > static void dwxgmac2_dma_stop_rx(struct stmmac_priv *priv, void __iomem *ioaddr, > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index e21404822..c19ca62a4 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3437,9 +3437,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) > priv->hw->rx_csum = 0; > } > > - /* Enable the MAC Rx/Tx */ > - stmmac_mac_set(priv, priv->ioaddr, true); > - > /* Set the HW DMA mode and the COE */ > stmmac_dma_operation_mode(priv); > > @@ -3523,6 +3520,9 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) > /* Start the ball rolling... */ > stmmac_start_all_dma(priv); > > + /* Enable the MAC Rx/Tx */ > + stmmac_mac_set(priv, priv->ioaddr, true); > + This sequence fix should be applied to stmmac_xdp_open() too. > stmmac_set_hw_vlan_mode(priv, priv->hw); > > return 0; It is better to split this patch into individual patches, since you are trying to fix an issue related to several previous commits: dwmac4, dwxgmac2, stmmac_hw_setup() and stmmac_xdp_open()