Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp343973yba; Fri, 26 Apr 2019 00:41:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyh4J4kcOhmkPcCfAJQdq/Zohqpv4lyeTdN3ZStp7oqfsduNIkWmo/R3OnSmkca+mWo8pAg X-Received: by 2002:a65:6658:: with SMTP id z24mr12823027pgv.323.1556264486495; Fri, 26 Apr 2019 00:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556264486; cv=none; d=google.com; s=arc-20160816; b=KcSIE32dcnDePD82SQDmkn4MKXv0Qxu09dKylDyR6eUUUaT5UVuUvLlqw3VTv3XbTW Gi0FWjQqRxpQ4O3wKKJ4Thxvdw0zQ+C/m5Hqh38HwYYG+DkWjPJpA6023rBsshI2HUEJ 3pBhLfHKathhGIuM9fJeNmvXR/dmxWgeF73A1Mpe3vZBzdt6Xj+2utfSnhKQvHQs5R0J e1HcLJ++KTA0biUCWvtdfVkvyyMIPKn7lG7KZGUNXn3VhQDtoZ942hEilSupfyB4dP3J I/I/95/Y2A9eE4wiZ0U+zSsUG8iHFGi4KwHZotyZ4zsy72zEl7r6QdJeAHo8hLYeq5rL Vuwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8DQ/UMTsL6mbd0WSalkXc51/zSOYXZ0as37ZzLJRGJQ=; b=VOdZO4flGX6NBK1exJOGpeRn15mBqHRZjxOHI/Pag4Q/firAkdWYcsRk3cCf+Jdl7T DUbA42W7lYytX+tmvsIBVAxftlah7IuO8FZqm696RzWdcIsUEQOx7S1EDo4aVizB3lby RyMT2tLqnw1JD9r2rMVSj1It7MBPdcVtgriLltgvbIJVgaU1eGkdKInVYRJ2uLK1l8uB /jJodPvwjogPzmf/MVjfGKxJ3DEPF90rX2C3ny1S5Wxlct9r+QrYKd0qhvggF7syJnUd gvrAI8BdJd7hy+WcmWUt+j9G9WPBQw9VzV+vZcRQ0zw6Owqq3XlHFi/D3busN0aCaII0 orUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=PllH1iuU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=geanix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si24991811pfn.57.2019.04.26.00.41.11; Fri, 26 Apr 2019 00:41:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=PllH1iuU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=geanix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726403AbfDZHkN (ORCPT + 99 others); Fri, 26 Apr 2019 03:40:13 -0400 Received: from first.geanix.com ([116.203.34.67]:59692 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbfDZHkM (ORCPT ); Fri, 26 Apr 2019 03:40:12 -0400 Received: from localhost (unknown [193.163.1.7]) by first.geanix.com (Postfix) with ESMTPSA id 67B27308E6E; Fri, 26 Apr 2019 07:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1556263929; bh=WAkncToduk4yoBrBXENYCJGMDt9o4OJTuagsV08z/R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PllH1iuUTi47rbMwaVhwZKeGC/CslkQjH8rfY0sOufq7Aa2SXLaQW2B+oofwIFwr7 /GbNbkVaB/i7G9M1rBKZjEKzB6DW/+NuLnNXHZUGjp5FyuRWeH9EgA1J/rVZqenMf5 AsN0ayL3HTr5l6GE0Vp233WS5Av1E0WRfy/9CO4Yt+gDBMJWkafKMBvUntxcMLJ4or L0+BwY5IJHXeSpCFpSckFpjCOZddtQYSRBd/k9BR85o4zeNEfBRe/M/lXX5ZdJvJr6 mSW4X8s6Bg2G5MUs79ko5g71Wvm+JsSgXRE/vj9/Z4l5QxKf+gmdO6RiAxVquGqdTd KqjGSwUwbxWcQ== From: Esben Haabendal To: netdev@vger.kernel.org Cc: "David S. Miller" , Michal Simek , Yang Wei , YueHaibing , Luis Chamberlain , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/12] net: ll_temac: Allow configuration of IRQ coalescing Date: Fri, 26 Apr 2019 09:32:30 +0200 Message-Id: <20190426073231.4008-12-esben@geanix.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190426073231.4008-1-esben@geanix.com> References: <20190426073231.4008-1-esben@geanix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on 3e0c63300934 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allows custom setup of IRQ coalescing for platforms using legacy platform_device. The irq timeout and count parameters can be used for tuning cpu load vs. latency. I have maintained the 0x00000400 bit in TX_CHNL_CTRL. It is specified as unused in the documentation I have available. It does not make any difference in the hardware I have available, so it is left in to not risk breaking other platforms where it might be used. Signed-off-by: Esben Haabendal --- drivers/net/ethernet/xilinx/ll_temac.h | 4 +++ drivers/net/ethernet/xilinx/ll_temac_main.c | 40 ++++++++++++++++++++--------- include/linux/xilinx_ll_temac.h | 5 ++++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/xilinx/ll_temac.h b/drivers/net/ethernet/xilinx/ll_temac.h index 990f9ed..1aeda08 100644 --- a/drivers/net/ethernet/xilinx/ll_temac.h +++ b/drivers/net/ethernet/xilinx/ll_temac.h @@ -375,6 +375,10 @@ struct temac_local { int tx_bd_next; int tx_bd_tail; int rx_bd_ci; + + /* DMA channel control setup */ + u32 tx_chnl_ctrl; + u32 rx_chnl_ctrl; }; /* Wrappers for temac_ior()/temac_iow() function pointers above */ diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index a5ec8ba..a30ac11 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -306,18 +306,15 @@ static int temac_dma_bd_init(struct net_device *ndev) lp->rx_bd_v[i].app0 = cpu_to_be32(STS_CTRL_APP0_IRQONEND); } - lp->dma_out(lp, TX_CHNL_CTRL, 0x10220400 | - CHNL_CTRL_IRQ_EN | - CHNL_CTRL_IRQ_DLY_EN | - CHNL_CTRL_IRQ_COAL_EN); - /* 0x10220483 */ - /* 0x00100483 */ - lp->dma_out(lp, RX_CHNL_CTRL, 0xff070000 | - CHNL_CTRL_IRQ_EN | - CHNL_CTRL_IRQ_DLY_EN | - CHNL_CTRL_IRQ_COAL_EN | - CHNL_CTRL_IRQ_IOE); - /* 0xff010283 */ + /* Configure DMA channel (irq setup) */ + lp->dma_out(lp, TX_CHNL_CTRL, lp->tx_chnl_ctrl | + 0x00000400 | // Use 1 Bit Wide Counters. Currently Not Used! + CHNL_CTRL_IRQ_EN | CHNL_CTRL_IRQ_ERR_EN | + CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN); + lp->dma_out(lp, RX_CHNL_CTRL, lp->rx_chnl_ctrl | + CHNL_CTRL_IRQ_IOE | + CHNL_CTRL_IRQ_EN | CHNL_CTRL_IRQ_ERR_EN | + CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN); lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p); lp->dma_out(lp, RX_TAILDESC_PTR, @@ -1186,6 +1183,13 @@ static int temac_probe(struct platform_device *pdev) lp->rx_irq = irq_of_parse_and_map(dma_np, 0); lp->tx_irq = irq_of_parse_and_map(dma_np, 1); + /* Use defaults for IRQ delay/coalescing setup. These + * are configuration values, so does not belong in + * device-tree. + */ + lp->tx_chnl_ctrl = 0x10220000; + lp->rx_chnl_ctrl = 0xff070000; + /* Finished with the DMA node; drop the reference */ of_node_put(dma_np); } else if (pdata) { @@ -1209,6 +1213,18 @@ static int temac_probe(struct platform_device *pdev) /* Get DMA RX and TX interrupts */ lp->rx_irq = platform_get_irq(pdev, 0); lp->tx_irq = platform_get_irq(pdev, 1); + + /* IRQ delay/coalescing setup */ + if (pdata->tx_irq_timeout || pdata->tx_irq_count) + lp->tx_chnl_ctrl = (pdata->tx_irq_timeout << 24) | + (pdata->tx_irq_count << 16); + else + lp->tx_chnl_ctrl = 0x10220000; + if (pdata->rx_irq_timeout || pdata->rx_irq_count) + lp->rx_chnl_ctrl = (pdata->rx_irq_timeout << 24) | + (pdata->rx_irq_count << 16); + else + lp->rx_chnl_ctrl = 0xff070000; } /* Error handle returned DMA RX and TX interrupts */ diff --git a/include/linux/xilinx_ll_temac.h b/include/linux/xilinx_ll_temac.h index c4c66be..e8d4c09 100644 --- a/include/linux/xilinx_ll_temac.h +++ b/include/linux/xilinx_ll_temac.h @@ -21,6 +21,11 @@ struct ll_temac_platform_data { * they share the same DCR bus bridge. */ struct mutex *indirect_mutex; + /* DMA channel control setup */ + u8 tx_irq_timeout; /* TX Interrupt Delay Time-out */ + u8 tx_irq_count; /* TX Interrupt Coalescing Threshold Count */ + u8 rx_irq_timeout; /* RX Interrupt Delay Time-out */ + u8 rx_irq_count; /* RX Interrupt Coalescing Threshold Count */ }; #endif /* __LINUX_XILINX_LL_TEMAC_H */ -- 2.4.11