Skip to content

Commit

Permalink
net: mvpp2: implement ioctl() operation for PHY ioctls
Browse files Browse the repository at this point in the history
This commit implements the ->ndo_do_ioctl() operation so that the
PHY-related ioctl() calls can work from userspace, which allows
applications like mii-tool or mii-diag to do their job.

Signed-off-by: Thomas Petazzoni <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tpetazzoni authored and davem330 committed Jul 29, 2014
1 parent 2add511 commit bd695a5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/net/ethernet/marvell/mvpp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5714,6 +5714,21 @@ mvpp2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
return stats;
}

static int mvpp2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct mvpp2_port *port = netdev_priv(dev);
int ret;

if (!port->phy_dev)
return -ENOTSUPP;

ret = phy_mii_ioctl(port->phy_dev, ifr, cmd);
if (!ret)
mvpp2_link_event(dev);

return ret;
}

/* Ethtool methods */

/* Get settings (phy address, speed) for ethtools */
Expand Down Expand Up @@ -5868,6 +5883,7 @@ static const struct net_device_ops mvpp2_netdev_ops = {
.ndo_set_mac_address = mvpp2_set_mac_address,
.ndo_change_mtu = mvpp2_change_mtu,
.ndo_get_stats64 = mvpp2_get_stats64,
.ndo_do_ioctl = mvpp2_ioctl,
};

static const struct ethtool_ops mvpp2_eth_tool_ops = {
Expand Down

0 comments on commit bd695a5

Please sign in to comment.