linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut
@ 2016-01-26  4:47 Shuyu Wei
  0 siblings, 0 replies; 4+ messages in thread
From: Shuyu Wei @ 2016-01-26  4:47 UTC (permalink / raw)
  To: caesar.upstream-Re5JQEeQqe8AvxtiuMwx3w,
	heiko-4mtYJXux2i+zQB+pC5nmwQ
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: mail.txt --]
[-- Type: text/plain, Size: 2310 bytes --]

Doing tx_clean() inside poll() may scramble the tx ring buffer if 
tx() is running. This will cause tx to stop working, which can be
reproduced by simultaneously downloading two large files at high speed.

Moving tx_clean() into tx() will prevent this. And tx interrupt is no
longer needed now.

Signed-off-by: Shuyu Wei <shuyu.w-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org>
---

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index abe1eab..34531b3 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -311,12 +311,10 @@ static int arc_emac_poll(struct napi_struct *napi, int budget)
 	struct arc_emac_priv *priv = netdev_priv(ndev);
 	unsigned int work_done;
 
-	arc_emac_tx_clean(ndev);
-
 	work_done = arc_emac_rx(ndev, budget);
 	if (work_done < budget) {
 		napi_complete(napi);
-		arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
+		arc_reg_or(priv, R_ENABLE, RXINT_MASK);
 	}
 
 	return work_done;
@@ -345,9 +343,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
 	/* Reset all flags except "MDIO complete" */
 	arc_reg_set(priv, R_STATUS, status);
 
