]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
dpaa_eth: implement ioctl() for PHY-related ops
authorMichael Walle <michael@walle.cc>
Mon, 20 Feb 2017 15:54:18 +0000 (16:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Feb 2017 03:21:23 +0000 (22:21 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

index bc5a3347fd4aaf8f5166f17e379f660186bb7f49..e2ca107f9d94f162cdab87e406c72095a6746651 100644 (file)
@@ -2333,6 +2333,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,
@@ -2342,6 +2349,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)