Skip to content

Commit

Permalink
net: dsa: add port_fdb_dump function
Browse files Browse the repository at this point in the history
Not all switch chips support a Get Next operation to iterate on its FDB.
So add a more simple port_fdb_dump function for them.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Oct 22, 2015
1 parent e9829b9 commit ea70ba9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/net/dsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds)
}

struct switchdev_trans;
struct switchdev_obj;
struct switchdev_obj_port_fdb;

struct dsa_switch_driver {
Expand Down Expand Up @@ -330,6 +331,9 @@ struct dsa_switch_driver {
int (*port_fdb_getnext)(struct dsa_switch *ds, int port,
unsigned char *addr, u16 *vid,
bool *is_static);
int (*port_fdb_dump)(struct dsa_switch *ds, int port,
struct switchdev_obj_port_fdb *fdb,
int (*cb)(struct switchdev_obj *obj));
};

void register_switch_driver(struct dsa_switch_driver *type);
Expand Down
3 changes: 3 additions & 0 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ static int dsa_slave_port_fdb_dump(struct net_device *dev,
u16 vid = 0;
int ret;

if (ds->drv->port_fdb_dump)
return ds->drv->port_fdb_dump(ds, p->port, fdb, cb);

if (!ds->drv->port_fdb_getnext)
return -EOPNOTSUPP;

Expand Down

0 comments on commit ea70ba9

Please sign in to comment.