Implement MDIO access ioctls.
Change-Id: Id0a4a6cb4ef75540923666d6ec22231f758b8c8d
diff --git a/pfe_ctrl/pfe_eth.c b/pfe_ctrl/pfe_eth.c
index d6681ac..61fdeb4 100644
--- a/pfe_ctrl/pfe_eth.c
+++ b/pfe_ctrl/pfe_eth.c
@@ -17,6 +17,7 @@
#include <linux/timer.h>
#include <linux/hrtimer.h>
#include <linux/platform_device.h>
+#include <linux/mdio.h>
#include <net/ip.h>
#include <net/sock.h>
@@ -2478,6 +2479,19 @@
return pfe_eth_poll(priv, napi, 0, budget);
}
+static int pfe_eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
+{
+ struct pfe_eth_priv_s *priv = netdev_priv(dev);
+
+ if (!netif_running(dev))
+ return -EINVAL;
+
+ if (!priv->phydev)
+ return -ENODEV;
+
+ return phy_mii_ioctl(priv->phydev, req, cmd);
+}
+
static const struct net_device_ops pfe_netdev_ops = {
.ndo_open = pfe_eth_open,
.ndo_stop = pfe_eth_close,
@@ -2490,6 +2504,7 @@
.ndo_set_features = pfe_eth_set_features,
.ndo_fix_features = pfe_eth_fix_features,
.ndo_validate_addr = eth_validate_addr,
+ .ndo_do_ioctl = pfe_eth_ioctl,
};