linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pasemi_mac: ethtool get settings fix
@ 2009-10-01 22:27 Valentine Barshak
  2009-10-05 12:59 ` Valentine
  0 siblings, 1 reply; 8+ messages in thread
From: Valentine Barshak @ 2009-10-01 22:27 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: netdev

Not all pasemi mac interfaces can have a phy attached.
For example, XAUI has no phy and phydev is NULL for it.
In this case ethtool get settings causes kernel crash.
Fix it by returning -EOPNOTSUPP if there's no PHY attached.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
---
 drivers/net/pasemi_mac_ethtool.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.21.orig/drivers/net/pasemi_mac_ethtool.c	2008-11-06 18:10:38.000000000 +0300
+++ linux-2.6.21/drivers/net/pasemi_mac_ethtool.c	2008-11-19 19:24:28.000000000 +0300
@@ -71,6 +71,8 @@ pasemi_mac_ethtool_get_settings(struct n
 	struct pasemi_mac *mac = netdev_priv(netdev);
 	struct phy_device *phydev = mac->phydev;
 
+	if (!phydev)
+		return -EOPNOTSUPP;
 	return phy_ethtool_gset(phydev, cmd);
 }
 

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

* Re: [PATCH] pasemi_mac: ethtool get settings fix
  2009-10-01 22:27 [PATCH] pasemi_mac: ethtool get settings fix Valentine Barshak
@ 2009-10-05 12:59 ` Valentine
  2009-10-05 13:27   ` Valentine Barshak
  2009-10-05 13:31   ` [PATCH] pasemi_mac: ethtool set settings support Valentine Barshak
  0 siblings, 2 replies; 8+ messages in thread
From: Valentine @ 2009-10-05 12:59 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: netdev

Resending pasemi_mac ethtool patches...

Valentine Barshak wrote:
> Not all pasemi mac interfaces can have a phy attached.
> For example, XAUI has no phy and phydev is NULL for it.
> In this case ethtool get settings causes kernel crash.
> Fix it by returning -EOPNOTSUPP if there's no PHY attached.
> 
> Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
> ---
>  drivers/net/pasemi_mac_ethtool.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- linux-2.6.21.orig/drivers/net/pasemi_mac_ethtool.c	2008-11-06 18:10:38.000000000 +0300
> +++ linux-2.6.21/drivers/net/pasemi_mac_ethtool.c	2008-11-19 19:24:28.000000000 +0300
> @@ -71,6 +71,8 @@ pasemi_mac_ethtool_get_settings(struct n
>  	struct pasemi_mac *mac = netdev_priv(netdev);
>  	struct phy_device *phydev = mac->phydev;
>  
> +	if (!phydev)
> +		return -EOPNOTSUPP;
>  	return phy_ethtool_gset(phydev, cmd);
>  }
>  
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* [PATCH] pasemi_mac: ethtool get settings fix
  2009-10-05 12:59 ` Valentine
@ 2009-10-05 13:27   ` Valentine Barshak
  2009-10-06 16:10     ` Olof Johansson
  2009-10-05 13:31   ` [PATCH] pasemi_mac: ethtool set settings support Valentine Barshak
  1 sibling, 1 reply; 8+ messages in thread
From: Valentine Barshak @ 2009-10-05 13:27 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, jgarzik, netdev

Not all pasemi mac interfaces can have a phy attached.
For example, XAUI has no phy and phydev is NULL for it.
In this case ethtool get settings causes kernel crash.
Fix it by returning -EOPNOTSUPP if there's no PHY attached.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
---
 drivers/net/pasemi_mac_ethtool.c |    3 +++
 1 file changed, 3 insertions(+)

diff -pruN linux-2.6.orig/drivers/net/pasemi_mac_ethtool.c linux-2.6/drivers/net/pasemi_mac_ethtool.c
--- linux-2.6.orig/drivers/net/pasemi_mac_ethtool.c	2009-02-14 03:23:08.000000000 +0300
+++ linux-2.6/drivers/net/pasemi_mac_ethtool.c	2009-10-05 16:21:52.000000000 +0400
@@ -71,6 +71,9 @@ pasemi_mac_ethtool_get_settings(struct n
 	struct pasemi_mac *mac = netdev_priv(netdev);
 	struct phy_device *phydev = mac->phydev;
 
+	if (!phydev)
+		return -EOPNOTSUPP;
+
 	return phy_ethtool_gset(phydev, cmd);
 }
 

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

* [PATCH] pasemi_mac: ethtool set settings support
  2009-10-05 12:59 ` Valentine
  2009-10-05 13:27   ` Valentine Barshak
@ 2009-10-05 13:31   ` Valentine Barshak
  2009-10-06 16:11     ` Olof Johansson
  1 sibling, 1 reply; 8+ messages in thread
From: Valentine Barshak @ 2009-10-05 13:31 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, jgarzik, netdev

Add ethtool set settings to pasemi_mac_ethtool.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
---
 drivers/net/pasemi_mac_ethtool.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff -pruN linux-2.6.orig/drivers/net/pasemi_mac_ethtool.c linux-2.6/drivers/net/pasemi_mac_ethtool.c
--- linux-2.6.orig/drivers/net/pasemi_mac_ethtool.c	2009-10-05 16:24:14.000000000 +0400
+++ linux-2.6./drivers/net/pasemi_mac_ethtool.c	2009-10-05 16:27:08.000000000 +0400
@@ -77,6 +77,19 @@ pasemi_mac_ethtool_get_settings(struct n
 	return phy_ethtool_gset(phydev, cmd);
 }
 
