netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: arc_emac: Add support for ndo_do_ioctl net_device_ops operation
@ 2017-08-03  7:49 Romain Perier
  2017-08-03 22:14 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Romain Perier @ 2017-08-03  7:49 UTC (permalink / raw)
  To: David S. Miller, Alexander Kochetkov, Wei Yongjun, Eric Dumazet,
	Peter Chen
  Cc: netdev, linux-kernel, Romain Perier

This operation is required for handling ioctl commands like SIOCGMIIREG,
when debugging MDIO registers from userspace.

This commit adds support for this operation.

Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
 drivers/net/ethernet/arc/emac_main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 68de2f2652f2..3241af1ce718 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -720,6 +720,18 @@ static int arc_emac_set_address(struct net_device *ndev, void *p)
 	return 0;
 }
 
+static int arc_emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	if (!netif_running(dev))
+		return -EINVAL;
+
+	if (!dev->phydev)
+		return -ENODEV;
+
+	return phy_mii_ioctl(dev->phydev, rq, cmd);
+}
+
+
 static const struct net_device_ops arc_emac_netdev_ops = {
 	.ndo_open		= arc_emac_open,
 	.ndo_stop		= arc_emac_stop,
@@ -727,6 +739,7 @@ static const struct net_device_ops arc_emac_netdev_ops = {
 	.ndo_set_mac_address	= arc_emac_set_address,
 	.ndo_get_stats		= arc_emac_stats,
 	.ndo_set_rx_mode	= arc_emac_set_rx_mode,
+	.ndo_do_ioctl		= arc_emac_ioctl,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= arc_emac_poll_controller,
 #endif
-- 
2.11.0

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

* Re: [PATCH] net: arc_emac: Add support for ndo_do_ioctl net_device_ops operation
  2017-08-03  7:49 [PATCH] net: arc_emac: Add support for ndo_do_ioctl net_device_ops operation Romain Perier
@ 2017-08-03 22:14 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-03 22:14 UTC (permalink / raw)
  To: romain.perier
  Cc: al.kochet, weiyongjun1, edumazet, peter.chen, netdev,
	linux-kernel

From: Romain Perier <romain.perier@collabora.com>
Date: Thu,  3 Aug 2017 09:49:03 +0200

> This operation is required for handling ioctl commands like SIOCGMIIREG,
> when debugging MDIO registers from userspace.
> 
> This commit adds support for this operation.
> 
> Signed-off-by: Romain Perier <romain.perier@collabora.com>

Applied, thanks.

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

end of thread, other threads:[~2017-08-03 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-03  7:49 [PATCH] net: arc_emac: Add support for ndo_do_ioctl net_device_ops operation Romain Perier
2017-08-03 22:14 ` 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).