net: eth-uclass: call stop only for active devices
PATCH 1/1 net: eth-uclass: call stop only for active devices
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/eth-uclass.c +2 -1
@@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev) {struct eth_pdata *pdata = dev->platdata; -eth_get_ops (dev)->stop (dev); +if (eth_is_active (dev)) +eth_get_ops (dev)->stop (dev);/* clear the MAC address */ memset (pdata->enetaddr,0 ,ARP_HLEN );
Signature · 1 line
2.17.1
PATCH 1/1 net: eth-uclass: call stop only for active devices
Quoted 28 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Signed-off-by Keerthy <[email protected]>--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/eth-uclass.c +2
-2@@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev) {struct eth_pdata *pdata = dev->platdata; -eth_get_ops (dev)->stop (dev); +if (eth_is_active (dev)) +eth_get_ops (dev)->stop (dev);/* clear the MAC address */ memset (pdata->enetaddr,0 ,ARP_HLEN ); --
Quoted 2 lines
2.17.1
PATCH 1/1 net: eth-uclass: call stop only for active devices
In reply to KeerthyQuoted 7 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Quoted 5 lines
Signed-off-by Keerthy <[email protected]>--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Could you please provide a test case?
Regards,
Bin
PATCH 1/1 net: eth-uclass: call stop only for active devices
Quoted 9 lines · Bin Meng
Quoted 7 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Keerthy <[email protected]>--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Could you please provide a test case?
Presumably that test should live in test/dm/eth.c with some potential support needed by drivers/net/sandbox.c
Thanks,
-Joe
Quoted 6 lines
Regards,
Bin
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 net: eth-uclass: call stop only for active devices
In reply to KeerthyQuoted 17 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Signed-off-by Keerthy <[email protected]>--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/eth-uclass.c +0
-0
net/eth-uclass.c static int eth_pre_remove(struct udevice *dev) · line 535
Quoted 6 lines
net/eth-uclass.c +2
-1@@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev) {struct eth_pdata *pdata = dev->platdata; -eth_get_ops (dev)->stop (dev); +if (eth_is_active (dev)) +eth_get_ops (dev)->stop (dev);
This seems reasonable... What was the case that provoked an issue? Which driver was having trouble?
Quoted 10 lines
net/eth-uclass.c +0
-1/* clear the MAC address */ memset (pdata->enetaddr,0 ,ARP_HLEN ); --2.17.1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 net: eth-uclass: call stop only for active devices
Quoted 21 lines · Joe Hershberger
Quoted 20 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Signed-off-by Keerthy <[email protected]>--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/eth-uclass.c +0
-0@@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev) {struct eth_pdata *pdata = dev->platdata;
Quoted 6 lines
net/eth-uclass.c static int eth_pre_remove(struct udevice *dev) · line 535
Quoted 3 lines
net/eth-uclass.c +2
-1-eth_get_ops (dev)->stop (dev); +if (eth_is_active (dev)) +eth_get_ops (dev)->stop (dev);This seems reasonable... What was the case that provoked an issue? Which driver was having trouble?
I am trying to implement pru based ethernet driver(multiple instances) with cpsw driver on top on am654-evm. I observed that even though i had not started
a particular instance of my pru based device stop was getting called and it was crashing right at the end.
Quoted 11 lines
Quoted 11 lines
net/eth-uclass.c +0
-1/* clear the MAC address */ memset (pdata->enetaddr,0 ,ARP_HLEN ); --2.17.1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 net: eth-uclass: call stop only for active devices
Quoted 32 lines · Keerthy
Quoted 21 lines · Joe Hershberger
Quoted 20 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Signed-off-by Keerthy <[email protected]>--- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/eth-uclass.c +0
-0@@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev) {struct eth_pdata *pdata = dev->platdata;Quoted 6 lines
net/eth-uclass.c static int eth_pre_remove(struct udevice *dev) · line 535
Quoted 3 lines
net/eth-uclass.c +2
-1-eth_get_ops (dev)->stop (dev); +if (eth_is_active (dev)) +eth_get_ops (dev)->stop (dev);This seems reasonable... What was the case that provoked an issue? Which driver was having trouble?
Quoted 6 lines
I am trying to implement pru based ethernet driver(multiple instances) with cpsw driver on top on am654-evm. I observed that even though i had not started
a particular instance of my pru based device stop was getting called and it was crashing right at the end.
Please add a proper test case in test/dm/eth.c to cover such scenarios. Thanks!
Regards,
Bin
PATCH 1/1 net: eth-uclass: call stop only for active devices
In reply to KeerthyQuoted 31 lines · Keerthy
Quoted 21 lines · Joe Hershberger
Quoted 20 lines · Keerthy
Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop.
Signed-off-by Keerthy <[email protected]>---
net/eth-uclass.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)net/eth-uclass.c +0
-0@@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev) { struct eth_pdata *pdata = dev->platdata;Quoted 6 lines
net/eth-uclass.c static int eth_pre_remove(struct udevice *dev) · line 535
Quoted 3 lines
net/eth-uclass.c +2
-1- eth_get_ops(dev)->stop(dev); + if (eth_is_active(dev)) + eth_get_ops(dev)->stop(dev);This seems reasonable... What was the case that provoked an issue? Which driver was having trouble?
Quoted 5 lines
I am trying to implement pru based ethernet driver(multiple instances) with cpsw driver on top on am654-evm. I observed that even though i had not started
a particular instance of my pru based device stop was getting called and it was crashing right at the end.
Joe,
I am yet to implement a test case for this. Can this patch be applied independently?
Regards,
Keerthy
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
net/eth-uclass.c +0
-0/* clear the MAC address */ memset(pdata->enetaddr, 0, ARP_HLEN);Signature · 6 lines
2.17.1 _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot