lkml.org 
[lkml]   [2015]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH net-next v3 1/6] net: dsa: add port_fdb_dump function
Date
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>
---
include/net/dsa.h | 4 ++++
net/dsa/slave.c | 3 +++
2 files changed, 7 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index e005886..0cfa44a 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -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 {
@@ -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);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index b0b8da0..d76e62b 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -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;

--
2.6.1


\
 
 \ /
  Last update: 2015-10-20 18:41    [W:0.058 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site