* [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement
@ 2015-08-04 10:36 Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 1/3] drivers: net: cpsw: remove disable_irq/enable_irq as irq can be masked from cpsw itself Mugunthan V N
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Mugunthan V N @ 2015-08-04 10:36 UTC (permalink / raw)
To: netdev; +Cc: davem, Mugunthan V N
This patch series removes the irq controller disable interrupt and
adding a napi for tx event handling which improves the performance by
~180Mbps on dra7-evm
[ 5] local 192.168.10.116 port 5001 connected with 192.168.10.165 port 44176
[ 5] 0.0-60.0 sec 1.48 GBytes 210 Mbits/sec
[ 4] local 192.168.10.116 port 5001 connected with 192.168.10.165 port 33257
[ 4] 0.0-60.0 sec 2.71 GBytes 386 Mbits/sec
Changes from initial version:
* Added a patch to have napi only for first interface as there is
no use of having seperate napis for each interface as the
interrupt is shared by both interface and only one napi is
scheduled for each interrupt.
Mugunthan V N (3):
drivers: net: cpsw: remove disable_irq/enable_irq as irq can be
masked from cpsw itself
drivers: net: cpsw: dual_emac: simplify napi usage
drivers: net: cpsw: add separate napi for tx
drivers/net/ethernet/ti/cpsw.c | 83 ++++++++++++++++++------------------------
1 file changed, 35 insertions(+), 48 deletions(-)
--
2.5.0.234.gefc8a62
^ permalink raw reply [flat|nested] 5+ messages in thread
* [net-next PATCH v2 1/3] drivers: net: cpsw: remove disable_irq/enable_irq as irq can be masked from cpsw itself
2015-08-04 10:36 [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement Mugunthan V N
@ 2015-08-04 10:36 ` Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 2/3] drivers: net: cpsw: dual_emac: simplify napi usage Mugunthan V N
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mugunthan V N @ 2015-08-04 10:36 UTC (permalink / raw)
To: netdev; +Cc: davem, Mugunthan V N
CPSW interrupts can be disabled by masking CPSW interrupts and
clearing interrupt by writing appropriate EOI. So removing all
disable_irq/enable_irq as discussed in [1]
[1] http://patchwork.ozlabs.org/patch/492741/
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
drivers/net/ethernet/ti/cpsw.c | 27 ++-------------------------
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index d155bf2..d68d759 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -389,7 +389,6 @@ struct cpsw_priv {
/* snapshot of IRQ numbers */
u32 irqs_table[4];
u32 num_irqs;
- bool irq_enabled;
struct cpts *cpts;
u32 emac_port;
};
@@ -767,12 +766,7 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id)
struct cpsw_priv *priv = dev_id;
cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
-
- cpsw_intr_disable(priv);
- if (priv->irq_enabled == true) {
- disable_irq_nosync(priv->irqs_table[0]);
- priv->irq_enabled = false;
- }
+ writel(0, &priv->wr_regs->rx_en);
if (netif_running(priv->ndev)) {
napi_schedule(&priv->napi);
@@ -797,15 +791,8 @@ static int cpsw_poll(struct napi_struct *napi, int budget)
num_rx = cpdma_chan_process(priv->rxch, budget);
if (num_rx < budget) {
- struct cpsw_priv *prim_cpsw;
-
napi_complete(napi);
- cpsw_intr_enable(priv);
- prim_cpsw = cpsw_get_slave_priv(priv, 0);
- if (prim_cpsw->irq_enabled == false) {
- prim_cpsw->irq_enabled = true;
- enable_irq(priv->irqs_table[0]);
- }
+ writel(0xff, &priv->wr_regs->rx_en);
}
if (num_rx)
@@ -1230,7 +1217,6 @@ static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv)
static int cpsw_ndo_open(struct net_device *ndev)
{
struct cpsw_priv *priv = netdev_priv(ndev);
- struct cpsw_priv *prim_cpsw;
int i, ret;
u32 reg;
@@ -1315,14 +1301,6 @@ static int cpsw_ndo_open(struct net_device *ndev)
cpdma_ctlr_start(priv->dma);
cpsw_intr_enable(priv);
- prim_cpsw = cpsw_get_slave_priv(priv, 0);
- if (prim_cpsw->irq_enabled == false) {
- if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) {
- prim_cpsw->irq_enabled = true;
- enable_irq(prim_cpsw->irqs_table[0]);
- }
- }
-
if (priv->data.dual_emac)
priv->slaves[priv->emac_port].open_stat = true;
return 0;
@@ -2169,7 +2147,6 @@ static int cpsw_probe(struct platform_device *pdev)
priv->msg_enable = netif_msg_init(debug_level, CPSW_DEBUG);
priv->rx_packet_max = max(rx_packet_max, 128);
priv->cpts = devm_kzalloc(&pdev->dev, sizeof(struct cpts), GFP_KERNEL);
- priv->irq_enabled = true;
if (!priv->cpts) {
dev_err(&pdev->dev, "error allocating cpts\n");
ret = -ENOMEM;
--
2.5.0.234.gefc8a62
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [net-next PATCH v2 2/3] drivers: net: cpsw: dual_emac: simplify napi usage
2015-08-04 10:36 [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 1/3] drivers: net: cpsw: remove disable_irq/enable_irq as irq can be masked from cpsw itself Mugunthan V N
@ 2015-08-04 10:36 ` Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 3/3] drivers: net: cpsw: add separate napi for tx Mugunthan V N
2015-08-07 4:59 ` [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Mugunthan V N @ 2015-08-04 10:36 UTC (permalink / raw)
To: netdev; +Cc: davem, Mugunthan V N
Since interrupt is shared between the two ethernet interface and
in isr only one napi is scheduled at an instance so having two
napis doesn't make any difference. So making napi also as a
common resource for the dual ethernet interfaces.
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
drivers/net/ethernet/ti/cpsw.c | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index d68d759..1d923e8 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -768,20 +768,8 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id)
cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
writel(0, &priv->wr_regs->rx_en);
- if (netif_running(priv->ndev)) {
- napi_schedule(&priv->napi);
- return IRQ_HANDLED;
- }
-
- priv = cpsw_get_slave_priv(priv, 1);
- if (!priv)
- return IRQ_NONE;
-
- if (netif_running(priv->ndev)) {
- napi_schedule(&priv->napi);
- return IRQ_HANDLED;
- }
- return IRQ_NONE;
+ napi_schedule(&priv->napi);
+ return IRQ_HANDLED;
}
static int cpsw_poll(struct napi_struct *napi, int budget)
@@ -1246,6 +1234,8 @@ static int cpsw_ndo_open(struct net_device *ndev)
ALE_ALL_PORTS << priv->host_port, 0, 0);
if (!cpsw_common_res_usage_state(priv)) {
+ struct cpsw_priv *priv_sl0 = cpsw_get_slave_priv(priv, 0);
+
/* setup tx dma to fixed prio and zero offset */
cpdma_control_set(priv->dma, CPDMA_TX_PRIO_FIXED, 1);
cpdma_control_set(priv->dma, CPDMA_RX_BUFFER_OFFSET, 0);
@@ -1259,6 +1249,8 @@ static int cpsw_ndo_open(struct net_device *ndev)
/* Enable internal fifo flow control */
writel(0x7, &priv->regs->flow_control);
+ napi_enable(&priv_sl0->napi);
+
if (WARN_ON(!priv->data.rx_descs))
priv->data.rx_descs = 128;
@@ -1297,7 +1289,6 @@ static int cpsw_ndo_open(struct net_device *ndev)
cpsw_set_coalesce(ndev, &coal);
}
- napi_enable(&priv->napi);
cpdma_ctlr_start(priv->dma);
cpsw_intr_enable(priv);
@@ -1319,10 +1310,12 @@ static int cpsw_ndo_stop(struct net_device *ndev)
cpsw_info(priv, ifdown, "shutting down cpsw device\n");
netif_stop_queue(priv->ndev);
- napi_disable(&priv->napi);
netif_carrier_off(priv->ndev);
if (cpsw_common_res_usage_state(priv) <= 1) {
+ struct cpsw_priv *priv_sl0 = cpsw_get_slave_priv(priv, 0);
+
+ napi_disable(&priv_sl0->napi);
cpts_unregister(priv->cpts);
cpsw_intr_disable(priv);
cpdma_ctlr_stop(priv->dma);
@@ -2105,7 +2098,6 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev,
ndev->netdev_ops = &cpsw_netdev_ops;
ndev->ethtool_ops = &cpsw_ethtool_ops;
- netif_napi_add(ndev, &priv_sl2->napi, cpsw_poll, CPSW_POLL_WEIGHT);
/* register the network device */
SET_NETDEV_DEV(ndev, &pdev->dev);
--
2.5.0.234.gefc8a62
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [net-next PATCH v2 3/3] drivers: net: cpsw: add separate napi for tx
2015-08-04 10:36 [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 1/3] drivers: net: cpsw: remove disable_irq/enable_irq as irq can be masked from cpsw itself Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 2/3] drivers: net: cpsw: dual_emac: simplify napi usage Mugunthan V N
@ 2015-08-04 10:36 ` Mugunthan V N
2015-08-07 4:59 ` [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Mugunthan V N @ 2015-08-04 10:36 UTC (permalink / raw)
To: netdev; +Cc: davem, Mugunthan V N
Instead of processing tx events in isr adding separate napi for
tx which improves performance by ~180Mbps with
omap2plus_defconfig on DRA74x platform. Also cleaning up rx napis
by renaming to napi_rx for better understanding the code.
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
drivers/net/ethernet/ti/cpsw.c | 44 +++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1d923e8..3b81b39 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -365,7 +365,8 @@ struct cpsw_priv {
spinlock_t lock;
struct platform_device *pdev;
struct net_device *ndev;
- struct napi_struct napi;
+ struct napi_struct napi_rx;
+ struct napi_struct napi_tx;
struct device *dev;
struct cpsw_platform_data data;
struct cpsw_ss_regs __iomem *regs;
@@ -751,13 +752,10 @@ static irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id)
{
struct cpsw_priv *priv = dev_id;
+ writel(0, &priv->wr_regs->tx_en);
cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
- cpdma_chan_process(priv->txch, 128);
-
- priv = cpsw_get_slave_priv(priv, 1);
- if (priv)
- cpdma_chan_process(priv->txch, 128);
+ napi_schedule(&priv->napi_tx);
return IRQ_HANDLED;
}
@@ -768,18 +766,35 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id)
cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
writel(0, &priv->wr_regs->rx_en);
- napi_schedule(&priv->napi);
+ napi_schedule(&priv->napi_rx);
return IRQ_HANDLED;
}
-static int cpsw_poll(struct napi_struct *napi, int budget)
+static int cpsw_tx_poll(struct napi_struct *napi_tx, int budget)
+{
+ struct cpsw_priv *priv = napi_to_priv(napi_tx);
+ int num_tx;
+
+ num_tx = cpdma_chan_process(priv->txch, budget);
+ if (num_tx < budget) {
+ napi_complete(napi_tx);
+ writel(0xff, &priv->wr_regs->tx_en);
+ }
+
+ if (num_tx)
+ cpsw_dbg(priv, intr, "poll %d tx pkts\n", num_tx);
+
+ return num_tx;
+}
+
+static int cpsw_rx_poll(struct napi_struct *napi_rx, int budget)
{
- struct cpsw_priv *priv = napi_to_priv(napi);
+ struct cpsw_priv *priv = napi_to_priv(napi_rx);
int num_rx;
num_rx = cpdma_chan_process(priv->rxch, budget);
if (num_rx < budget) {
- napi_complete(napi);
+ napi_complete(napi_rx);
writel(0xff, &priv->wr_regs->rx_en);
}
@@ -1249,7 +1264,8 @@ static int cpsw_ndo_open(struct net_device *ndev)
/* Enable internal fifo flow control */
writel(0x7, &priv->regs->flow_control);
- napi_enable(&priv_sl0->napi);
+ napi_enable(&priv_sl0->napi_rx);
+ napi_enable(&priv_sl0->napi_tx);
if (WARN_ON(!priv->data.rx_descs))
priv->data.rx_descs = 128;
@@ -1315,7 +1331,8 @@ static int cpsw_ndo_stop(struct net_device *ndev)
if (cpsw_common_res_usage_state(priv) <= 1) {
struct cpsw_priv *priv_sl0 = cpsw_get_slave_priv(priv, 0);
- napi_disable(&priv_sl0->napi);
+ napi_disable(&priv_sl0->napi_rx);
+ napi_disable(&priv_sl0->napi_tx);
cpts_unregister(priv->cpts);
cpsw_intr_disable(priv);
cpdma_ctlr_stop(priv->dma);
@@ -2349,7 +2366,8 @@ static int cpsw_probe(struct platform_device *pdev)
ndev->netdev_ops = &cpsw_netdev_ops;
ndev->ethtool_ops = &cpsw_ethtool_ops;
- netif_napi_add(ndev, &priv->napi, cpsw_poll, CPSW_POLL_WEIGHT);
+ netif_napi_add(ndev, &priv->napi_rx, cpsw_rx_poll, CPSW_POLL_WEIGHT);
+ netif_napi_add(ndev, &priv->napi_tx, cpsw_tx_poll, CPSW_POLL_WEIGHT);
/* register the network device */
SET_NETDEV_DEV(ndev, &pdev->dev);
--
2.5.0.234.gefc8a62
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement
2015-08-04 10:36 [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement Mugunthan V N
` (2 preceding siblings ...)
2015-08-04 10:36 ` [net-next PATCH v2 3/3] drivers: net: cpsw: add separate napi for tx Mugunthan V N
@ 2015-08-07 4:59 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-08-07 4:59 UTC (permalink / raw)
To: mugunthanvnm; +Cc: netdev
From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Tue, 4 Aug 2015 16:06:17 +0530
> This patch series removes the irq controller disable interrupt and
> adding a napi for tx event handling which improves the performance by
> ~180Mbps on dra7-evm
>
> [ 5] local 192.168.10.116 port 5001 connected with 192.168.10.165 port 44176
> [ 5] 0.0-60.0 sec 1.48 GBytes 210 Mbits/sec
> [ 4] local 192.168.10.116 port 5001 connected with 192.168.10.165 port 33257
> [ 4] 0.0-60.0 sec 2.71 GBytes 386 Mbits/sec
>
> Changes from initial version:
> * Added a patch to have napi only for first interface as there is
> no use of having seperate napis for each interface as the
> interrupt is shared by both interface and only one napi is
> scheduled for each interrupt.
Series applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-07 4:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04 10:36 [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 1/3] drivers: net: cpsw: remove disable_irq/enable_irq as irq can be masked from cpsw itself Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 2/3] drivers: net: cpsw: dual_emac: simplify napi usage Mugunthan V N
2015-08-04 10:36 ` [net-next PATCH v2 3/3] drivers: net: cpsw: add separate napi for tx Mugunthan V N
2015-08-07 4:59 ` [net-next PATCH v2 0/3] CPSW interrupt handling cleanup and performance improvement David Miller
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).