-	if (status & (RXINT_MASK | TXINT_MASK)) {
+	if (status & RXINT_MASK) {
 		if (likely(napi_schedule_prep(&priv->napi))) {
-			arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
+			arc_reg_clr(priv, R_ENABLE, RXINT_MASK);
 			__napi_schedule(&priv->napi);
 		}
 	}
@@ -458,7 +456,7 @@ static int arc_emac_open(struct net_device *ndev)
 	arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
 
 	/* Enable interrupts */
-	arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
+	arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
 
 	/* Set CONTROL */
 	arc_reg_set(priv, R_CTRL,
@@ -529,7 +527,7 @@ static int arc_emac_stop(struct net_device *ndev)
 	netif_stop_queue(ndev);
 
 	/* Disable interrupts */
-	arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
+	arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
 
 	/* Disable EMAC */
 	arc_reg_clr(priv, R_CTRL, EN_MASK);
@@ -587,6 +585,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
 	__le32 *info = &priv->txbd[*txbd_curr].info;
 	dma_addr_t addr;
 
+	arc_emac_tx_clean(ndev);
+
 	if (skb_padto(skb, ETH_ZLEN))
 		return NETDEV_TX_OK;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut
@ 2016-02-19  6:59 Shuyu Wei
  2016-02-19 11:13 ` Michael Niewoehner
  0 siblings, 1 reply; 4+ messages in thread
From: Shuyu Wei @ 2016-02-19  6:59 UTC (permalink / raw)
  To: caesar.upstream-Re5JQEeQqe8AvxtiuMwx3w,
	heiko-4mtYJXux2i+zQB+pC5nmwQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	zhengxing-TNX95d0MmH7DzftRWevZcw
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: mail.txt --]
[-- Type: text/plain, Size: 2307 bytes --]

Doing tx_clean() inside poll() may scramble the tx ring buffer if 
tx() is running. This will cause tx to stop working, which can be
reproduced by simultaneously downloading two large files at high speed.

Moving tx_clean() into tx() will prevent this. And tx interrupt is no
longer needed now.

Signed-off-by: Shuyu Wei <sy.w-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org>
---

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index abe1eab..34531b3 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -311,12 +311,10 @@ static int arc_emac_poll(struct napi_struct *napi, int budget)
 	struct arc_emac_priv *priv = netdev_priv(ndev);
 	unsigned int work_done;
 
-	arc_emac_tx_clean(ndev);
-
 	work_done = arc_emac_rx(ndev, budget);
 	if (work_done < budget) {
 		napi_complete(napi);
-		arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
+		arc_reg_or(priv, R_ENABLE, RXINT_MASK);
 	}
 
 	return work_done;
@@ -345,9 +343,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
 	/* Reset all flags except "MDIO complete" */
 	arc_reg_set(priv, R_STATUS, status);
 
-	if (status & (RXINT_MASK | TXINT_MASK)) {
+	if (status & RXINT_MASK) {
 		if (likely(napi_schedule_prep(&priv->napi))) {
-			arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
+			arc_reg_clr(priv, R_ENABLE, RXINT_MASK);
 			__napi_schedule(&priv->napi);
 		}
 	}
@@ -458,7 +456,7 @@ static int arc_emac_open(struct net_device *ndev)
 	arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
 
 	/* Enable interrupts */
-	arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
+	arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
 
 	/* Set CONTROL */
 	arc_reg_set(priv, R_CTRL,
@@ -529,7 +527,7 @@ static int arc_emac_stop(struct net_device *ndev)
 	netif_stop_queue(ndev);
 
 	/* Disable interrupts */
-	arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
+	arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
 
 	/* Disable EMAC */
 	arc_reg_clr(priv, R_CTRL, EN_MASK);
@@ -587,6 +585,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
 	__le32 *info = &priv->txbd[*txbd_curr].info;
 	dma_addr_t addr;
 
+	arc_emac_tx_clean(ndev);
+
 	if (skb_padto(skb, ETH_ZLEN))
 		return NETDEV_TX_OK;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut
  2016-02-19  6:59 [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut Shuyu Wei
@ 2016-02-19 11:13 ` Michael Niewoehner
       [not found]   ` <85B47C95-B524-4A25-90C7-95AE614AB3A2-zzFNMPX9jIaDjmgdnaGrkw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Niewoehner @ 2016-02-19 11:13 UTC (permalink / raw)
  To: Shuyu Wei
  Cc: caesar.upstream, heiko, davem, zhengxing, netdev, linux-rockchip

Am 19.02.2016 um 07:59 schrieb Shuyu Wei <sy.w@outlook.com>:

> Doing tx_clean() inside poll() may scramble the tx ring buffer if 
> tx() is running. This will cause tx to stop working, which can be
> reproduced by simultaneously downloading two large files at high speed.
> 
> Moving tx_clean() into tx() will prevent this. And tx interrupt is no
> longer needed now.
> 
> Signed-off-by: Shuyu Wei <sy.w@outlook.com>

Tested-by: Michael Niewoehner <linux@mniewoehner.de>

> ---
> 
> diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
> index abe1eab..34531b3 100644
> --- a/drivers/net/ethernet/arc/emac_main.c
> +++ b/drivers/net/ethernet/arc/emac_main.c
> @@ -311,12 +311,10 @@ static int arc_emac_poll(struct napi_struct *napi, int budget)
> 	struct arc_emac_priv *priv = netdev_priv(ndev);
> 	unsigned int work_done;
> 
> -	arc_emac_tx_clean(ndev);
> -
> 	work_done = arc_emac_rx(ndev, budget);
> 	if (work_done < budget) {
> 		napi_complete(napi);
> -		arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
> +		arc_reg_or(priv, R_ENABLE, RXINT_MASK);
> 	}
> 
> 	return work_done;
> @@ -345,9 +343,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
> 	/* Reset all flags except "MDIO complete" */
> 	arc_reg_set(priv, R_STATUS, status);
> 
> -	if (status & (RXINT_MASK | TXINT_MASK)) {
> +	if (status & RXINT_MASK) {
> 		if (likely(napi_schedule_prep(&priv->napi))) {
> -			arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
> +			arc_reg_clr(priv, R_ENABLE, RXINT_MASK);
> 			__napi_schedule(&priv->napi);
> 		}
> 	}
> @@ -458,7 +456,7 @@ static int arc_emac_open(struct net_device *ndev)
> 	arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
> 
> 	/* Enable interrupts */
> -	arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
> +	arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
> 
> 	/* Set CONTROL */
> 	arc_reg_set(priv, R_CTRL,
> @@ -529,7 +527,7 @@ static int arc_emac_stop(struct net_device *ndev)
> 	netif_stop_queue(ndev);
> 
> 	/* Disable interrupts */
> -	arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
> +	arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
> 
> 	/* Disable EMAC */
> 	arc_reg_clr(priv, R_CTRL, EN_MASK);
> @@ -587,6 +585,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
> 	__le32 *info = &priv->txbd[*txbd_curr].info;
> 	dma_addr_t addr;
> 
> +	arc_emac_tx_clean(ndev);
> +
> 	if (skb_padto(skb, ETH_ZLEN))
> 		return NETDEV_TX_OK;
> 
> 
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut
       [not found]   ` <85B47C95-B524-4A25-90C7-95AE614AB3A2-zzFNMPX9jIaDjmgdnaGrkw@public.gmane.org>
@ 2016-02-19 13:59     ` Xing Zheng
  0 siblings, 0 replies; 4+ messages in thread
From: Xing Zheng @ 2016-02-19 13:59 UTC (permalink / raw)
  To: Michael Niewoehner
  Cc: caesar.upstream-Re5JQEeQqe8AvxtiuMwx3w,
	heiko-4mtYJXux2i+zQB+pC5nmwQ, zhengxing,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shuyu Wei,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On 2016年02月19日 19:13, Michael Niewoehner wrote:
> Am 19.02.2016 um 07:59 schrieb Shuyu Wei<sy.w@outlook.com>:
>
>> Doing tx_clean() inside poll() may scramble the tx ring buffer if
>> tx() is running. This will cause tx to stop working, which can be
>> reproduced by simultaneously downloading two large files at high speed.
>>
>> Moving tx_clean() into tx() will prevent this. And tx interrupt is no
>> longer needed now.
>>
>> Signed-off-by: Shuyu Wei<sy.w@outlook.com>
> Tested-by: Michael Niewoehner<linux@mniewoehner.de>
Tested-by: Xing Zheng <zhengxing@rock-chips.com>

Thanks.

-- 
- Xing Zheng



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-19 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19  6:59 [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut Shuyu Wei
2016-02-19 11:13 ` Michael Niewoehner
     [not found]   ` <85B47C95-B524-4A25-90C7-95AE614AB3A2-zzFNMPX9jIaDjmgdnaGrkw@public.gmane.org>
2016-02-19 13:59     ` Xing Zheng
  -- strict thread matches above, loose matches on Subject: below --
2016-01-26  4:47 Shuyu Wei

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).