diff options
author | 2015-10-22 07:39:07 -0700 | |
---|---|---|
committer | 2015-10-22 07:39:07 -0700 | |
commit | 998eb8079f03f44d4017d7941c082b4a57eb2db8 (patch) | |
tree | 75dc9acfc1527604786d6747bf1ad6def40ad7cc /net | |
parent | Merge tag 'mac80211-next-for-davem-2015-10-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next (diff) | |
parent | net: dsa: remove port_fdb_getnext (diff) | |
download | wireguard-linux-998eb8079f03f44d4017d7941c082b4a57eb2db8.tar.xz wireguard-linux-998eb8079f03f44d4017d7941c082b4a57eb2db8.zip |
Merge branch 'dsa-port_fdb_dump'
Vivien Didelot says:
====================
net: dsa: implement port_fdb_dump in drivers
Not all switch chips provide a Get Next kind of operation to dump FDB entries.
It is preferred to let the driver handle the dump operation the way it works
best for the chip. Thus, drop port_fdb_getnext and implement the port_fdb_dump
operation in DSA, which pushes the switchdev FDB dump callback down to the
drivers. mv88e6xxx is the only driver affected and is updated accordingly.
v3 -> v4: fix rejects on latest net-next
v2 -> v3: opencode switchdev_obj_dump_cb_t to avoid multiple typedef;
use ether_addr_copy in fdb_dump
v1 -> v2: fix a few "return err" instead of "goto unlock" in mv88e6xxx.c
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/slave.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index b0b8da0f5af8..481754ee062a 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -378,31 +378,11 @@ static int dsa_slave_port_fdb_dump(struct net_device *dev, { struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; - unsigned char addr[ETH_ALEN] = { 0 }; - u16 vid = 0; - int ret; - - if (!ds->drv->port_fdb_getnext) - return -EOPNOTSUPP; - for (;;) { - bool is_static; - - ret = ds->drv->port_fdb_getnext(ds, p->port, addr, &vid, - &is_static); - if (ret < 0) - break; + if (ds->drv->port_fdb_dump) + return ds->drv->port_fdb_dump(ds, p->port, fdb, cb); - ether_addr_copy(fdb->addr, addr); - fdb->vid = vid; - fdb->ndm_state = is_static ? NUD_NOARP : NUD_REACHABLE; - - ret = cb(&fdb->obj); - if (ret < 0) - break; - } - - return ret == -ENOENT ? 0 : ret; + return -EOPNOTSUPP; } static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |