From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Scott Feldman <sfeldma@gmail.com>, Jiri Pirko <jiri@resnulli.us>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Subject: [PATCH net-next 3/6] net: dsa: add port_fdb_dump function
Date: Tue, 13 Oct 2015 11:43:00 -0400 [thread overview]
Message-ID: <1444750983-14726-4-git-send-email-vivien.didelot@savoirfairelinux.com> (raw)
In-Reply-To: <1444750983-14726-1-git-send-email-vivien.didelot@savoirfairelinux.com>
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
next prev parent reply other threads:[~2015-10-13 15:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 15:42 [PATCH net-next 0/6] net: dsa: implement port_fdb_dump in drivers Vivien Didelot
2015-10-13 15:42 ` [PATCH net-next 1/6] net: dsa: mv88e6xxx: write VID outside of VTU Get Next code Vivien Didelot
2015-10-13 15:42 ` [PATCH net-next 2/6] net: dsa: mv88e6xxx: write MAC outside of ATU " Vivien Didelot
2015-10-13 15:43 ` Vivien Didelot [this message]
2015-10-13 15:43 ` [PATCH net-next 4/6] net: dsa: mv88e6xxx: implement port_fdb_dump Vivien Didelot
2015-10-13 15:43 ` [PATCH net-next 5/6] net: dsa: mv88e6xxx: remove port_fdb_getnext Vivien Didelot
2015-10-13 15:43 ` [PATCH net-next 6/6] net: dsa: " Vivien Didelot
2015-10-13 16:18 ` [PATCH net-next 0/6] net: dsa: implement port_fdb_dump in drivers Vivien Didelot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444750983-14726-4-git-send-email-vivien.didelot@savoirfairelinux.com \
--to=vivien.didelot@savoirfairelinux.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=jiri@resnulli.us \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®