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


Groups > linux.kernel > #1235355 > unrolled thread

[PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2015-09-29 18:10 +0200
Last post2015-09-30 12:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_* Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 18:10 +0200
    [PATCH v2 net-next 1/6] net: switchdev: remove dev in port_vlan_dump_put Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 18:10 +0200
    Re: [PATCH v2 net-next 0/6] net: switchdev: use specific  switchdev_obj_* David Miller <davem@davemloft.net> - 2015-09-30 06:40 +0200
    Re: [PATCH v2 net-next 0/6] net: switchdev: use specific  switchdev_obj_* Jiri Pirko <jiri@resnulli.us> - 2015-09-30 12:50 +0200

#1235355 — [PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2015-09-29 18:10 +0200
Subject[PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*
Message-ID<qe5Dz-2XB-3@gated-at.bofh.it>
This patchset changes switchdev add, del, dump operations from this:

    int     (*switchdev_port_obj_add)(struct net_device *dev,
                                      struct switchdev_obj *obj,
                                      struct switchdev_trans *trans);
    int     (*switchdev_port_obj_del)(struct net_device *dev,
                                      struct switchdev_obj *obj);
    int     (*switchdev_port_obj_dump)(struct net_device *dev,
                                      struct switchdev_obj *obj);

to something similar to the notifier_call callback of a notifier_block:

    int     (*switchdev_port_obj_add)(struct net_device *dev,
                                      enum switchdev_obj_id id,
                                      const void *obj,
                                      struct switchdev_trans *trans);                                                             
    int     (*switchdev_port_obj_del)(struct net_device *dev,
                                      enum switchdev_obj_id id,
                                      const void *obj);
    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 (e.g. switchdev_obj_fdb) instead of the generic switchdev_obj one.

This will simplify pushing the callback function down to the drivers.

The first 3 patches get rid of the dev parameter of the dump callback, since it
is not always neeeded (e.g. vlan_dump) and some drivers (such as DSA drivers)
may not have easy access to it.

Patches 4 and 5 implement the change in the switchdev operations and its users.

Patch 6 extracts the inner switchdev_obj_* structures from switchdev_obj and
removes this last one.

v2: fix error spotted by kbuild (extra ';' inline switchdev_port_obj_dump).

Vivien Didelot (6):
  net: switchdev: remove dev in port_vlan_dump_put
  net: switchdev: move dev in switchdev_fdb_dump
  net: switchdev: remove dev from switchdev_obj cb
  net: switchdev: pass callback to dump operation
  net: switchdev: abstract object in add/del ops
  net: switchdev: extract struct switchdev_obj_*

 drivers/net/ethernet/rocker/rocker.c |  42 ++++----
 include/net/switchdev.h              |  80 ++++++++-------
 net/bridge/br_fdb.c                  |  11 +--
 net/bridge/br_vlan.c                 |  24 ++---
 net/dsa/slave.c                      |  46 +++++----
 net/switchdev/switchdev.c            | 184 ++++++++++++++++-------------------
 6 files changed, 186 insertions(+), 201 deletions(-)

-- 
2.6.0

--
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/

[toc] | [next] | [standalone]


#1235356 — [PATCH v2 net-next 1/6] net: switchdev: remove dev in port_vlan_dump_put

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2015-09-29 18:10 +0200
Subject[PATCH v2 net-next 1/6] net: switchdev: remove dev in port_vlan_dump_put
Message-ID<qe5DC-2XB-45@gated-at.bofh.it>
In reply to#1235355
The static switchdev_port_vlan_dump_put function does not need the
net_device parameter, so remove it.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/switchdev/switchdev.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 00ee547..56d34ed 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -484,8 +484,7 @@ struct switchdev_vlan_dump {
 	u16 end;
 };
 
-static int switchdev_port_vlan_dump_put(struct net_device *dev,
-					struct switchdev_vlan_dump *dump)
+static int switchdev_port_vlan_dump_put(struct switchdev_vlan_dump *dump)
 {
 	struct bridge_vlan_info vinfo;
 
@@ -531,7 +530,7 @@ static int switchdev_port_vlan_dump_cb(struct net_device *dev,
 		for (dump->begin = dump->end = vlan->vid_begin;
 		     dump->begin <= vlan->vid_end;
 		     dump->begin++, dump->end++) {
-			err = switchdev_port_vlan_dump_put(dev, dump);
+			err = switchdev_port_vlan_dump_put(dump);
 			if (err)
 				return err;
 		}
@@ -543,7 +542,7 @@ static int switchdev_port_vlan_dump_cb(struct net_device *dev,
 				/* prepend */
 				dump->begin = vlan->vid_begin;
 			} else {
-				err = switchdev_port_vlan_dump_put(dev, dump);
+				err = switchdev_port_vlan_dump_put(dump);
 				dump->flags = vlan->flags;
 				dump->begin = vlan->vid_begin;
 				dump->end = vlan->vid_end;
@@ -555,7 +554,7 @@ static int switchdev_port_vlan_dump_cb(struct net_device *dev,
 				/* append */
 				dump->end = vlan->vid_end;
 			} else {
-				err = switchdev_port_vlan_dump_put(dev, dump);
+				err = switchdev_port_vlan_dump_put(dump);
 				dump->flags = vlan->flags;
 				dump->begin = vlan->vid_begin;
 				dump->end = vlan->vid_end;
@@ -588,7 +587,7 @@ static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
 			goto err_out;
 		if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
 			/* last one */
-			err = switchdev_port_vlan_dump_put(dev, &dump);
+			err = switchdev_port_vlan_dump_put(&dump);
 	}
 
 err_out:
-- 
2.6.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1235744 — Re: [PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*

FromDavid Miller <davem@davemloft.net>
Date2015-09-30 06:40 +0200
SubjectRe: [PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*
Message-ID<qehlo-2JC-7@gated-at.bofh.it>
In reply to#1235355
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Tue, 29 Sep 2015 12:07:12 -0400

> This patchset changes switchdev add, del, dump operations from this:
 ...
> to something similar to the notifier_call callback of a notifier_block:
 ...
> This allows the caller to pass and expect back a specific switchdev_obj_*
> structure (e.g. switchdev_obj_fdb) instead of the generic switchdev_obj one.
> 
> This will simplify pushing the callback function down to the drivers.
> 
> The first 3 patches get rid of the dev parameter of the dump callback, since it
> is not always neeeded (e.g. vlan_dump) and some drivers (such as DSA drivers)
> may not have easy access to it.
> 
> Patches 4 and 5 implement the change in the switchdev operations and its users.
> 
> Patch 6 extracts the inner switchdev_obj_* structures from switchdev_obj and
> removes this last one.
> 
> v2: fix error spotted by kbuild (extra ';' inline switchdev_port_obj_dump).

Series applied, thanks Vivien.
--
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/

[toc] | [prev] | [next] | [standalone]


#1236141 — Re: [PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*

FromJiri Pirko <jiri@resnulli.us>
Date2015-09-30 12:50 +0200
SubjectRe: [PATCH v2 net-next 0/6] net: switchdev: use specific switchdev_obj_*
Message-ID<qen7u-2yO-53@gated-at.bofh.it>
In reply to#1235355
Tue, Sep 29, 2015 at 06:07:12PM CEST, vivien.didelot@savoirfairelinux.com wrote:
>This patchset changes switchdev add, del, dump operations from this:
>
>    int     (*switchdev_port_obj_add)(struct net_device *dev,
>                                      struct switchdev_obj *obj,
>                                      struct switchdev_trans *trans);
>    int     (*switchdev_port_obj_del)(struct net_device *dev,
>                                      struct switchdev_obj *obj);
>    int     (*switchdev_port_obj_dump)(struct net_device *dev,
>                                      struct switchdev_obj *obj);
>
>to something similar to the notifier_call callback of a notifier_block:
>
>    int     (*switchdev_port_obj_add)(struct net_device *dev,
>                                      enum switchdev_obj_id id,
>                                      const void *obj,
>                                      struct switchdev_trans *trans);                                                             
>    int     (*switchdev_port_obj_del)(struct net_device *dev,
>                                      enum switchdev_obj_id id,
>                                      const void *obj);
>    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 (e.g. switchdev_obj_fdb) instead of the generic switchdev_obj one.
>
>This will simplify pushing the callback function down to the drivers.
>
>The first 3 patches get rid of the dev parameter of the dump callback, since it
>is not always neeeded (e.g. vlan_dump) and some drivers (such as DSA drivers)
>may not have easy access to it.
>
>Patches 4 and 5 implement the change in the switchdev operations and its users.
>
>Patch 6 extracts the inner switchdev_obj_* structures from switchdev_obj and
>removes this last one.


How about attrs? We should keep objs and attrs api consistent.
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web