Skip to content

Commit e11e872

Browse files
Romain Perierdavem330
authored andcommitted
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>
1 parent f4b2a42 commit e11e872

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/net/ethernet/arc/emac_main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,26 @@ static int arc_emac_set_address(struct net_device *ndev, void *p)
720720
return 0;
721721
}
722722

723+
static 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+
723735
static const struct net_device_ops arc_emac_netdev_ops = {
724736
.ndo_open = arc_emac_open,
725737
.ndo_stop = arc_emac_stop,
726738
.ndo_start_xmit = arc_emac_tx,
727739
.ndo_set_mac_address = arc_emac_set_address,
728740
.ndo_get_stats = arc_emac_stats,
729741
.ndo_set_rx_mode = arc_emac_set_rx_mode,
742+
.ndo_do_ioctl = arc_emac_ioctl,
730743
#ifdef CONFIG_NET_POLL_CONTROLLER
731744
.ndo_poll_controller = arc_emac_poll_controller,
732745
#endif

0 commit comments

Comments
 (0)