diff mbox

[v5,1/1,net] net: fec: fix kernel oops when plug/unplug cable many times

Message ID CAOMZO5DK6giehS9HpmXMzRKiDvvtEPLxvyenMQaBdrWS8WWVxw@mail.gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Fabio Estevam May 14, 2013, 7:40 p.m. UTC
Hi Eric,

On Tue, May 14, 2013 at 4:30 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Thats because netif_tx_lock_bh() should be used.

Thanks for your advise.

> And btw, the order of the unlocks should probably be reversed :
>
>               netif_tx_unlock_bh(ndev);
>               netif_wake_queue(ndev);
>               napi_enable(&fep->napi);
>               netif_device_attach(ndev);

I tried the change below and do not see the original warning on mx28:

Could someone try it on mx6, please?

If it works I can submit the patch tomorrow.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Zhi Li May 15, 2013, 1:56 a.m. UTC | #1
2013/5/15 Fabio Estevam <festevam@gmail.com>:
> Hi Eric,
>
> On Tue, May 14, 2013 at 4:30 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>> Thats because netif_tx_lock_bh() should be used.
>
> Thanks for your advise.
>
>> And btw, the order of the unlocks should probably be reversed :
>>
>>               netif_tx_unlock_bh(ndev);
>>               netif_wake_queue(ndev);
>>               napi_enable(&fep->napi);
>>               netif_device_attach(ndev);
>
> I tried the change below and do not see the original warning on mx28:
>
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -451,7 +451,7 @@ fec_restart(struct net_device *ndev, int duplex)
>                 netif_device_detach(ndev);
>                 napi_disable(&fep->napi);
>                 netif_stop_queue(ndev);
> -               netif_tx_lock(ndev);
> +               netif_tx_lock_bh(ndev);
>         }
>
>         /* Whack a reset.  We should wait for this. */
> @@ -616,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex)
>         writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
>
>         if (netif_running(ndev)) {
> -               netif_device_attach(ndev);
> -               napi_enable(&fep->napi);
> +               netif_tx_unlock_bh(ndev);
>                 netif_wake_queue(ndev);
> -               netif_tx_unlock(ndev);
> +               napi_enable(&fep->napi);
> +               netif_device_attach(ndev);
>         }
>  }
>
> Could someone try it on mx6, please?
>
> If it works I can submit the patch tomorrow.

I also find the same solution yesterdays. I tested on MX6. Shawn
tested on MX6 and MX28.
You can submit patch.

best regards
Frank Li
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Fabio Estevam May 15, 2013, 2:42 a.m. UTC | #2
On Tue, May 14, 2013 at 10:56 PM, Frank Li <lznuaa@gmail.com> wrote:

> I also find the same solution yesterdays. I tested on MX6. Shawn
> tested on MX6 and MX28.
> You can submit patch.

Thanks, Frank. Will submit it tomorrow.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -451,7 +451,7 @@  fec_restart(struct net_device *ndev, int duplex)
                netif_device_detach(ndev);
                napi_disable(&fep->napi);
                netif_stop_queue(ndev);
-               netif_tx_lock(ndev);
+               netif_tx_lock_bh(ndev);
        }

        /* Whack a reset.  We should wait for this. */
@@ -616,10 +616,10 @@  fec_restart(struct net_device *ndev, int duplex)
        writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);

        if (netif_running(ndev)) {
-               netif_device_attach(ndev);
-               napi_enable(&fep->napi);
+               netif_tx_unlock_bh(ndev);
                netif_wake_queue(ndev);
-               netif_tx_unlock(ndev);
+               napi_enable(&fep->napi);
+               netif_device_attach(ndev);
        }
 }