Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4375395pxf; Tue, 16 Mar 2021 11:51:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfJLGxW6OnJwGIKfFsxjfpe2k4s23SbSgyXEbJmXJMdwWIaQaGZQvBHeJp/y4lfa9MTZZ3 X-Received: by 2002:a05:6402:181a:: with SMTP id g26mr37695001edy.225.1615920693998; Tue, 16 Mar 2021 11:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615920693; cv=none; d=google.com; s=arc-20160816; b=IXEczFSo1KHqDh+elBfo61mA1T1b2qkjuOZlTgLN3ESBBmXaHhQZ9r2A3PyglfvhUH yRm/ljWnEwajrmBHLOh8ob9rQmcm/sjfsnmh/F7PrIE06/5yUsZPp6CztIztvRTgG+Ss /8Cv5CfXggYnJZqL/skR00nTmEHmFz1XhDySUhNeT09+8aHyrp4PIvCc4qb1K08uuNMb 8I+sKmEErPVvTTeJFXOGGgkWmc1NZ7gcDlYl68cOk7fallzCMgDWKg6ekpJ0tAWJ40Xk wN8EfbV2CkrcISXyWx4mC+tzBpevV4V0+MZBDx10xCPCPnNfPanAM/pnHdjV+qCcwQ0J 8Djg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=aWECTepJBHALF8CHmbYHzoOEOw8E8WCmbw19UIvlsX0=; b=Pq5gtM9U9UsnaTfKeecHMP1TUsDgosLM0U2uCCwzziRzAmskr+LzFBTrMx1W8dJ/54 i17IIJ0GupnUWfk/Ibi+rjQWshaKTcM1VpZoCKqaYfPbtMxUUf/Q879lFsFokOZLiWj/ ZueP7iPeFKT7HjMR7hmmkXzYTKooLAqeMGCOqytwlcrKD47GMafKXwUS990g+RTaIBvo GF5jG79jjAQTqQo80vORb7oWKUGy8jexycoTpQUhsSuX3FLgnBchH7wnU17CWpgbt5Bu YZ06g4XlgBhlbHbI5MqH8sEpfZeA8Huk0N/dWGP/hVSYmo+Mmr/uaRvehNI4LxQW1x1i LUeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id wn9si13476926ejb.491.2021.03.16.11.51.11; Tue, 16 Mar 2021 11:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231423AbhCPMT3 (ORCPT + 99 others); Tue, 16 Mar 2021 08:19:29 -0400 Received: from mga11.intel.com ([192.55.52.93]:42290 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbhCPMSq (ORCPT ); Tue, 16 Mar 2021 08:18:46 -0400 IronPort-SDR: 1ukg8GX2FVGOz3aTLuWB1iyuDEYo8XoIx/L1cHqprISbgLD0u6wBTf/5nKM8jIlsTUq7j5OCtz 3+VgKTrPdXzw== X-IronPort-AV: E=McAfee;i="6000,8403,9924"; a="185886828" X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="185886828" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 05:18:46 -0700 IronPort-SDR: mK6FkzXmq5OwBR5qHcwFLGjciFE4BCHfYBn0tCsX5oAJv3yr+/A6MpOu5BSzuf1YF/4ekUHDyh bcWYmwURdNRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="449703437" Received: from climb.png.intel.com ([10.221.118.165]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2021 05:18:43 -0700 From: Voon Weifeng To: "David S . Miller" , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Jakub Kicinski , Giuseppe Cavallaro , Andrew Lunn , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Ong Boon Leong , Voon Weifeng , Wong Vee Khee Subject: [RESEND v1 net-next 5/5] net: stmmac: use interrupt mode INTM=1 for multi-MSI Date: Tue, 16 Mar 2021 20:18:23 +0800 Message-Id: <20210316121823.18659-6-weifeng.voon@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210316121823.18659-1-weifeng.voon@intel.com> References: <20210316121823.18659-1-weifeng.voon@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Wong, Vee Khee" For interrupt mode INTM=0, TX/RX transfer complete will trigger signal not only on sbd_perch_[tx|rx]_intr_o (Transmit/Receive Per Channel) but also on the sbd_intr_o (Common). As for multi-MSI implementation, setting interrupt mode INTM=1 is more efficient as each TX intr and RX intr (TI/RI) will be handled by TX/RX ISR without the need of calling the common MAC ISR. Updated the TX/RX NORMAL interrupts status checking process as the NIS status bit is not asserted for any RI/TI events for INTM=1. Signed-off-by: Wong, Vee Khee Co-developed-by: Voon Weifeng Signed-off-by: Voon Weifeng --- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 8 +++++++ .../net/ethernet/stmicro/stmmac/dwmac4_dma.h | 3 +++ .../net/ethernet/stmicro/stmmac/dwmac4_lib.c | 23 +++++++++---------- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + include/linux/stmmac.h | 1 + 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c index 62aa0e95beb7..3c33b9a5b291 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c @@ -161,6 +161,14 @@ static void dwmac4_dma_init(void __iomem *ioaddr, value |= DMA_SYS_BUS_EAME; writel(value, ioaddr + DMA_SYS_BUS_MODE); + + value = readl(ioaddr + DMA_BUS_MODE); + + if (dma_cfg->multi_msi_en) { + value &= ~DMA_BUS_MODE_INTM_MASK; + value |= (DMA_BUS_MODE_INTM_MODE1 << DMA_BUS_MODE_INTM_SHIFT); + } + writel(value, ioaddr + DMA_BUS_MODE); } static void _dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 channel, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h index 5c0c53832adb..05481eb13ba6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h @@ -25,6 +25,9 @@ #define DMA_TBS_CTRL 0x00001050 /* DMA Bus Mode bitmap */ +#define DMA_BUS_MODE_INTM_MASK GENMASK(17, 16) +#define DMA_BUS_MODE_INTM_SHIFT 16 +#define DMA_BUS_MODE_INTM_MODE1 0x1 #define DMA_BUS_MODE_SFT_RESET BIT(0) /* DMA SYS Bus Mode bitmap */ diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c index 3fa602dabf49..e63270267578 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c @@ -166,20 +166,19 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr, } } /* TX/RX NORMAL interrupts */ - if (likely(intr_status & DMA_CHAN_STATUS_NIS)) { + if (likely(intr_status & DMA_CHAN_STATUS_NIS)) x->normal_irq_n++; - if (likely(intr_status & DMA_CHAN_STATUS_RI)) { - x->rx_normal_irq_n++; - ret |= handle_rx; - } - if (likely(intr_status & (DMA_CHAN_STATUS_TI | - DMA_CHAN_STATUS_TBU))) { - x->tx_normal_irq_n++; - ret |= handle_tx; - } - if (unlikely(intr_status & DMA_CHAN_STATUS_ERI)) - x->rx_early_irq++; + if (likely(intr_status & DMA_CHAN_STATUS_RI)) { + x->rx_normal_irq_n++; + ret |= handle_rx; + } + if (likely(intr_status & (DMA_CHAN_STATUS_TI | + DMA_CHAN_STATUS_TBU))) { + x->tx_normal_irq_n++; + ret |= handle_tx; } + if (unlikely(intr_status & DMA_CHAN_STATUS_ERI)) + x->rx_early_irq++; writel(intr_status & intr_en, ioaddr + DMA_CHAN_STATUS(chan)); return ret; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index efc35434b9af..d23722e86721 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5401,6 +5401,7 @@ int stmmac_dvr_probe(struct device *device, priv->plat = plat_dat; priv->ioaddr = res->addr; priv->dev->base_addr = (unsigned long)res->addr; + priv->plat->dma_cfg->multi_msi_en = priv->plat->multi_msi_en; priv->dev->irq = res->irq; priv->wol_irq = res->wol_irq; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index cb260a04df80..e35224ce61cc 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -96,6 +96,7 @@ struct stmmac_dma_cfg { int mixed_burst; bool aal; bool eame; + bool multi_msi_en; }; #define AXI_BLEN 7 -- 2.17.1