From: John Fastabend <john.fastabend@gmail.com>
To: Scott Feldman <sfeldma@gmail.com>, Jiri Pirko <jiri@resnulli.us>
Cc: Netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Ido Schimmel <idosch@mellanox.com>,
eladr@mellanox.com, Thomas Graf <tgraf@suug.ch>,
Alexei Starovoitov <ast@plumgrid.com>,
David Laight <David.Laight@aculab.com>
Subject: Re: [patch net-next v3 06/14] rocker: introduce worlds infrastructure
Date: Tue, 06 Oct 2015 09:19:14 -0700 [thread overview]
Message-ID: <5613F482.2010200@gmail.com> (raw)
In-Reply-To: <CAE4R7bCdAQxLo3tKbXAqyGa_F3PhUTUkqrM5jTkYqcJJbCDmog@mail.gmail.com>
On 15-10-06 09:06 AM, Scott Feldman wrote:
> On Tue, Oct 6, 2015 at 12:51 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> This is another step on the way to per-world clean cut. Introduce world
>> ops hooks which each world can implement in world-specific way.
>> Also introduce world infrastructure including function for port worlds
>> change.
>>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>> v1->v2:
>> - removed functions to change worlds based on name, as rtnl mode
>> set patch is removed from patchset.
>> v2->v3:
>> - fix checks in rocker_world_port_open and rocker_world_port_stop
>> ---
>> drivers/net/ethernet/rocker/rocker.h | 56 ++++
>> drivers/net/ethernet/rocker/rocker_main.c | 464 +++++++++++++++++++++++++++++-
>> 2 files changed, 519 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/rocker/rocker.h b/drivers/net/ethernet/rocker/rocker.h
>> index 650caa0..d49bc5d 100644
>> --- a/drivers/net/ethernet/rocker/rocker.h
>> +++ b/drivers/net/ethernet/rocker/rocker.h
>> @@ -12,7 +12,11 @@
>> #ifndef _ROCKER_H
>> #define _ROCKER_H
>>
>> +#include <linux/kernel.h>
>> #include <linux/types.h>
>> +#include <linux/netdevice.h>
>> +#include <net/neighbour.h>
>> +#include <net/switchdev.h>
>>
>> #include "rocker_hw.h"
>>
>> @@ -24,4 +28,56 @@ struct rocker_desc_info {
>> dma_addr_t mapaddr;
>> };
>>
>> +struct rocker;
>> +struct rocker_port;
>> +
>> +struct rocker_world_ops {
>> + const char *kind;
>> + size_t priv_size;
>> + size_t port_priv_size;
>> + u8 mode;
>> + int (*init)(struct rocker *rocker, void *priv);
>> + void (*fini)(void *priv);
>> + int (*port_init)(struct rocker_port *rocker_port, void *priv,
>> + void *port_priv);
>> + void (*port_fini)(void *port_priv);
>> + int (*port_open)(void *port_priv);
>> + void (*port_stop)(void *port_priv);
>> + int (*port_attr_stp_state_set)(void *port_priv, u8 state,
>> + struct switchdev_trans *trans);
>> + int (*port_attr_bridge_flags_set)(void *port_priv,
>> + unsigned long brport_flags,
>> + struct switchdev_trans *trans);
>> + int (*port_attr_bridge_flags_get)(void *port_priv,
>> + unsigned long *p_brport_flags);
>> + int (*port_obj_vlan_add)(void *port_priv,
>> + const struct switchdev_obj_port_vlan *vlan,
>> + struct switchdev_trans *trans);
>> + int (*port_obj_vlan_del)(void *port_priv,
>> + const struct switchdev_obj_port_vlan *vlan);
>> + int (*port_obj_vlan_dump)(void *port_priv,
>> + struct switchdev_obj_port_vlan *vlan,
>> + switchdev_obj_dump_cb_t *cb);
>> + int (*port_obj_fib4_add)(void *port_priv,
>> + const struct switchdev_obj_ipv4_fib *fib4,
>> + struct switchdev_trans *trans);
>> + int (*port_obj_fib4_del)(void *port_priv,
>> + const struct switchdev_obj_ipv4_fib *fib4);
>> + int (*port_obj_fdb_add)(void *port_priv,
>> + const struct switchdev_obj_port_fdb *fdb,
>> + struct switchdev_trans *trans);
>> + int (*port_obj_fdb_del)(void *port_priv,
>> + const struct switchdev_obj_port_fdb *fdb);
>> + int (*port_obj_fdb_dump)(void *port_priv,
>> + struct switchdev_obj_port_fdb *fdb,
>> + switchdev_obj_dump_cb_t *cb);
>> + int (*port_master_linked)(void *port_priv, struct net_device *master);
>> + int (*port_master_unlinked)(void *port_priv, struct net_device *master);
>> + int (*port_neigh_update)(void *port_priv, struct neighbour *n);
>> + int (*port_neigh_destroy)(void *port_priv, struct neighbour *n);
>> + int (*port_ev_mac_vlan_seen)(void *port_priv,
>> + const unsigned char *addr,
>> + __be16 vlan_id);
>> +};
>
> Using void * in these ops is unacceptable, I can't agree to this patch.
>
> There is a much cleaner way to architect this. If you look at the ops
> defined, they're mostly duplicates of the already defined
> switchdev_ops. It would be much cleaner to:
>
> 0) set port mode on qemu/rocker (the device)
> 1) get the port mode on port probe
> 2) based on port mode, set the switchdev_ops to point to the port mode
> world switchdev_ops
> 3) sub-class rocker_port, like I mentioned in before, to store
> world-specific stuff in rocker_port
>
> I don't buy the argument that we need to change port mode dynamically
> from the driver. Set it at the device and be done.
>
Maybe as a reference this strikes me as similar to how we do multiple
device support in a single driver like ixgbe or fm10k (the two I'm most
familiar with). At probe time we read the device id and then stub in
the specific callbacks for that device.
Sorry I'm still hung up on the multiple worlds thing, is it really
trying to model different devices under a single driver? In which case
maybe rather than port mode expose it as its own device id. Just a
thought.
Also I wonder if some of these routines can be broken out more? I'm
missing how opening a port is so different across these worlds. Probably
need to poke at the qemu model a bit more.
.John
next prev parent reply other threads:[~2015-10-06 16:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 7:51 [patch net-next v3 00/14] rocker: add support for multiple worlds Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 01/14] rocker: remove unused rocker_port param from alloc funcs and shorten their names Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 02/14] rocker: rename rocker.h to rocker_hw.h Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 03/14] rocker: rename rocker.c to rocker_main.c Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 04/14] rocker: push tlv processing into separate files Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 05/14] rocker: implement set settings mode command Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 06/14] rocker: introduce worlds infrastructure Jiri Pirko
2015-10-06 16:06 ` Scott Feldman
2015-10-06 16:15 ` Jiri Pirko
2015-10-06 17:03 ` Scott Feldman
2015-10-06 16:19 ` John Fastabend [this message]
2015-10-06 17:08 ` Scott Feldman
2015-10-06 21:25 ` John Fastabend
2015-10-07 1:50 ` Scott Feldman
2015-10-07 6:14 ` Jiri Pirko
2015-10-07 15:46 ` John Fastabend
2015-10-07 17:32 ` Scott Feldman
2015-10-07 17:51 ` Jiri Pirko
2015-10-06 16:25 ` [Linux Kernel Dev- OSI lvls 2-3 Networking modules] assistance needed in Pacific Northwest US John D Allen, Leveridge Systems INC
2015-10-06 7:51 ` [patch net-next v3 07/14] rocker: introduce OF-DPA world skeleton Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 08/14] rocker: set default world on port probe and clean world on remove Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 09/14] rocker: pass "learning" value as a parameter to rocker_port_set_learning Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 10/14] rocker: pre-allocate wait structures during cmd ring init Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 11/14] rocker: remove trans parameter to rocker_cmd_exec function Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 12/14] rocker: call rocker_cmd_exec function with "nowait" boolean instead of flags Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 13/14] rocker: move OF-DPA stuff into separate file Jiri Pirko
2015-10-06 7:51 ` [patch net-next v3 14/14] rocker: return -EOPNOTSUPP for undefined world ops Jiri Pirko
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=5613F482.2010200@gmail.com \
--to=john.fastabend@gmail.com \
--cc=David.Laight@aculab.com \
--cc=ast@plumgrid.com \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
--cc=tgraf@suug.ch \
/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;
as well as URLs for NNTP newsgroup(s).