Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718AbdLHTTN (ORCPT ); Fri, 8 Dec 2017 14:19:13 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:57732 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbdLHTTJ (ORCPT ); Fri, 8 Dec 2017 14:19:09 -0500 Date: Fri, 08 Dec 2017 14:19:07 -0500 (EST) Message-Id: <20171208.141907.1804422023398223467.davem@davemloft.net> To: niklas.cassel@axis.com Cc: Joao.Pinto@synopsys.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, niklass@axis.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net: stmmac: fix broken dma_interrupt handling for multi-queues From: David Miller In-Reply-To: <20171207225610.15572-1-niklas.cassel@axis.com> References: <20171207225610.15572-1-niklas.cassel@axis.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 08 Dec 2017 11:19:09 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1152 Lines: 25 From: Niklas Cassel Date: Thu, 7 Dec 2017 23:56:10 +0100 > There is nothing that says that number of TX queues == number of RX > queues. E.g. the ARTPEC-6 SoC has 2 TX queues and 1 RX queue. > > This code is obviously wrong: > for (chan = 0; chan < tx_channel_count; chan++) { > struct stmmac_rx_queue *rx_q = &priv->rx_queue[chan]; > > priv->rx_queue has size MTL_MAX_RX_QUEUES, so this will send an > uninitialized napi_struct to __napi_schedule(), causing us to > crash in net_rx_action(), because napi_struct->poll is zero. ... > Since each DMA channel can be used for rx and tx simultaneously, > the current code should probably be rewritten so that napi_struct is > embedded in a new struct stmmac_channel. > That way, stmmac_poll() can call stmmac_tx_clean() on just the tx queue > where we got the IRQ, instead of looping through all tx queues. > This is also how the xgbe driver does it (another driver for this IP). > > Fixes: c22a3f48ef99 ("net: stmmac: adding multiple napi mechanism") > Signed-off-by: Niklas Cassel Applied, but indeed a lot more fixes are needed in this area.