From: Esben Haabendal <esben@geanix.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Michal Simek <michal.simek@xilinx.com>,
YueHaibing <yuehaibing@huawei.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Yang Wei <yang.wei9@zte.com.cn>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 11/12] net: ll_temac: Allow configuration of IRQ coalescing
Date: Mon, 29 Apr 2019 10:34:21 +0200 [thread overview]
Message-ID: <20190429083422.4356-12-esben@geanix.com> (raw)
In-Reply-To: <20190429083422.4356-1-esben@geanix.com>
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 <esben@geanix.com>
---
drivers/net/ethernet/xilinx/ll_temac.h | 4 +++
drivers/net/ethernet/xilinx/ll_temac_main.c | 40 +++++++++++++++++++--------
include/linux/platform_data/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 5e7b8f0..5833f02 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,
@@ -1187,6 +1184,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) {
@@ -1210,6 +1214,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/platform_data/xilinx-ll-temac.h b/include/linux/platform_data/xilinx-ll-temac.h
index b0b8238..368530f 100644
--- a/include/linux/platform_data/xilinx-ll-temac.h
+++ b/include/linux/platform_data/xilinx-ll-temac.h
@@ -22,6 +22,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
next prev parent reply other threads:[~2019-04-29 8:35 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 7:32 [PATCH 00/12] net: ll_temac: x86_64 support Esben Haabendal
2019-04-26 7:32 ` [PATCH 01/12] net: ll_temac: Fix and simplify error handling by using devres functions Esben Haabendal
2019-04-26 7:32 ` [PATCH 02/12] net: ll_temac: Extend support to non-device-tree platforms Esben Haabendal
2019-04-26 13:58 ` Andrew Lunn
2019-04-26 7:32 ` [PATCH 03/12] net: ll_temac: Fix support for 64-bit platforms Esben Haabendal
2019-04-26 18:40 ` Jakub Kicinski
2019-04-26 20:59 ` Andrew Lunn
2019-04-26 21:08 ` Jakub Kicinski
2019-04-26 22:02 ` Andrew Lunn
2019-04-26 22:30 ` Jakub Kicinski
2019-04-27 8:49 ` Esben Haabendal
2019-04-26 7:32 ` [PATCH 04/12] net: ll_temac: Add support for non-native register endianness Esben Haabendal
2019-04-26 7:32 ` [PATCH 05/12] net: ll_temac: Fix support for little-endian platforms Esben Haabendal
2019-04-26 7:32 ` [PATCH 06/12] net: ll_temac: Allow use on x86 platforms Esben Haabendal
2019-04-26 14:05 ` Andrew Lunn
2019-04-26 7:32 ` [PATCH 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Esben Haabendal
2019-04-26 14:14 ` Andrew Lunn
2019-04-26 7:32 ` [PATCH 08/12] net: ll_temac: Fix iommu/swiotlb leak Esben Haabendal
2019-04-26 14:21 ` Andrew Lunn
2019-04-26 14:43 ` Robin Murphy
2019-04-26 15:37 ` Andrew Lunn
2019-04-26 7:32 ` [PATCH 09/12] net: ll_temac: Fix bug causing buffer descriptor overrun Esben Haabendal
2019-04-26 7:32 ` [PATCH 10/12] net: ll_temac: Replace bad usage of msleep() with usleep_range() Esben Haabendal
2019-04-26 14:01 ` Andrew Lunn
2019-04-26 7:32 ` [PATCH 11/12] net: ll_temac: Allow configuration of IRQ coalescing Esben Haabendal
2019-04-26 7:32 ` [PATCH 12/12] net: ll_temac: Enable DMA when ready, not before Esben Haabendal
2019-04-29 8:34 ` [PATCH 00/12] net: ll_temac: x86_64 support Esben Haabendal
2019-04-29 8:34 ` [PATCH 01/12] net: ll_temac: Fix and simplify error handling by using devres functions Esben Haabendal
2019-04-29 8:34 ` [PATCH 02/12] net: ll_temac: Extend support to non-device-tree platforms Esben Haabendal
2019-04-29 8:34 ` [PATCH 03/12] net: ll_temac: Fix support for 64-bit platforms Esben Haabendal
2019-04-29 22:06 ` Andrew Lunn
2019-04-29 8:34 ` [PATCH 04/12] net: ll_temac: Add support for non-native register endianness Esben Haabendal
2019-04-29 8:34 ` [PATCH 05/12] net: ll_temac: Fix support for little-endian platforms Esben Haabendal
2019-04-29 8:34 ` [PATCH 06/12] net: ll_temac: Allow use on x86 platforms Esben Haabendal
2019-04-29 22:06 ` Andrew Lunn
2019-04-29 8:34 ` [PATCH 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Esben Haabendal
2019-04-29 22:12 ` Andrew Lunn
2019-04-30 6:54 ` Esben Haabendal
2019-04-29 8:34 ` [PATCH 08/12] net: ll_temac: Fix iommu/swiotlb leak Esben Haabendal
2019-04-29 8:34 ` [PATCH 09/12] net: ll_temac: Fix bug causing buffer descriptor overrun Esben Haabendal
2019-04-29 8:34 ` [PATCH 10/12] net: ll_temac: Replace bad usage of msleep() with usleep_range() Esben Haabendal
2019-04-29 8:34 ` Esben Haabendal [this message]
2019-04-29 8:34 ` [PATCH 12/12] net: ll_temac: Enable DMA when ready, not before Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 00/12] net: ll_temac: x86_64 support Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 01/12] net: ll_temac: Fix and simplify error handling by using devres functions Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 02/12] net: ll_temac: Extend support to non-device-tree platforms Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 03/12] net: ll_temac: Fix support for 64-bit platforms Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 04/12] net: ll_temac: Add support for non-native register endianness Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 05/12] net: ll_temac: Fix support for little-endian platforms Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 06/12] net: ll_temac: Allow use on x86 platforms Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Esben Haabendal
2019-04-30 16:59 ` Andrew Lunn
2019-04-30 7:17 ` [PATCH v3 08/12] net: ll_temac: Fix iommu/swiotlb leak Esben Haabendal
2019-04-30 17:00 ` Andrew Lunn
2019-04-30 7:17 ` [PATCH v3 09/12] net: ll_temac: Fix bug causing buffer descriptor overrun Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 10/12] net: ll_temac: Replace bad usage of msleep() with usleep_range() Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 11/12] net: ll_temac: Allow configuration of IRQ coalescing Esben Haabendal
2019-04-30 7:17 ` [PATCH v3 12/12] net: ll_temac: Enable DMA when ready, not before Esben Haabendal
2019-05-01 18:33 ` [PATCH v3 00/12] net: ll_temac: x86_64 support David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190429083422.4356-12-esben@geanix.com \
--to=esben@geanix.com \
--cc=davem@davemloft.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=yang.wei9@zte.com.cn \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).