Skip to content

Commit

Permalink
net: Call into DSA netdevice_ops wrappers
Browse files Browse the repository at this point in the history
Make the core net_device code call into our ndo_do_ioctl() and
ndo_get_phys_port_name() functions via the wrappers defined previously

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 4cfab35 commit 3369afb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
#include <net/busy_poll.h>
#include <linux/rtnetlink.h>
#include <linux/stat.h>
#include <net/dsa.h>
#include <net/dst.h>
#include <net/dst_metadata.h>
#include <net/pkt_sched.h>
Expand Down Expand Up @@ -8602,6 +8603,10 @@ int dev_get_phys_port_name(struct net_device *dev,
const struct net_device_ops *ops = dev->netdev_ops;
int err;

err = dsa_ndo_get_phys_port_name(dev, name, len);
if (err == 0 || err != -EOPNOTSUPP)
return err;

if (ops->ndo_get_phys_port_name) {
err = ops->ndo_get_phys_port_name(dev, name, len);
if (err != -EOPNOTSUPP)
Expand Down
5 changes: 5 additions & 0 deletions net/core/dev_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/rtnetlink.h>
#include <linux/net_tstamp.h>
#include <linux/wireless.h>
#include <net/dsa.h>
#include <net/wext.h>

/*
Expand Down Expand Up @@ -231,6 +232,10 @@ static int dev_do_ioctl(struct net_device *dev,
const struct net_device_ops *ops = dev->netdev_ops;
int err = -EOPNOTSUPP;

err = dsa_ndo_do_ioctl(dev, ifr, cmd);
if (err == 0 || err != -EOPNOTSUPP)
return err;

if (ops->ndo_do_ioctl) {
if (netif_device_present(dev))
err = ops->ndo_do_ioctl(dev, ifr, cmd);
Expand Down

0 comments on commit 3369afb

Please sign in to comment.