Thread (13 messages) 13 messages, 4 authors, 2015-09-30

Re: [PATCH v2 net-next 4/6] net: switchdev: pass callback to dump operation

From: Jiri Pirko <jiri@resnulli.us>
Date: 2015-09-30 10:41:24
Also in: lkml

Tue, Sep 29, 2015 at 06:07:16PM CEST, vivien.didelot@savoirfairelinux.com wrote:
quoted hunk ↗ jump to hunk
Similar to the notifier_call callback of a notifier_block, change the
function signature of switchdev dump operation to:

   int switchdev_port_obj_dump(struct net_device *dev,
                               enum switchdev_obj_id id, void *obj,
                               int (*cb)(void *obj));

This allows the caller to pass and expect back a specific
switchdev_obj_* structure instead of the generic switchdev_obj one.

Drivers implementation of dump operation can now expect this specific
structure and call the callback with it. Drivers have been changed
accordingly.

Signed-off-by: Vivien Didelot <redacted>
---
drivers/net/ethernet/rocker/rocker.c | 21 +++++++++--------
include/net/switchdev.h              |  9 +++++---
net/dsa/slave.c                      | 26 +++++++++++----------
net/switchdev/switchdev.c            | 45 ++++++++++++++++++------------------
4 files changed, 53 insertions(+), 48 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index 78fd443..107adb6 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -4538,10 +4538,10 @@ static int rocker_port_obj_del(struct net_device *dev,
}

static int rocker_port_fdb_dump(const struct rocker_port *rocker_port,
-				struct switchdev_obj *obj)
+				struct switchdev_obj_fdb *fdb,
+				int (*cb)(void *obj))
                                ^^^^^^^^^^^^^^^^^^^^ we should have some
				typedef for this.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help