All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable
@ 2014-03-06  9:29 Stefan Wahren
  2014-03-06 10:30 ` Fabio Estevam
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Wahren @ 2014-03-06  9:29 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-arm-kernel, Shawn Guo, Fabio Estevam

Hello,

i'm using a i.MX28 custom board (I2SE Duckbill) with 2 different 
Ethernet interfaces. Both interfaces should be used as bridge using 
bridge utils. One Ethernet interface is the buildin fec and the other is 
connect by spi. The board runs under Linux mainline 3.10. But the 
following problem still occurs on 3.14-rc4.

Here is the problem, if i disconnect and reconnect the Ethernet cable on 
the buildin fec (eth0), the bridge says the port comes up, but it 
doesn't work. After that any traffic to the fec is okay, but traffic 
"through" the bridge is lost. But i expect no traffic is lost, after 
reconnect the network cable.

If i reset the board without disconnecting the cables, the traffic 
"through" the bridge works. If i force the promiscuous mode on the fec 
(eth0) after the reconnect, the bridge works too:

ifconfig eth0 promisc

After that, i made some research and probably found the cause of the 
problem. In the case that the bridge works (link state connected since 
reboot) the register HW_ENET_MAC_RCR of the i.MX28 returns 0x45EE011C 
(PROM=1, promiscuous mode on). Then I disconnect the ethernet cable and 
reconnect it. After that the register returns 0x45EE0114 (PROM=0, 
promiscuous mode off) and the bridge doesn't work.

Based on this information, i created a patch against Linux 3.10. I'm not 
sure it's a good solution but it works. After a fec reset all register 
values of HW_ENET_MAC_RCR must be restored, but fec_restart do not 
handle them at all. So set_multicast_list is called after fec_restart to 
restore the promiscuous mode of the fec.

diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index d48099f..cb6b66e 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1063,6 +1063,8 @@ static void fec_get_mac(struct net_device *ndev)

  /* 
------------------------------------------------------------------------- */

+static void set_multicast_list(struct net_device *ndev);
+
  /*
   * Phy section
   */
@@ -1093,8 +1095,10 @@ static void fec_enet_adjust_link(struct 
net_device *ndev)
          }

          /* if any of the above changed restart the FEC */
-        if (status_change)
+        if (status_change) {
              fec_restart(ndev, phy_dev->duplex);
+            set_multicast_list(ndev);
+        }
      } else {
          if (fep->link) {
              fec_stop(ndev);

Is this solution correct?

Do you need more information?

Best regards
Stefan Wahren

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

* Re: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable
  2014-03-06  9:29 [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable Stefan Wahren
@ 2014-03-06 10:30 ` Fabio Estevam
  2014-03-06 17:43   ` Frank Li
  0 siblings, 1 reply; 11+ messages in thread
From: Fabio Estevam @ 2014-03-06 10:30 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: David Miller, netdev, linux-arm-kernel, Shawn Guo, Fabio Estevam,
	Frank Li, Duan Fugang-B38611, Sascha Hauer

Adding some more folks on Cc.

On Thu, Mar 6, 2014 at 6:29 AM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> Hello,
>
> i'm using a i.MX28 custom board (I2SE Duckbill) with 2 different Ethernet
> interfaces. Both interfaces should be used as bridge using bridge utils. One
> Ethernet interface is the buildin fec and the other is connect by spi. The
> board runs under Linux mainline 3.10. But the following problem still occurs
> on 3.14-rc4.
>
> Here is the problem, if i disconnect and reconnect the Ethernet cable on the
> buildin fec (eth0), the bridge says the port comes up, but it doesn't work.
> After that any traffic to the fec is okay, but traffic "through" the bridge
> is lost. But i expect no traffic is lost, after reconnect the network cable.
>
> If i reset the board without disconnecting the cables, the traffic "through"
> the bridge works. If i force the promiscuous mode on the fec (eth0) after
> the reconnect, the bridge works too:
>
> ifconfig eth0 promisc
>
> After that, i made some research and probably found the cause of the
> problem. In the case that the bridge works (link state connected since
> reboot) the register HW_ENET_MAC_RCR of the i.MX28 returns 0x45EE011C
> (PROM=1, promiscuous mode on). Then I disconnect the ethernet cable and
> reconnect it. After that the register returns 0x45EE0114 (PROM=0,
> promiscuous mode off) and the bridge doesn't work.
>
> Based on this information, i created a patch against Linux 3.10. I'm not
> sure it's a good solution but it works. After a fec reset all register
> values of HW_ENET_MAC_RCR must be restored, but fec_restart do not handle
> them at all. So set_multicast_list is called after fec_restart to restore
> the promiscuous mode of the fec.
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index d48099f..cb6b66e 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1063,6 +1063,8 @@ static void fec_get_mac(struct net_device *ndev)
>
>  /*
> ------------------------------------------------------------------------- */
>
> +static void set_multicast_list(struct net_device *ndev);
> +
>  /*
>   * Phy section
>   */
> @@ -1093,8 +1095,10 @@ static void fec_enet_adjust_link(struct net_device
> *ndev)
>          }
>
>          /* if any of the above changed restart the FEC */
> -        if (status_change)
> +        if (status_change) {
>              fec_restart(ndev, phy_dev->duplex);
> +            set_multicast_list(ndev);
> +        }
>      } else {
>          if (fep->link) {
>              fec_stop(ndev);
>
> Is this solution correct?
>
> Do you need more information?
>
> Best regards
> Stefan Wahren
> --
> 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

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

* Re: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable
  2014-03-06 10:30 ` Fabio Estevam