+static int
+pasemi_mac_ethtool_set_settings(struct net_device *netdev,
+			       struct ethtool_cmd *cmd)
+{
+	struct pasemi_mac *mac = netdev_priv(netdev);
+	struct phy_device *phydev = mac->phydev;
+
+	if (!phydev)
+		return -EOPNOTSUPP;
+
+	return phy_ethtool_sset(phydev, cmd);
+}
+
 static void
 pasemi_mac_ethtool_get_drvinfo(struct net_device *netdev,
 			       struct ethtool_drvinfo *drvinfo)
@@ -150,6 +163,7 @@ static void pasemi_mac_get_strings(struc
 
 const struct ethtool_ops pasemi_mac_ethtool_ops = {
 	.get_settings		= pasemi_mac_ethtool_get_settings,
+	.set_settings		= pasemi_mac_ethtool_set_settings,
 	.get_drvinfo		= pasemi_mac_ethtool_get_drvinfo,
 	.get_msglevel		= pasemi_mac_ethtool_get_msglevel,
 	.set_msglevel		= pasemi_mac_ethtool_set_msglevel,

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

* Re: [PATCH] pasemi_mac: ethtool get settings fix
  2009-10-05 13:27   ` Valentine Barshak
@ 2009-10-06 16:10     ` Olof Johansson
  2009-10-07 10:43       ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2009-10-06 16:10 UTC (permalink / raw)
  To: Valentine Barshak; +Cc: linuxppc-dev, jgarzik, netdev

Weird, I see my address in the to: line but I never got a copy in my inbox.

On Mon, Oct 05, 2009 at 05:27:56PM +0400, Valentine Barshak wrote:
> Not all pasemi mac interfaces can have a phy attached.
> For example, XAUI has no phy and phydev is NULL for it.
> In this case ethtool get settings causes kernel crash.
> Fix it by returning -EOPNOTSUPP if there's no PHY attached.
> 
> Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>

Acked-by: Olof Johansson <olof@lixom.net>

> ---
>  drivers/net/pasemi_mac_ethtool.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff -pruN linux-2.6.orig/drivers/net/pasemi_mac_ethtool.c linux-2.6/drivers/net/pasemi_mac_ethtool.c
> --- linux-2.6.orig/drivers/net/pasemi_mac_ethtool.c	2009-02-14 03:23:08.000000000 +0300
> +++ linux-2.6/drivers/net/pasemi_mac_ethtool.c	2009-10-05 16:21:52.000000000 +0400
> @@ -71,6 +71,9 @@ pasemi_mac_ethtool_get_settings(struct n
>  	struct pasemi_mac *mac = netdev_priv(netdev);
>  	struct phy_device *phydev = mac->phydev;
>  
> +	if (!phydev)
> +		return -EOPNOTSUPP;
> +
>  	return phy_ethtool_gset(phydev, cmd);
>  }
>  
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: [PATCH] pasemi_mac: ethtool set settings support
  2009-10-05 13:31   ` [PATCH] pasemi_mac: ethtool set settings support Valentine Barshak
@ 2009-10-06 16:11     ` Olof Johansson
  2009-10-12 11:25       ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2009-10-06 16:11 UTC (permalink / raw)
  To: Valentine Barshak; +Cc: linuxppc-dev, jgarzik, netdev

On Mon, Oct 05, 2009 at 05:31:24PM +0400, Valentine Barshak wrote:
> Add ethtool set settings to pasemi_mac_ethtool.
> 
> Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>

Acked-by: Olof Johansson <olof@lixom.net>

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

* Re: [PATCH] pasemi_mac: ethtool get settings fix
  2009-10-06 16:10     ` Olof Johansson
@ 2009-10-07 10:43       ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2009-10-07 10:43 UTC (permalink / raw)
  To: olof; +Cc: linuxppc-dev, jgarzik, netdev

From: Olof Johansson <olof@lixom.net>
Date: Tue, 6 Oct 2009 11:10:54 -0500

> Weird, I see my address in the to: line but I never got a copy in my inbox.
> 
> On Mon, Oct 05, 2009 at 05:27:56PM +0400, Valentine Barshak wrote:
>> Not all pasemi mac interfaces can have a phy attached.
>> For example, XAUI has no phy and phydev is NULL for it.
>> In this case ethtool get settings causes kernel crash.
>> Fix it by returning -EOPNOTSUPP if there's no PHY attached.
>> 
>> Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
> 
> Acked-by: Olof Johansson <olof@lixom.net>

Applied to net-2.6, thanks!

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

* Re: [PATCH] pasemi_mac: ethtool set settings support
  2009-10-06 16:11     ` Olof Johansson
@ 2009-10-12 11:25       ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2009-10-12 11:25 UTC (permalink / raw)
  To: olof; +Cc: linuxppc-dev, jgarzik, netdev

From: Olof Johansson <olof@lixom.net>
Date: Tue, 6 Oct 2009 11:11:23 -0500

> On Mon, Oct 05, 2009 at 05:31:24PM +0400, Valentine Barshak wrote:
>> Add ethtool set settings to pasemi_mac_ethtool.
>> 
>> Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
> 
> Acked-by: Olof Johansson <olof@lixom.net>

Applied to net-next-2.6, thanks.

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

end of thread, other threads:[~2009-10-12 11:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 22:27 [PATCH] pasemi_mac: ethtool get settings fix Valentine Barshak
2009-10-05 12:59 ` Valentine
2009-10-05 13:27   ` Valentine Barshak
2009-10-06 16:10     ` Olof Johansson
2009-10-07 10:43       ` David Miller
2009-10-05 13:31   ` [PATCH] pasemi_mac: ethtool set settings support Valentine Barshak
2009-10-06 16:11     ` Olof Johansson
2009-10-12 11:25       ` 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).