aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/arc/emac_main.c
diff options
context:
space:
mode:
authorRomain Perier <romain.perier@collabora.com>2017-08-03 03:49:03 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-03 18:14:34 -0400
commite11e8729fafd3dc49397c28f320ac3b2d483abbc (patch)
tree67f118ce34cfd513cd5519509451c82659fdfc81 /drivers/net/ethernet/arc/emac_main.c
parentf4b2a42073fb9b51366e379b6d79e2d1290fcb75 (diff)
net: arc_emac: Add support for ndo_do_ioctl net_device_ops operation
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/arc/emac_main.c')
-rw-r--r--drivers/net/ethernet/arc/emac_main.c13
1 files changed, 13 insertions, 0 deletions
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)
720 return 0; 720 return 0;
721} 721}
722 722
723static int arc_emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
724{
725 if (!netif_running(dev))
726 return -EINVAL;
727
728 if (!dev->phydev)
729 return -ENODEV;
730
731 return phy_mii_ioctl(dev->phydev, rq, cmd);
732}
733
734
723static const struct net_device_ops arc_emac_netdev_ops = { 735static const struct net_device_ops arc_emac_netdev_ops = {
724 .ndo_open = arc_emac_open, 736 .ndo_open = arc_emac_open,
725 .ndo_stop = arc_emac_stop, 737 .ndo_stop = arc_emac_stop,
@@ -727,6 +739,7 @@ static const struct net_device_ops arc_emac_netdev_ops = {
727 .ndo_set_mac_address = arc_emac_set_address, 739 .ndo_set_mac_address = arc_emac_set_address,
728 .ndo_get_stats = arc_emac_stats, 740 .ndo_get_stats = arc_emac_stats,
729 .ndo_set_rx_mode = arc_emac_set_rx_mode, 741 .ndo_set_rx_mode = arc_emac_set_rx_mode,
742 .ndo_do_ioctl = arc_emac_ioctl,
730#ifdef CONFIG_NET_POLL_CONTROLLER 743#ifdef CONFIG_NET_POLL_CONTROLLER
731 .ndo_poll_controller = arc_emac_poll_controller, 744 .ndo_poll_controller = arc_emac_poll_controller,
732#endif 745#endif