@ 2014-03-06 17:43   ` Frank Li
  2014-03-07  2:10     ` fugang.duan
  0 siblings, 1 reply; 11+ messages in thread
From: Frank Li @ 2014-03-06 17:43 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Stefan Wahren, David Miller, netdev, linux-arm-kernel, Shawn Guo,
	Fabio Estevam, Frank Li, Duan Fugang-B38611, Sascha Hauer

On Thu, Mar 6, 2014 at 4:30 AM, Fabio Estevam <festevam@gmail.com> wrote:
> Adding some more folks on Cc.
>
> On Thu, Mar 6, 2014 at 6:29 AM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
>> Hello,
>>
>> i'm using a i.MX28 custom board (I2SE Duckbill) with 2 different Ethernet
>> interfaces. Both interfaces should be used as bridge using bridge utils. One
>> Ethernet interface is the buildin fec and the other is connect by spi. The
>> board runs under Linux mainline 3.10. But the following problem still occurs
>> on 3.14-rc4.
>>
>> Here is the problem, if i disconnect and reconnect the Ethernet cable on the
>> buildin fec (eth0), the bridge says the port comes up, but it doesn't work.
>> After that any traffic to the fec is okay, but traffic "through" the bridge
>> is lost. But i expect no traffic is lost, after reconnect the network cable.
>>
>> If i reset the board without disconnecting the cables, the traffic "through"
>> the bridge works. If i force the promiscuous mode on the fec (eth0) after
>> the reconnect, the bridge works too:
>>
>> ifconfig eth0 promisc
>>
>> After that, i made some research and probably found the cause of the
>> problem. In the case that the bridge works (link state connected since
>> reboot) the register HW_ENET_MAC_RCR of the i.MX28 returns 0x45EE011C
>> (PROM=1, promiscuous mode on). Then I disconnect the ethernet cable and
>> reconnect it. After that the register returns 0x45EE0114 (PROM=0,
>> promiscuous mode off) and the bridge doesn't work.
>>
>> Based on this information, i created a patch against Linux 3.10. I'm not
>> sure it's a good solution but it works. After a fec reset all register
>> values of HW_ENET_MAC_RCR must be restored, but fec_restart do not handle
>> them at all. So set_multicast_list is called after fec_restart to restore
>> the promiscuous mode of the fec.
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c
>> index d48099f..cb6b66e 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -1063,6 +1063,8 @@ static void fec_get_mac(struct net_device *ndev)
>>
>>  /*
>> ------------------------------------------------------------------------- */
>>
>> +static void set_multicast_list(struct net_device *ndev);
>> +
>>  /*
>>   * Phy section
>>   */
>> @@ -1093,8 +1095,10 @@ static void fec_enet_adjust_link(struct net_device
>> *ndev)
>>          }
>>
>>          /* if any of the above changed restart the FEC */
>> -        if (status_change)
>> +        if (status_change) {
>>              fec_restart(ndev, phy_dev->duplex);
>> +            set_multicast_list(ndev);
>> +        }
>>      } else {
>>          if (fep->link) {
>>              fec_stop(ndev);
>>
>> Is this solution correct?

There are many places to call fec_resart.
I suggest call set_multicase_list in fec_restart function.

>>
>> Do you need more information?
>>
>> Best regards
>> Stefan Wahren
>> --
>> 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
> --
> 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

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

* RE: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable
  2014-03-06 17:43   ` Frank Li
@ 2014-03-07  2:10     ` fugang.duan
  2014-03-07 16:00       ` Stefan Wahren
  0 siblings, 1 reply; 11+ messages in thread
From: fugang.duan @ 2014-03-07  2:10 UTC (permalink / raw)
  To: Frank Li, Fabio Estevam
  Cc: Stefan Wahren, David Miller, netdev, linux-arm-kernel, Shawn Guo,
	Fabio.Estevam, Frank.Li, Sascha Hauer

From: Frank Li <lznuaa@gmail.com>
Data: Friday, March 07, 2014 1:43 AM

>To: Fabio Estevam
>Cc: Stefan Wahren; David Miller; netdev@vger.kernel.org; linux-arm-
>kernel@lists.arm.linux.org.uk; Shawn Guo; Estevam Fabio-R49496; Li Frank-B20596;
>Duan Fugang-B38611; Sascha Hauer
>Subject: Re: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting
>network cable
>
>On Thu, Mar 6, 2014 at 4:30 AM, Fabio Estevam <festevam@gmail.com> wrote:
>> Adding some more folks on Cc.
>>
>> On Thu, Mar 6, 2014 at 6:29 AM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
>>> Hello,
>>>
>>> i'm using a i.MX28 custom board (I2SE Duckbill) with 2 different
>>> Ethernet interfaces. Both interfaces should be used as bridge using
>>> bridge utils. One Ethernet interface is the buildin fec and the other
>>> is connect by spi. The board runs under Linux mainline 3.10. But the
>>> following problem still occurs on 3.14-rc4.
>>>
>>> Here is the problem, if i disconnect and reconnect the Ethernet cable
>>> on the buildin fec (eth0), the bridge says the port comes up, but it doesn't
>work.
>>> After that any traffic to the fec is okay, but traffic "through" the
>>> bridge is lost. But i expect no traffic is lost, after reconnect the network
>cable.
>>>
>>> If i reset the board without disconnecting the cables, the traffic "through"
>>> the bridge works. If i force the promiscuous mode on the fec (eth0)
>>> after the reconnect, the bridge works too:
>>>
>>> ifconfig eth0 promisc
>>>
>>> After that, i made some research and probably found the cause of the
>>> problem. In the case that the bridge works (link state connected
>>> since
>>> reboot) the register HW_ENET_MAC_RCR of the i.MX28 returns 0x45EE011C
>>> (PROM=1, promiscuous mode on). Then I disconnect the ethernet cable
>>> and reconnect it. After that the register returns 0x45EE0114 (PROM=0,
>>> promiscuous mode off) and the bridge doesn't work.
>>>
>>> Based on this information, i created a patch against Linux 3.10. I'm
>>> not sure it's a good solution but it works. After a fec reset all
>>> register values of HW_ENET_MAC_RCR must be restored, but fec_restart
>>> do not handle them at all. So set_multicast_list is called after
>>> fec_restart to restore the promiscuous mode of the fec.
>>>
>>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>>> b/drivers/net/ethernet/freescale/fec_main.c
>>> index d48099f..cb6b66e 100644
>>> --- a/drivers/net/ethernet/freescale/fec_main.c
>>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>>> @@ -1063,6 +1063,8 @@ static void fec_get_mac(struct net_device
>>> *ndev)
>>>
>>>  /*
>>> ---------------------------------------------------------------------
>>> ---- */
>>>
>>> +static void set_multicast_list(struct net_device *ndev);
>>> +
>>>  /*
>>>   * Phy section
>>>   */
>>> @@ -1093,8 +1095,10 @@ static void fec_enet_adjust_link(struct
>>> net_device
>>> *ndev)
>>>          }
>>>
>>>          /* if any of the above changed restart the FEC */
>>> -        if (status_change)
>>> +        if (status_change) {
>>>              fec_restart(ndev, phy_dev->duplex);
>>> +            set_multicast_list(ndev);
>>> +        }
>>>      } else {
>>>          if (fep->link) {
>>>              fec_stop(ndev);
>>>
>>> Is this solution correct?
>
>There are many places to call fec_resart.
>I suggest call set_multicase_list in fec_restart function.
>
Yes, we had called set_multicase_list() in fec_restart() function. 
The patch is redundant.

>>>
>>> Do you need more information?
>>>
>>> Best regards
>>> Stefan Wahren
>>> --
>>> 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
>> --
>> 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
>

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

* Re: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable
  2014-03-07  2:10     ` fugang.duan
@ 2014-03-07 16:00       ` Stefan Wahren
  2014-03-08  1:35         ` Fabio Estevam
  2014-03-10 18:18         ` [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable Stefan Wahren
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Wahren @ 2014-03-07 16:00 UTC (permalink / raw)
  To: fugang.duan, Frank Li, Fabio Estevam
  Cc: David Miller, netdev, linux-arm-kernel, Shawn Guo, Fabio.Estevam,
	Frank.Li, Sascha Hauer

Hi,

Am 07.03.2014 03:10, schrieb fugang.duan@freescale.com:
> From: Frank Li <lznuaa@gmail.com>
> Data: Friday, March 07, 2014 1:43 AM
>
>> To: Fabio Estevam
>> Cc: Stefan Wahren; David Miller; netdev@vger.kernel.org; linux-arm-
>> kernel@lists.arm.linux.org.uk; Shawn Guo; Estevam Fabio-R49496; Li Frank-B20596;
>> Duan Fugang-B38611; Sascha Hauer
>> Subject: Re: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting
>> network cable
>>
>> On Thu, Mar 6, 2014 at 4:30 AM, Fabio Estevam <festevam@gmail.com> wrote:
>>> Adding some more folks on Cc.
>>>
>>> On Thu, Mar 6, 2014 at 6:29 AM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
>>>> Hello,
>>>>
>>>> i'm using a i.MX28 custom board (I2SE Duckbill) with 2 different
>>>> Ethernet interfaces. Both interfaces should be used as bridge using
>>>> bridge utils. One Ethernet interface is the buildin fec and the other
>>>> is connect by spi. The board runs under Linux mainline 3.10. But the
>>>> following problem still occurs on 3.14-rc4.
>>>>
>>>> Here is the problem, if i disconnect and reconnect the Ethernet cable
>>>> on the buildin fec (eth0), the bridge says the port comes up, but it doesn't
>> work.
>>>> After that any traffic to the fec is okay, but traffic "through" the
>>>> bridge is lost. But i expect no traffic is lost, after reconnect the network
>> cable.
>>>> If i reset the board without disconnecting the cables, the traffic "through"
>>>> the bridge works. If i force the promiscuous mode on the fec (eth0)
>>>> after the reconnect, the bridge works too:
>>>>
>>>> ifconfig eth0 promisc
>>>>
>>>> After that, i made some research and probably found the cause of the
>>>> problem. In the case that the bridge works (link state connected
>>>> since
>>>> reboot) the register HW_ENET_MAC_RCR of the i.MX28 returns 0x45EE011C
>>>> (PROM=1, promiscuous mode on). Then I disconnect the ethernet cable
>>>> and reconnect it. After that the register returns 0x45EE0114 (PROM=0,
>>>> promiscuous mode off) and the bridge doesn't work.
>>>>
>>>> Based on this information, i created a patch against Linux 3.10. I'm
>>>> not sure it's a good solution but it works. After a fec reset all
>>>> register values of HW_ENET_MAC_RCR must be restored, but fec_restart
>>>> do not handle them at all. So set_multicast_list is called after
>>>> fec_restart to restore the promiscuous mode of the fec.
>>>>
>>>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>>>> b/drivers/net/ethernet/freescale/fec_main.c
>>>> index d48099f..cb6b66e 100644
>>>> --- a/drivers/net/ethernet/freescale/fec_main.c
>>>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>>>> @@ -1063,6 +1063,8 @@ static void fec_get_mac(struct net_device
>>>> *ndev)
>>>>
>>>>   /*
>>>> ---------------------------------------------------------------------
>>>> ---- */
>>>>
>>>> +static void set_multicast_list(struct net_device *ndev);
>>>> +
>>>>   /*
>>>>    * Phy section
>>>>    */
>>>> @@ -1093,8 +1095,10 @@ static void fec_enet_adjust_link(struct
>>>> net_device
>>>> *ndev)
>>>>           }
>>>>
>>>>           /* if any of the above changed restart the FEC */
>>>> -        if (status_change)
>>>> +        if (status_change) {
>>>>               fec_restart(ndev, phy_dev->duplex);
>>>> +            set_multicast_list(ndev);
>>>> +        }
>>>>       } else {
>>>>           if (fep->link) {
>>>>               fec_stop(ndev);
>>>>
>>>> Is this solution correct?
>> There are many places to call fec_resart.
>> I suggest call set_multicase_list in fec_restart function.
>>
> Yes, we had called set_multicase_list() in fec_restart() function.
> The patch is redundant.

thanks for the review. I didn't look too long at the linux-3.14-rc4, so 
i didn't see that. I only know that my problem is still reproducable in 
linux-3.14-rc5.

But i think i know why the problem still occurs. Both functions 
set_multicast_list() and fec_restart() write into the register 
FEC_R_CNTRL. The call of set_multicast_list() is too soon and has no 
effect in my case. The reason is that the register FEC_R_CNTRL is 
completly overwritten by the local variable rcntl of fec_restart.

Here is a patch against linux-3.14-rc5 which fixes my problem. I moved 
the function call to set_multicast_list() behind the register write to 
FEC_R_CNTRL.

--- linux-3.14-rc5-old/drivers/net/ethernet/freescale/fec_main.c 
2014-03-03 03:56:16.000000000 +0100
+++ linux-3.14-rc5/drivers/net/ethernet/freescale/fec_main.c 2014-03-07 
16:38:16.564026150 +0100
@@ -527,13 +527,6 @@
      /* Clear any outstanding interrupt. */
      writel(0xffc00000, fep->hwp + FEC_IEVENT);

-    /* Setup multicast filter. */
-    set_multicast_list(ndev);
-#ifndef CONFIG_M5272
-    writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
-    writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
-#endif
-
      /* Set maximum receive buffer size. */
      writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);

@@ -654,6 +647,13 @@

      writel(rcntl, fep->hwp + FEC_R_CNTRL);

+    /* Setup multicast filter. */
+    set_multicast_list(ndev);
+#ifndef CONFIG_M5272
+    writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
+    writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
+#endif
+
      if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
          /* enable ENET endian swap */
          ecntl |= (1 << 8);

Is this better? If so i'll create a proper patch.

BR Stefan

>>>> Do you need more information?
>>>>
>>>> Best regards
>>>> Stefan Wahren
>>>> --
>>>> 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
>>> --
>>> 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

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

* Re: [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable
  2014-03-07 16:00       ` Stefan Wahren
@ 2014-03-08  1:35         ` Fabio Estevam
  2014-03-10 18:18         ` [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable Stefan Wahren
  1 sibling, 0 replies; 11+ messages in thread
From: Fabio Estevam @ 2014-03-08  1:35 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: fugang.duan, Frank Li, David Miller, netdev, linux-arm-kernel,
	Shawn Guo, Fabio.Estevam, Frank.Li, Sascha Hauer

Hi Stefan,

On Fri, Mar 7, 2014 at 1:00 PM, Stefan Wahren <stefan.wahren@i2se.com> wrote:

> Is this better? If so i'll create a proper patch.

Your explanation and patch make sense. Please send it as a proper
patch and put all these people on Cc.

Thanks,

Fabio Estevam

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

* [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable
  2014-03-07 16:00       ` Stefan Wahren
  2014-03-08  1:35         ` Fabio Estevam
@ 2014-03-10 18:18         ` Stefan Wahren
  2014-03-11  1:28           ` fugang.duan
  2014-03-12  2:48           ` David Miller
  1 sibling, 2 replies; 11+ messages in thread
From: Stefan Wahren @ 2014-03-10 18:18 UTC (permalink / raw)
  To: fugang.duan, Frank Li, Fabio Estevam
  Cc: David Miller, netdev, linux-arm-kernel, Shawn Guo, Fabio.Estevam,
	Frank.Li, Sascha Hauer

If the Freescale i.MX28 fec is in promiscuous mode and network cable is
reconnected then the promiscuous mode get lost. The problem is caused
by a too soon call of set_multicast_list to re-enable promisc mode.
The FEC_R_CNTRL register changes are overwritten by fec_restart.

This patch fixes this by moving the call behind the init of FEC_R_CNTRL
register in fec_restart.

Successful tested on a i.MX28 board.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/net/ethernet/freescale/fec_main.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c
b/drivers/net/ethernet/freescale/fec_main.c
index 479a7cb..03a3513 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -528,13 +528,6 @@ fec_restart(struct net_device *ndev, int duplex)
     /* Clear any outstanding interrupt. */
     writel(0xffc00000, fep->hwp + FEC_IEVENT);
 
-    /* Setup multicast filter. */
-    set_multicast_list(ndev);
-#ifndef CONFIG_M5272
-    writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
-    writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
-#endif
-
     /* Set maximum receive buffer size. */
     writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);
 
@@ -655,6 +648,13 @@ fec_restart(struct net_device *ndev, int duplex)
 
     writel(rcntl, fep->hwp + FEC_R_CNTRL);
 
+    /* Setup multicast filter. */
+    set_multicast_list(ndev);
+#ifndef CONFIG_M5272
+    writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
+    writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
+#endif
+
     if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
         /* enable ENET endian swap */
         ecntl |= (1 << 8);
-- 
1.7.10.4

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

* RE: [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable
  2014-03-10 18:18         ` [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable Stefan Wahren
@ 2014-03-11  1:28           ` fugang.duan
  2014-03-12  2:48           ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: fugang.duan @ 2014-03-11  1:28 UTC (permalink / raw)
  To: Stefan Wahren, Frank Li, Fabio Estevam
  Cc: David Miller, netdev, linux-arm-kernel, Shawn Guo, Fabio.Estevam,
	Frank.Li, Sascha Hauer

From: Stefan Wahren <stefan.wahren@i2se.com>
Data: Tuesday, March 11, 2014 2:19 AM

>To: Duan Fugang-B38611; Frank Li; Fabio Estevam
>Cc: David Miller; netdev@vger.kernel.org; linux-arm-
>kernel@lists.arm.linux.org.uk; Shawn Guo; Estevam Fabio-R49496; Li Frank-B20596;
>Sascha Hauer
>Subject: [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting
>cable
>
>If the Freescale i.MX28 fec is in promiscuous mode and network cable is
>reconnected then the promiscuous mode get lost. The problem is caused by a too
>soon call of set_multicast_list to re-enable promisc mode.
>The FEC_R_CNTRL register changes are overwritten by fec_restart.
>
>This patch fixes this by moving the call behind the init of FEC_R_CNTRL
>register in fec_restart.
>
>Successful tested on a i.MX28 board.
>
>Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>---
> drivers/net/ethernet/freescale/fec_main.c |   14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/net/ethernet/freescale/fec_main.c
>b/drivers/net/ethernet/freescale/fec_main.c
>index 479a7cb..03a3513 100644
>--- a/drivers/net/ethernet/freescale/fec_main.c
>+++ b/drivers/net/ethernet/freescale/fec_main.c
>@@ -528,13 +528,6 @@ fec_restart(struct net_device *ndev, int duplex)
>     /* Clear any outstanding interrupt. */
>     writel(0xffc00000, fep->hwp + FEC_IEVENT);
>
>-    /* Setup multicast filter. */
>-    set_multicast_list(ndev);
>-#ifndef CONFIG_M5272
>-    writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
>-    writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
>-#endif
>-
>     /* Set maximum receive buffer size. */
>     writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);
>
>@@ -655,6 +648,13 @@ fec_restart(struct net_device *ndev, int duplex)
>
>     writel(rcntl, fep->hwp + FEC_R_CNTRL);
>
>+    /* Setup multicast filter. */
>+    set_multicast_list(ndev);
>+#ifndef CONFIG_M5272
>+    writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
>+    writel(0, fep->hwp + FEC_HASH_TABLE_LOW); #endif
>+
>     if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
>         /* enable ENET endian swap */
>         ecntl |= (1 << 8);
>--
>1.7.10.4
>
>
Acked-by: Fugang Duan <B38611@freescale.com>

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

* Re: [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable
  2014-03-10 18:18         ` [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable Stefan Wahren
  2014-03-11  1:28           ` fugang.duan
@ 2014-03-12  2:48           ` David Miller
  2014-03-12 10:28             ` [PATCH net resend] " Stefan Wahren
  1 sibling, 1 reply; 11+ messages in thread
From: David Miller @ 2014-03-12  2:48 UTC (permalink / raw)
  To: stefan.wahren
  Cc: fugang.duan, lznuaa, festevam, netdev, linux-arm-kernel,
	shawn.guo, Fabio.Estevam, Frank.Li, kernel

From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Mon, 10 Mar 2014 19:18:56 +0100

> If the Freescale i.MX28 fec is in promiscuous mode and network cable is
> reconnected then the promiscuous mode get lost. The problem is caused
> by a too soon call of set_multicast_list to re-enable promisc mode.
> The FEC_R_CNTRL register changes are overwritten by fec_restart.
> 
> This patch fixes this by moving the call behind the init of FEC_R_CNTRL
> register in fec_restart.
> 
> Successful tested on a i.MX28 board.
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

Your email client has corrupted your patch, making it unusable for us.

In particular, it has transformed TAB characters into spaces.

Please fix this and resubmit your patch, thank you.

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

* Re: [PATCH net resend] eth: fec: Fix lost promiscuous mode after reconnecting cable
  2014-03-12  2:48           ` David Miller
@ 2014-03-12 10:28             ` Stefan Wahren
  2014-03-13 19:46               ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Wahren @ 2014-03-12 10:28 UTC (permalink / raw)
  To: David Miller
  Cc: fugang.duan, lznuaa, festevam, netdev, shawn.guo, Fabio.Estevam,
	Frank.Li, kernel

If the Freescale fec is in promiscuous mode and network cable is
reconnected then the promiscuous mode get lost. The problem is caused
by a too soon call of set_multicast_list to re-enable promisc mode.
The FEC_R_CNTRL register changes are overwritten by fec_restart.

This patch fixes this by moving the call behind the init of FEC_R_CNTRL
register in fec_restart.

Successful tested on a i.MX28 board.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/net/ethernet/freescale/fec_main.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 479a7cb..03a3513 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -528,13 +528,6 @@ fec_restart(struct net_device *ndev, int duplex)
 	/* Clear any outstanding interrupt. */
 	writel(0xffc00000, fep->hwp + FEC_IEVENT);
 
-	/* Setup multicast filter. */
-	set_multicast_list(ndev);
-#ifndef CONFIG_M5272
-	writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
-	writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
-#endif
-
 	/* Set maximum receive buffer size. */
 	writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);
 
@@ -655,6 +648,13 @@ fec_restart(struct net_device *ndev, int duplex)
 
 	writel(rcntl, fep->hwp + FEC_R_CNTRL);
 
+	/* Setup multicast filter. */
+	set_multicast_list(ndev);
+#ifndef CONFIG_M5272
+	writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
+	writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
+#endif
+
 	if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
 		/* enable ENET endian swap */
 		ecntl |= (1 << 8);
-- 
1.7.10.4

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

* Re: [PATCH net resend] eth: fec: Fix lost promiscuous mode after reconnecting cable
  2014-03-12 10:28             ` [PATCH net resend] " Stefan Wahren
@ 2014-03-13 19:46               ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2014-03-13 19:46 UTC (permalink / raw)
  To: stefan.wahren
  Cc: fugang.duan, lznuaa, festevam, netdev, shawn.guo, Fabio.Estevam,
	Frank.Li, kernel

From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Wed, 12 Mar 2014 11:28:19 +0100

> If the Freescale fec is in promiscuous mode and network cable is
> reconnected then the promiscuous mode get lost. The problem is caused
> by a too soon call of set_multicast_list to re-enable promisc mode.
> The FEC_R_CNTRL register changes are overwritten by fec_restart.
> 
> This patch fixes this by moving the call behind the init of FEC_R_CNTRL
> register in fec_restart.
> 
> Successful tested on a i.MX28 board.
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

Applied, thank you.

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

end of thread, other threads:[~2014-03-13 19:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06  9:29 [Bug] net/fec on i.MX28: promiscuous mode lost after reconnecting network cable Stefan Wahren
2014-03-06 10:30 ` Fabio Estevam
2014-03-06 17:43   ` Frank Li
2014-03-07  2:10     ` fugang.duan
2014-03-07 16:00       ` Stefan Wahren
2014-03-08  1:35         ` Fabio Estevam
2014-03-10 18:18         ` [PATCH net] eth: fec: Fix lost promiscuous mode after reconnecting cable Stefan Wahren
2014-03-11  1:28           ` fugang.duan
2014-03-12  2:48           ` David Miller
2014-03-12 10:28             ` [PATCH net resend] " Stefan Wahren
2014-03-13 19:46               ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.