Re: [PATCH v2 net-next 4/6] net: switchdev: pass callback to dump operation
From: Jiri Pirko
Date: Wed Sep 30 2015 - 06:41:33 EST
Tue, Sep 29, 2015 at 06:07:16PM CEST, vivien.didelot@xxxxxxxxxxxxxxxxxxxx wrote:
>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 <vivien.didelot@xxxxxxxxxxxxxxxxxxxx>
>---
> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/