* [PATCH 1/2] PHYLIB: Add get_link ethtool helper function
@ 2006-06-05 23:48 Nathaniel Case
2006-06-11 16:13 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Nathaniel Case @ 2006-06-05 23:48 UTC (permalink / raw)
To: Andy Fleming; +Cc: netdev, Jeff Garzik, galak
This adds a phy_ethtool_get_link() function along the same lines as
phy_ethtool_gset(). This provides drivers utilizing PHYLIB an
alternative to using ethtool_op_get_link(). This is more desirable
since the "Link detected" field in ethtool would actually reflect the
state of the PHY register.
Patch depends on previous patch (0/2).
Signed-off-by: Nate Case <ncase@xes-inc.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
---
--- a/drivers/net/phy/phy.c 2006-06-04 16:01:59.000000000 -0500
+++ b/drivers/net/phy/phy.c 2006-06-05 10:55:31.000000000 -0500
@@ -301,6 +301,22 @@
return 0;
}
+/*
+ * phy_ethtool_get_link:
+ * A generic ethtool get_link function which is more accurate than
+ * the network interface carrier status since it queries the
+ * PHY directly.
+ */
+u32 phy_ethtool_get_link(struct phy_device *phydev)
+{
+ int err;
+
+ err = genphy_update_link(phydev);
+ if (err)
+ return 0;
+
+ return (u32) phydev->link;
+}
/* Note that this function is currently incompatible with the
* PHYCONTROL layer. It changes registers without regard to
--- a/include/linux/phy.h 2006-06-05 11:33:59.000000000 -0500
+++ b/include/linux/phy.h 2006-06-04 19:31:51.000000000 -0500
@@ -374,6 +374,7 @@
void phy_stop_machine(struct phy_device *phydev);
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
+u32 phy_ethtool_get_link(struct phy_device *phydev);
int phy_mii_ioctl(struct phy_device *phydev,
struct mii_ioctl_data *mii_data, int cmd);
int phy_start_interrupts(struct phy_device *phydev);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] PHYLIB: Add get_link ethtool helper function
2006-06-05 23:48 [PATCH 1/2] PHYLIB: Add get_link ethtool helper function Nathaniel Case
@ 2006-06-11 16:13 ` Jeff Garzik
2006-06-12 16:12 ` Nathaniel Case
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2006-06-11 16:13 UTC (permalink / raw)
To: Nathaniel Case; +Cc: Andy Fleming, netdev, galak
Nathaniel Case wrote:
> This adds a phy_ethtool_get_link() function along the same lines as
> phy_ethtool_gset(). This provides drivers utilizing PHYLIB an
> alternative to using ethtool_op_get_link(). This is more desirable
> since the "Link detected" field in ethtool would actually reflect the
> state of the PHY register.
>
> Patch depends on previous patch (0/2).
>
> Signed-off-by: Nate Case <ncase@xes-inc.com>
> Signed-off-by: Andy Fleming <afleming@freescale.com>
NAK, needs an EXPORT
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] PHYLIB: Add get_link ethtool helper function
2006-06-11 16:13 ` Jeff Garzik
@ 2006-06-12 16:12 ` Nathaniel Case
0 siblings, 0 replies; 3+ messages in thread
From: Nathaniel Case @ 2006-06-12 16:12 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Andy Fleming, netdev, galak
On Sun, 2006-06-11 at 12:13 -0400, Jeff Garzik wrote:
> > This adds a phy_ethtool_get_link() function along the same lines as
> > phy_ethtool_gset(). This provides drivers utilizing PHYLIB an
> > alternative to using ethtool_op_get_link(). This is more desirable
> > since the "Link detected" field in ethtool would actually reflect the
> > state of the PHY register.
> >
[snip]
> NAK, needs an EXPORT
In that case, shouldn't we EXPORT phy_ethtool_sset() and
phy_ethtool_gset() in drivers/net/phy/phy.c as well?
- Nate Case <ncase@xes-inc.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-12 16:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-05 23:48 [PATCH 1/2] PHYLIB: Add get_link ethtool helper function Nathaniel Case
2006-06-11 16:13 ` Jeff Garzik
2006-06-12 16:12 ` Nathaniel Case
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).