All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dpaa_eth: implement ioctl() for PHY-related ops
@ 2017-02-20 15:54 Michael Walle
  2017-02-21  3:21 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2017-02-20 15:54 UTC (permalink / raw)
  To: Madalin Bucur; +Cc: netdev, linux-kernel, Michael Walle

This commit adds the ndo_do_ioctl() callback which allows the userspace to
access PHY registers, for example. This will make mii-diag and similar
tools work.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 726b569..b0f5990 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2335,6 +2335,13 @@ static int dpaa_eth_stop(struct net_device *net_dev)
 	return err;
 }
 
+static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
+{
+	if (!net_dev->phydev)
+		return -EINVAL;
+	return phy_mii_ioctl(net_dev->phydev, rq, cmd);
+}
+
 static const struct net_device_ops dpaa_ops = {
 	.ndo_open = dpaa_open,
 	.ndo_start_xmit = dpaa_start_xmit,
@@ -2344,6 +2351,7 @@ static const struct net_device_ops dpaa_ops = {
 	.ndo_set_mac_address = dpaa_set_mac_address,
 	.ndo_validate_addr = eth_validate_addr,
 	.ndo_set_rx_mode = dpaa_set_rx_mode,
+	.ndo_do_ioctl = dpaa_ioctl,
 };
 
 static int dpaa_napi_add(struct net_device *net_dev)
-- 
2.1.4

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

* Re: [PATCH] dpaa_eth: implement ioctl() for PHY-related ops
  2017-02-20 15:54 [PATCH] dpaa_eth: implement ioctl() for PHY-related ops Michael Walle
@ 2017-02-21  3:21 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-02-21  3:21 UTC (permalink / raw)
  To: michael; +Cc: madalin.bucur, netdev, linux-kernel

From: Michael Walle <michael@walle.cc>
Date: Mon, 20 Feb 2017 16:54:18 +0100

> This commit adds the ndo_do_ioctl() callback which allows the userspace to
> access PHY registers, for example. This will make mii-diag and similar
> tools work.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Applied, thanks.

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

end of thread, other threads:[~2017-02-21  3:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 15:54 [PATCH] dpaa_eth: implement ioctl() for PHY-related ops Michael Walle
2017-02-21  3:21 ` 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.