Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8148028rdb; Thu, 4 Jan 2024 23:11:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOsHgtgZhcxSi8IgllRhFek484pUgHf/QcVbLi+1DgFE67rpzNlhrhjzNezqk5XzznkHNG X-Received: by 2002:a05:6a20:5483:b0:198:ffa2:42ee with SMTP id i3-20020a056a20548300b00198ffa242eemr2370720pzk.24.1704438682651; Thu, 04 Jan 2024 23:11:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704438682; cv=none; d=google.com; s=arc-20160816; b=YqxqJtIYc2cbfegQuwhXcvTTX5/ow5T/XEA//qsT/6MLmeuRCzYPi6siEf8bvx/H+m W2cDmukW9AUkyP/7v8rbOtROkOi/R1jt6Ui2cizzZJTSkBkxfODGoUP0AQqsn7ii1Nte 6FENZfZzJJn775Qsy7LTdnCaXNsCwQoVbCztQV19CFkc7RfQAKsOA+j8Apv1sHTCEwTd eqX9AC8tf0/vdJ/gNNg/JYottY9ZUSKF1Qq4genwH4iRg3tsr4q45IlxV53UGYj2ZB8l E3qAR932zoxF+zspKEUUegsQQcp6F4Zu3bfVj4/0d1APYmeGNXzjM88PLBUvMXDKhMSO JZ4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NHjvhosFF9pfcPDKWylZMfA2yszpoQFYVgdfJklMz9Y=; fh=jIY1HQBkctO5LjQPcp1JyYy68FbXwda6Gh4lXOHUJAc=; b=JCgE9Zvt0zJCHTH3O4oI1iUtuIE2SpU+ECpWv7D4pJR74A/AwqDa957yTCnwKkUC1u ucNvm3G6C9N5VLwErxz24MxRfZlVITBlf2fSjRdRIqhOPew+ScRiq8A5A1HSeF+Oo6VW osFc4LnpLU/HjaNMLy+1Dnc9CrQf2XOPIhnmgcdAh9fYX/cayMQxgGIJASgdSHGpUqWb ioJTxJSGluOKfxzHNQYhRVNM7X5uvNdfJyH+1PU1tAs+SBHoVE2u7zR8T3DIm6gDW2na LZvAMnnA8cERi67ZUr7Yas/5qbBA2dOHl0LvTyNZBVJOTw97uLUqfn9IFpCpD1I/3v4J wxNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EEhGEes8; spf=pass (google.com: domain of linux-kernel+bounces-17538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17538-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e20-20020a62aa14000000b006d9cb270e65si800120pff.392.2024.01.04.23.11.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 23:11:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EEhGEes8; spf=pass (google.com: domain of linux-kernel+bounces-17538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17538-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A0C2281825 for ; Fri, 5 Jan 2024 07:11:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EFBA20306; Fri, 5 Jan 2024 07:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EEhGEes8" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 317D1134A2; Fri, 5 Jan 2024 07:10:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704438617; x=1735974617; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jKRp9iRvAm9GuBLgpwNJYxVqDu1ubCTAkbYv82hvvk0=; b=EEhGEes87jjIARuvLrViC05T6c4DfkZk48tu1j+i5H/LCbrgoKjgFQZu n47EYX29g0qip0O3geQkUwx9bt82VFUWvzTaSh98x+CzkA+DmPYTE5gBd SJQl8W2dl2aqf1X+bKTAL297jtXCCJAvXJWCAG95x7BRcpD4bJOmu2qbf TAoX8Rf87T7othRi/ps1QZ6bbaaGKci8rFQkmIsYezAyASQu9//yCJsMH 6d4p0+Ae6yuDSEgCH0Kf+n86+TIODN3BHe2JHDgNsQC4U4n+rANOh7esM cbuIW7oV6Rvcq3mbR3pDPs5YxV2OELqYmULbro3L/Mu5rHgC4I7lzzws8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="463845895" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="463845895" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2024 23:10:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="871167373" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="871167373" Received: from pg-esw-build.png.intel.com ([10.226.214.65]) by FMSMGA003.fm.intel.com with ESMTP; 04 Jan 2024 23:10:02 -0800 From: Leong Ching Swee To: Maxime Coquelin , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, Swee Leong Ching , Teoh Ji Sheng Subject: [PATCH net-next v2 4/4] net: stmmac: Use interrupt mode INTM=1 for per channel irq Date: Fri, 5 Jan 2024 15:09:25 +0800 Message-Id: <20240105070925.2948871-5-leong.ching.swee@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240105070925.2948871-1-leong.ching.swee@intel.com> References: <20240105070925.2948871-1-leong.ching.swee@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Swee Leong Ching Enable per DMA channel interrupt that uses shared peripheral interrupt (SPI), so only per channel TX and RX intr (TI/RI) are handled by TX/RX ISR without calling common interrupt ISR. Signed-off-by: Teoh Ji Sheng Signed-off-by: Swee Leong Ching --- .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 ++ .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 32 +++++++++++-------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 207ff1799f2c..04bf731cb7ea 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -346,6 +346,9 @@ /* DMA Registers */ #define XGMAC_DMA_MODE 0x00003000 #define XGMAC_SWR BIT(0) +#define XGMAC_DMA_MODE_INTM_MASK GENMASK(13, 12) +#define XGMAC_DMA_MODE_INTM_SHIFT 12 +#define XGMAC_DMA_MODE_INTM_MODE1 0x1 #define XGMAC_DMA_SYSBUS_MODE 0x00003004 #define XGMAC_WR_OSR_LMT GENMASK(29, 24) #define XGMAC_WR_OSR_LMT_SHIFT 24 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c index 3cde695fec91..dcb9f094415d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c @@ -31,6 +31,13 @@ static void dwxgmac2_dma_init(void __iomem *ioaddr, value |= XGMAC_EAME; writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE); + + if (dma_cfg->multi_irq_en) { + value = readl(ioaddr + XGMAC_DMA_MODE); + value &= ~XGMAC_DMA_MODE_INTM_MASK; + value |= (XGMAC_DMA_MODE_INTM_MODE1 << XGMAC_DMA_MODE_INTM_SHIFT); + writel(value, ioaddr + XGMAC_DMA_MODE); + } } static void dwxgmac2_dma_init_chan(struct stmmac_priv *priv, @@ -365,19 +372,18 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, } /* TX/RX NORMAL interrupts */ - if (likely(intr_status & XGMAC_NIS)) { - if (likely(intr_status & XGMAC_RI)) { - u64_stats_update_begin(&rxq_stats->syncp); - rxq_stats->rx_normal_irq_n++; - u64_stats_update_end(&rxq_stats->syncp); - ret |= handle_rx; - } - if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) { - u64_stats_update_begin(&txq_stats->syncp); - txq_stats->tx_normal_irq_n++; - u64_stats_update_end(&txq_stats->syncp); - ret |= handle_tx; - } + if (likely(intr_status & XGMAC_RI)) { + u64_stats_update_begin(&rxq_stats->syncp); + rxq_stats->rx_normal_irq_n++; + u64_stats_update_end(&rxq_stats->syncp); + ret |= handle_rx; + } + + if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) { + u64_stats_update_begin(&txq_stats->syncp); + txq_stats->tx_normal_irq_n++; + u64_stats_update_end(&txq_stats->syncp); + ret |= handle_tx; } /* Clear interrupts */ -- 2.34.1