net: mvneta: implement ->ndo_do_ioctl() to support PHY ioctls
[linux.git] / drivers / net / ethernet / marvell / mvneta.c
index 90ab2928e062159e9bdf5ee5e0eb1c792f165322..389a854b88fc7280403e17d249f128b9b4431382 100644 (file)
@@ -2451,6 +2451,21 @@ static int mvneta_stop(struct net_device *dev)
        return 0;
 }
 
+static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+       struct mvneta_port *pp = netdev_priv(dev);
+       int ret;
+
+       if (!pp->phy_dev)
+               return -ENOTSUPP;
+
+       ret = phy_mii_ioctl(pp->phy_dev, ifr, cmd);
+       if (!ret)
+               mvneta_adjust_link(dev);
+
+       return ret;
+}
+
 /* Ethtool methods */
 
 /* Get settings (phy address, speed) for ethtools */
@@ -2569,6 +2584,7 @@ static const struct net_device_ops mvneta_netdev_ops = {
        .ndo_change_mtu      = mvneta_change_mtu,
        .ndo_tx_timeout      = mvneta_tx_timeout,
        .ndo_get_stats64     = mvneta_get_stats64,
+       .ndo_do_ioctl        = mvneta_ioctl,
 };
 
 const struct ethtool_ops mvneta_eth_tool_ops = {