Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1245867

[PATCH net-next 3/6] net: dsa: add port_fdb_dump function

From Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Newsgroups linux.kernel
Subject [PATCH net-next 3/6] net: dsa: add port_fdb_dump function
Date 2015-10-13 17:50 +0200
Message-ID <qj9ZV-2xR-51@gated-at.bofh.it> (permalink)
References <qj9ZU-2xR-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 | 5 +++++
 net/dsa/slave.c   | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index e005886..c5c48c5 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -198,7 +198,9 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds)
 }
 
 struct switchdev_trans;
+struct switchdev_obj;
 struct switchdev_obj_port_fdb;
+typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
 
 struct dsa_switch_driver {
 	struct list_head	list;
@@ -330,6 +332,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,
+				 switchdev_obj_dump_cb_t *cb);
 };
 
 void register_switch_driver(struct dsa_switch_driver *type);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 43d7342..a4e3416 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/6] net: dsa: implement port_fdb_dump in drivers Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-13 17:50 +0200
  [PATCH net-next 5/6] net: dsa: mv88e6xxx: remove port_fdb_getnext Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-13 17:50 +0200
  [PATCH net-next 2/6] net: dsa: mv88e6xxx: write MAC outside of ATU Get Next code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-13 17:50 +0200
  [PATCH net-next 3/6] net: dsa: add port_fdb_dump function Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-13 17:50 +0200
  [PATCH net-next 1/6] net: dsa: mv88e6xxx: write VID outside of VTU Get Next code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-13 17:50 +0200
  Re: [PATCH net-next 0/6] net: dsa: implement port_fdb_dump in drivers Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-13 18:20 +0200

csiph-web