Skip to content

Commit

Permalink
net: Wrap ndo_do_ioctl() to prepare for DSA stacked ops
Browse files Browse the repository at this point in the history
In preparation for adding another layer of call into a DSA stacked ops
singleton, wrap the ndo_do_ioctl() call into dev_do_ioctl().

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Jul 20, 2020
1 parent 88a3c45 commit aad74d8
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions net/core/dev_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,22 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
return 0;
}

static int dev_do_ioctl(struct net_device *dev,
struct ifreq *ifr, unsigned int cmd)
{
const struct net_device_ops *ops = dev->netdev_ops;
int err = -EOPNOTSUPP;

if (ops->ndo_do_ioctl) {
if (netif_device_present(dev))
err = ops->ndo_do_ioctl(dev, ifr, cmd);
else
err = -ENODEV;
}

return err;
}

/*
* Perform the SIOCxIFxxx calls, inside rtnl_lock()
*/
Expand Down Expand Up @@ -323,13 +339,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
cmd == SIOCSHWTSTAMP ||
cmd == SIOCGHWTSTAMP ||
cmd == SIOCWANDEV) {
err = -EOPNOTSUPP;
if (ops->ndo_do_ioctl) {
if (netif_device_present(dev))
err = ops->ndo_do_ioctl(dev, ifr, cmd);
else
err = -ENODEV;
}
err = dev_do_ioctl(dev, ifr, cmd);
} else
err = -EINVAL;

Expand Down

0 comments on commit aad74d8

Please sign in to comment.