diff mbox

[v3,net-next,7/9] net: stmicro: prepare irq_status for mtl

Message ID 9924f5611f699473d1d2333d585c2ce6bd73dffb.1489055407.git.jpinto@synopsys.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Joao Pinto March 9, 2017, 11:03 a.m. UTC
This patch prepares mac irq status treatment for multiple queues.

Signed-off-by: Joao Pinto <jpinto@synopsys.com>
---
changes v2->v3:
- local variable declarations from longest to shortest line
changes v1->v2:
- Just to keep up with patch-set version

 drivers/net/ethernet/stmicro/stmmac/common.h      |  2 ++
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h      |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 38 ++++++++++++++---------
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |  5 +++
 4 files changed, 31 insertions(+), 16 deletions(-)

Comments

kernel test robot March 9, 2017, 11:08 p.m. UTC | #1
Hi Joao,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Joao-Pinto/prepare-mac-operations-for-multiple-queues/20170310-062934
config: x86_64-randconfig-x015-201710 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_irq_mtl_status':
>> drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:422:32: error: 'ioaddr' undeclared (first use in this function)
     u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
                                   ^~~~~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:422:32: note: each undeclared identifier is reported only once for each function it appears in

vim +/ioaddr +422 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

   416			pr_info("Link is Down\n");
   417		}
   418	}
   419	
   420	static int dwmac4_irq_mtl_status(struct mac_device_info *hw, u32 chan)
   421	{
 > 422		u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
   423		void __iomem *ioaddr = hw->pcsr;
   424		int ret = 0;
   425	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 10, 2017, 12:18 a.m. UTC | #2
Hi Joao,

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Joao-Pinto/prepare-mac-operations-for-multiple-queues/20170310-062934
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All warnings (new ones prefixed by >>):

   In file included from arch/sh/include/asm/io.h:26:0,
                    from include/linux/scatterlist.h:8,
                    from include/linux/dma-mapping.h:10,
                    from include/linux/skbuff.h:34,
                    from include/linux/if_ether.h:23,
                    from include/uapi/linux/ethtool.h:18,
                    from include/linux/ethtool.h:17,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:18:
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_irq_mtl_status':
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:422:32: error: 'ioaddr' undeclared (first use in this function)
     u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
                                   ^
   arch/sh/include/mach-common/mach/mangle-port.h:42:23: note: in definition of macro 'ioswabl'
    # define ioswabl(x)  (x)
                          ^
>> arch/sh/include/asm/io.h:40:47: note: in expansion of macro '__raw_readl'
    #define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
                                                  ^~~~~~~~~~~
>> arch/sh/include/asm/io.h:50:31: note: in expansion of macro 'readl_relaxed'
    #define readl(a)  ({ u32 r_ = readl_relaxed(a); rmb(); r_; })
                                  ^~~~~~~~~~~~~
>> drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:422:26: note: in expansion of macro 'readl'
     u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
                             ^~~~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:422:32: note: each undeclared identifier is reported only once for each function it appears in
     u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
                                   ^
   arch/sh/include/mach-common/mach/mangle-port.h:42:23: note: in definition of macro 'ioswabl'
    # define ioswabl(x)  (x)
                          ^
>> arch/sh/include/asm/io.h:40:47: note: in expansion of macro '__raw_readl'
    #define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
                                                  ^~~~~~~~~~~
>> arch/sh/include/asm/io.h:50:31: note: in expansion of macro 'readl_relaxed'
    #define readl(a)  ({ u32 r_ = readl_relaxed(a); rmb(); r_; })
                                  ^~~~~~~~~~~~~
>> drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:422:26: note: in expansion of macro 'readl'
     u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
                             ^~~~~

vim +/readl +422 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

   406				x->pcs_speed = SPEED_100;
   407			else
   408				x->pcs_speed = SPEED_10;
   409	
   410			x->pcs_duplex = (status & GMAC_PHYIF_CTRLSTATUS_LNKMOD_MASK);
   411	
   412			pr_info("Link is Up - %d/%s\n", (int)x->pcs_speed,
   413				x->pcs_duplex ? "Full" : "Half");
   414		} else {
   415			x->pcs_link = 0;
   416			pr_info("Link is Down\n");
   417		}
   418	}
   419	
   420	static int dwmac4_irq_mtl_status(struct mac_device_info *hw, u32 chan)
   421	{
 > 422		u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
   423		void __iomem *ioaddr = hw->pcsr;
   424		int ret = 0;
   425	
   426		/* Check MTL Interrupt */
   427		if (mtl_int_qx_status & MTL_INT_QX(chan)) {
   428			/* read Queue x Interrupt status */
   429			u32 status = readl(ioaddr + MTL_CHAN_INT_CTRL(chan));
   430	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 5532633..6a348d3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -469,6 +469,8 @@  struct stmmac_ops {
 	/* Handle extra events on specific interrupts hw dependent */
 	int (*host_irq_status)(struct mac_device_info *hw,
 			       struct stmmac_extra_stats *x);
+	/* Handle MTL interrupts */
+	int (*host_mtl_irq_status)(struct mac_device_info *hw, u32 chan);
 	/* Multicast filter setting */
 	void (*set_filter)(struct mac_device_info *hw, struct net_device *dev);
 	/* Flow control setting */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 9dd8ac1..5ca4d64 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -172,7 +172,7 @@  enum power_event {
 #define MTL_OPERATION_RAA_WSP		(0x1 << 2)
 
 #define MTL_INT_STATUS			0x00000c20
-#define MTL_INT_Q0			BIT(0)
+#define MTL_INT_QX(x)			BIT(x)
 
 #define MTL_RXQ_DMA_MAP0		0x00000c30 /* queue 0 to 3 */
 #define MTL_RXQ_DMA_MAP1		0x00000c34 /* queue 4 to 7 */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 5caed2a..be83602 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -417,11 +417,32 @@  static void dwmac4_phystatus(void __iomem *ioaddr, struct stmmac_extra_stats *x)
 	}
 }
 
+static int dwmac4_irq_mtl_status(struct mac_device_info *hw, u32 chan)
+{
+	u32 mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
+	void __iomem *ioaddr = hw->pcsr;
+	int ret = 0;
+
+	/* Check MTL Interrupt */
+	if (mtl_int_qx_status & MTL_INT_QX(chan)) {
+		/* read Queue x Interrupt status */
+		u32 status = readl(ioaddr + MTL_CHAN_INT_CTRL(chan));
+
+		if (status & MTL_RX_OVERFLOW_INT) {
+			/*  clear Interrupt */
+			writel(status | MTL_RX_OVERFLOW_INT,
+			       ioaddr + MTL_CHAN_INT_CTRL(chan));
+			ret = CORE_IRQ_MTL_RX_OVERFLOW;
+		}
+	}
+
+	return ret;
+}
+
 static int dwmac4_irq_status(struct mac_device_info *hw,
 			     struct stmmac_extra_stats *x)
 {
 	void __iomem *ioaddr = hw->pcsr;
-	u32 mtl_int_qx_status;
 	u32 intr_status;
 	int ret = 0;
 
@@ -440,20 +461,6 @@  static int dwmac4_irq_status(struct mac_device_info *hw,
 		x->irq_receive_pmt_irq_n++;
 	}
 
-	mtl_int_qx_status = readl(ioaddr + MTL_INT_STATUS);
-	/* Check MTL Interrupt: Currently only one queue is used: Q0. */
-	if (mtl_int_qx_status & MTL_INT_Q0) {
-		/* read Queue 0 Interrupt status */
-		u32 status = readl(ioaddr + MTL_CHAN_INT_CTRL(STMMAC_CHAN0));
-
-		if (status & MTL_RX_OVERFLOW_INT) {
-			/*  clear Interrupt */
-			writel(status | MTL_RX_OVERFLOW_INT,
-			       ioaddr + MTL_CHAN_INT_CTRL(STMMAC_CHAN0));
-			ret = CORE_IRQ_MTL_RX_OVERFLOW;
-		}
-	}
-
 	dwmac_pcs_isr(ioaddr, GMAC_PCS_BASE, intr_status, x);
 	if (intr_status & PCS_RGSMIIIS_IRQ)
 		dwmac4_phystatus(ioaddr, x);
@@ -555,6 +562,7 @@  static const struct stmmac_ops dwmac4_ops = {
 	.map_mtl_to_dma = dwmac4_map_mtl_dma,
 	.dump_regs = dwmac4_dump_regs,
 	.host_irq_status = dwmac4_irq_status,
+	.host_mtl_irq_status = dwmac4_irq_mtl_status,
 	.flow_ctrl = dwmac4_flow_ctrl,
 	.pmt = dwmac4_pmt,
 	.set_umac_addr = dwmac4_set_umac_addr,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d6c7b036..09380a2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2880,6 +2880,11 @@  static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
 	if ((priv->plat->has_gmac) || (priv->plat->has_gmac4)) {
 		int status = priv->hw->mac->host_irq_status(priv->hw,
 							    &priv->xstats);
+
+		if (priv->synopsys_id >= DWMAC_CORE_4_00)
+			status |= priv->hw->mac->host_mtl_irq_status(priv->hw,
+								STMMAC_CHAN0);
+
 		if (unlikely(status)) {
 			/* For LPI we need to save the tx status */
 			if (status & CORE_IRQ_TX_PATH_IN_LPI_MODE)