netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH net-next 0/3] net: switchdev: extract specific object structures
@ 2015-09-08 20:47 Vivien Didelot
  2015-09-08 20:47 ` [RFC PATCH net-next 1/3] net: switchdev: extract switchdev_obj_vlan Vivien Didelot
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Vivien Didelot @ 2015-09-08 20:47 UTC (permalink / raw)
  To: netdev
  Cc: Jiri Pirko, Scott Feldman, Florian Fainelli, Andrew Lunn, kernel,
	Vivien Didelot

Hi!

Current implementations of .switchdev_port_obj_add and .switchdev_port_obj_dump
must pass the generic switchdev_obj structure instead of a specific one (e.g.
switchdev_obj_fdb) to the related driver accessors, because it contains the
object transaction and callback. This is not very convenient for drivers.

Instead of having all specific structures included into a switchdev_obj union,
it would be simpler to embed a switchdev_obj structure as the first member of
the more specific ones. That way, a driver can cast the switchdev_obj pointer
to the specific structure and have access to all the information from it.

As an example, this allows Rocker to change its two FDB accessors:

    rocker_port_fdb_add(rocker_port, obj->trans, &obj->u.fdb);
    rocker_port_fdb_dump(rocker_port, obj);

for these most consistent ones:

    fdb = (struct switchdev_obj_fdb *) obj;
    rocker_port_fdb_add(rocker_port, fdb);
    rocker_port_fdb_dump(rocker_port, fdb);

This is what struct netdev_notifier_info and its specific supersets (e.g.
struct netdev_notifier_changeupper_info) do in include/linux/netdevice.h.

This patchset does that and updates bridge, Rocker and DSA accordingly.

Note that this patchset was sent as an RFC not to bother David with new
net-next stuffs, but if the changes look good, it is ready to merge.

Also, please take note that the change sits on top of:
http://patchwork.ozlabs.org/patch/514894/

Vivien Didelot (3):
  net: switchdev: extract switchdev_obj_vlan
  net: switchdev: extract switchdev_obj_ipv4_fib
  net: switchdev: extract switchdev_obj_fdb

 drivers/net/ethernet/rocker/rocker.c |  50 ++++++++------
 include/net/switchdev.h              |  49 ++++++++------
 net/bridge/br_fdb.c                  |  12 ++--
 net/bridge/br_vlan.c                 |  26 +++----
 net/dsa/slave.c                      |  59 +++++++++-------
 net/switchdev/switchdev.c            | 127 ++++++++++++++++-------------------
 6 files changed, 165 insertions(+), 158 deletions(-)

-- 
2.5.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-09 16:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-08 20:47 [RFC PATCH net-next 0/3] net: switchdev: extract specific object structures Vivien Didelot
2015-09-08 20:47 ` [RFC PATCH net-next 1/3] net: switchdev: extract switchdev_obj_vlan Vivien Didelot
2015-09-08 20:58   ` Andrew Lunn
2015-09-09 16:12   ` Scott Feldman
2015-09-08 20:47 ` [RFC PATCH net-next 2/3] net: switchdev: extract switchdev_obj_ipv4_fib Vivien Didelot
2015-09-08 20:47 ` [RFC PATCH net-next 3/3] net: switchdev: extract switchdev_obj_fdb Vivien Didelot
2015-09-09  6:45 ` [RFC PATCH net-next 0/3] net: switchdev: extract specific object structures Jiri Pirko
2015-09-09 16:25 ` Scott Feldman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).