netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
@ 2013-11-13 12:53 Daniel Mack
  2013-11-14 12:45 ` Mugunthan V N
  2013-11-14 21:21 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Mack @ 2013-11-13 12:53 UTC (permalink / raw)
  To: netdev; +Cc: mugunthanvnm, davem, Daniel Mack

To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1
on dual MAC enabled machines.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 drivers/net/ethernet/ti/cpsw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index edd3e79..702b063 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
 
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+
 	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
-	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+	if (priv->data.dual_emac)
+		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+
 	pm_runtime_put_sync(&pdev->dev);
 
 	/* Select sleep pin state */
-- 
1.8.4.2

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

* Re: [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
  2013-11-13 12:53 [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume Daniel Mack
@ 2013-11-14 12:45 ` Mugunthan V N
  2013-11-14 12:56   ` Daniel Mack
  2013-11-14 21:21 ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Mugunthan V N @ 2013-11-14 12:45 UTC (permalink / raw)
  To: Daniel Mack, netdev; +Cc: davem

On Wednesday 13 November 2013 06:23 PM, Daniel Mack wrote:
> To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1
> on dual MAC enabled machines.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
>  drivers/net/ethernet/ti/cpsw.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index edd3e79..702b063 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
>  
>  	if (netif_running(ndev))
>  		cpsw_ndo_stop(ndev);
> +
>  	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
> -	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
> +	if (priv->data.dual_emac)
> +		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);

Is this tested on a system with both ports in switch mode?
I don't think this will not work with both ports in switch mode.

Regards
Mugunthan V N

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

* Re: [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
  2013-11-14 12:45 ` Mugunthan V N
@ 2013-11-14 12:56   ` Daniel Mack
  2013-11-14 13:09     ` Mugunthan V N
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Mack @ 2013-11-14 12:56 UTC (permalink / raw)
  To: Mugunthan V N, netdev; +Cc: davem

On 11/14/2013 01:45 PM, Mugunthan V N wrote:
> On Wednesday 13 November 2013 06:23 PM, Daniel Mack wrote:
>> To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1
>> on dual MAC enabled machines.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> ---
>>  drivers/net/ethernet/ti/cpsw.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
>> index edd3e79..702b063 100644
>> --- a/drivers/net/ethernet/ti/cpsw.c
>> +++ b/drivers/net/ethernet/ti/cpsw.c
>> @@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
>>  
>>  	if (netif_running(ndev))
>>  		cpsw_ndo_stop(ndev);
>> +
>>  	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
>> -	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
>> +	if (priv->data.dual_emac)
>> +		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
> 
> Is this tested on a system with both ports in switch mode?

Nope. I got an Ooops when I tried to suspend a machine that has only one
slave configured in DTS.

> I don't think this will not work with both ports in switch mode.

Why? Isn't priv->data.dual_emac in that case? The same condition is
checked for in cpsw_remove().


Thanks,
Daniel

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

* Re: [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
  2013-11-14 12:56   ` Daniel Mack
@ 2013-11-14 13:09     ` Mugunthan V N
  2013-11-15  7:01       ` Daniel Mack
  0 siblings, 1 reply; 6+ messages in thread
From: Mugunthan V N @ 2013-11-14 13:09 UTC (permalink / raw)
  To: Daniel Mack, netdev; +Cc: davem

On Thursday 14 November 2013 06:26 PM, Daniel Mack wrote:
> On 11/14/2013 01:45 PM, Mugunthan V N wrote:
>> On Wednesday 13 November 2013 06:23 PM, Daniel Mack wrote:
>>> To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1
>>> on dual MAC enabled machines.
>>>
>>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>>> ---
>>>  drivers/net/ethernet/ti/cpsw.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
>>> index edd3e79..702b063 100644
>>> --- a/drivers/net/ethernet/ti/cpsw.c
>>> +++ b/drivers/net/ethernet/ti/cpsw.c
>>> @@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
>>>  
>>>  	if (netif_running(ndev))
>>>  		cpsw_ndo_stop(ndev);
>>> +
>>>  	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
>>> -	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
>>> +	if (priv->data.dual_emac)
>>> +		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
>> Is this tested on a system with both ports in switch mode?
> Nope. I got an Ooops when I tried to suspend a machine that has only one
> slave configured in DTS.

But the changes above will fail with system with two ports and in switch
mode.

>
>> I don't think this will not work with both ports in switch mode.
> Why? Isn't priv->data.dual_emac in that case? The same condition is
> checked for in cpsw_remove().
In cpsw_remove that check is used to unregister the second network
interface registered for same device for port 2. Now I got the issue,
this has to be done via for_each_slave().

Regards
Mugunthan V N

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

* Re: [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
  2013-11-13 12:53 [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume Daniel Mack
  2013-11-14 12:45 ` Mugunthan V N
@ 2013-11-14 21:21 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2013-11-14 21:21 UTC (permalink / raw)
  To: zonque; +Cc: netdev, mugunthanvnm

From: Daniel Mack <zonque@gmail.com>
Date: Wed, 13 Nov 2013 13:53:00 +0100

> To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1
> on dual MAC enabled machines.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>

Please reimplement this using for_each_slave() as Mungunthan suggested.

Thanks.

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

* Re: [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
  2013-11-14 13:09     ` Mugunthan V N
@ 2013-11-15  7:01       ` Daniel Mack
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2013-11-15  7:01 UTC (permalink / raw)
  To: Mugunthan V N, netdev; +Cc: davem

On 11/14/2013 02:09 PM, Mugunthan V N wrote:
> On Thursday 14 November 2013 06:26 PM, Daniel Mack wrote:
>> On 11/14/2013 01:45 PM, Mugunthan V N wrote:
>>> On Wednesday 13 November 2013 06:23 PM, Daniel Mack wrote:
>>>> To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1
>>>> on dual MAC enabled machines.
>>>>
>>>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>>>> ---
>>>>  drivers/net/ethernet/ti/cpsw.c | 5 ++++-
>>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
>>>> index edd3e79..702b063 100644
>>>> --- a/drivers/net/ethernet/ti/cpsw.c
>>>> +++ b/drivers/net/ethernet/ti/cpsw.c
>>>> @@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
>>>>  
>>>>  	if (netif_running(ndev))
>>>>  		cpsw_ndo_stop(ndev);
>>>> +
>>>>  	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
>>>> -	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
>>>> +	if (priv->data.dual_emac)
>>>> +		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
>>> Is this tested on a system with both ports in switch mode?
>> Nope. I got an Ooops when I tried to suspend a machine that has only one
>> slave configured in DTS.
> 
> But the changes above will fail with system with two ports and in switch
> mode.
> 
>>
>>> I don't think this will not work with both ports in switch mode.
>> Why? Isn't priv->data.dual_emac in that case? The same condition is
>> checked for in cpsw_remove().
> In cpsw_remove that check is used to unregister the second network
> interface registered for same device for port 2. Now I got the issue,
> this has to be done via for_each_slave().

Aah, right, thanks :) Will repost.


Daniel

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

end of thread, other threads:[~2013-11-15  7:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 12:53 [PATCH] net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume Daniel Mack
2013-11-14 12:45 ` Mugunthan V N
2013-11-14 12:56   ` Daniel Mack
2013-11-14 13:09     ` Mugunthan V N
2013-11-15  7:01       ` Daniel Mack
2013-11-14 21:21 ` 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).