summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2020-07-19 20:49:51 -0700
committerDavid S. Miller <davem@davemloft.net>2020-07-20 16:48:22 -0700
commitaad74d849dd56a04ccb289f7c61909a68337ce5e (patch)
tree5eb8f37c9356caaec20d8a4a95eb5a4c4bfa9a4d /net/core
parent88a3c45482f63373f7cce37a182cd6f40429a5ac (diff)
downloadlinux-aad74d849dd56a04ccb289f7c61909a68337ce5e.tar.gz
linux-aad74d849dd56a04ccb289f7c61909a68337ce5e.tar.bz2
linux-aad74d849dd56a04ccb289f7c61909a68337ce5e.zip
net: Wrap ndo_do_ioctl() to prepare for DSA stacked ops
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>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev_ioctl.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 547b587c1950..a213c703c90a 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -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()
*/
@@ -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;