From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com
Subject: Re: [patch net-next rfc 00/15] netdevsim: impement proper device model
Date: Tue, 16 Apr 2019 10:58:53 -0700 [thread overview]
Message-ID: <20190416105853.6c39b9c2@cakuba.netronome.com> (raw)
In-Reply-To: <20190416085312.GB2122@nanopsycho>
On Tue, 16 Apr 2019 10:53:12 +0200, Jiri Pirko wrote:
> Mon, Apr 15, 2019 at 09:27:09PM CEST, jakub.kicinski@netronome.com wrote:
> >On Sat, 13 Apr 2019 18:20:57 +0200, Jiri Pirko wrote:
> >> From: Jiri Pirko <jiri@mellanox.com>
> >>
> >> Currently the model of netdevsim is a bit odd in multiple ways.
> >> 1) devlink instance is not in any way related with actual netdevsim
> >> netdevices. Instead, it is created per-namespace.
> >> 2) multi-port netdevsim device is done using "link" attribute.
> >> 3) netdevsim bus is there only to have something to bind the netdev to,
> >> it really does not act as a bus.
> >
> >Nope, it's there to expose SR-IOV ops :)
>
> They are not on the bus, they are on the device.
Right, I'm just explaining why there is a device in the first place.
> >> 4) netdevsim instances are created by "ip link add" which is great for
> >> soft devices with no hw backend. The rtnl core allocates netdev and
> >> calls into driver holding rtnl mutex. For hw-backed devices, this
> >> flow is wrong as it breaks order in which things are done.
> >>
> >> This patchset adjust netdevsim to fix all above.
> >>
> >> In order to support proper devlink and devlink port instances and to be
> >> able to emulate real devices, there is need to implement bus probe and
> >> instantiate everything from there. User can specify device id and port
> >> count to be instantianted. For example:
> >>
> >> echo "10 4" > /sys/bus/netdevsim/new_device
> >
> >I really don't like the design where ID has to be allocated by user
> >space. It's a step back.
>
> The reason is the then the address, devlink handles and netdev names are
> predictable. If it would be auto-generated, how could you know what did
> you just created?
>
> >I also dislike declaring ports from the start. In real drivers ports
> >are never "atomically" registered, they are crated and destroyed one
> >by one, and a lot of races/UAFs/bugs lie in those small periods of
> >time where one netdev got unregistered, but other are still around...
>
> So what do you suggest?
I haven't looked at this in detail. One quick idea is perhaps to
remember what ID was used after the write on the file descriptor,
and then next read would return the ID?
> >> Then devlink shows this:
> >>
> >> $ devlink dev
> >> netdevsim/netdevsim10
> >>
> >> $ devlink port
> >> netdevsim/netdevsim10/0: type eth netdev netdevsim10p1 flavour physical
> >> netdevsim/netdevsim10/1: type eth netdev netdevsim10p2 flavour physical
> >> netdevsim/netdevsim10/2: type eth netdev netdevsim10p3 flavour physical
> >> netdevsim/netdevsim10/3: type eth netdev netdevsim10p4 flavour physical
> >>
> >> Debugfs topology is also adjusted a bit. The rest stays the same as
> >> before.
> >>
> >> TODO:
> >> - teach udev to rename netdevsim netdevices similarly to pci netdevices
> >
> >So we can test udev as well?
>
> https://github.com/systemd/systemd/pull/12328
>
> >> - fix tools/testing/selftests/bpf/test_offload.py to work with new iface
> >
> >That'd step 0 :)
> >
> >BTW are you testing all this with the various sysfs/kobject debug
> >checks? I don't remember all the deets now, but there were certainly
> >ordering considerations coming from there.
>
> Yes.
Cool :)
next prev parent reply other threads:[~2019-04-16 17:59 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-13 16:20 [patch net-next rfc 00/15] netdevsim: impement proper device model Jiri Pirko
2019-04-13 16:20 ` [patch net-next rfc 01/15] netdevsim: move device registration on bus to be done earlier in init Jiri Pirko
2019-04-13 16:20 ` [patch net-next rfc 02/15] netdevsim: create devlink instance per netdevsim instance Jiri Pirko
2019-04-15 2:24 ` David Ahern
2019-04-15 5:41 ` Jiri Pirko
2019-04-15 15:07 ` David Ahern
2019-04-15 15:39 ` Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 03/15] netdevsim: rename devlink.c to dev.c to contain per-dev(asic) items Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 04/15] netdevsim: put netdevsim bus code into separate file Jiri Pirko
2019-04-14 20:27 ` David Miller
2019-04-15 5:40 ` Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 05/15] netdevsim: move device registration and related code to bus.c Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 06/15] netdevsim: add stub netdevsim driver implementation Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 07/15] netdevsim: use ida for bus device ids Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 08/15] netdevsim: add bus attributes to add new and delete devices Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 09/15] netdevsim: rename dev_init/exit() functions and make them independent on ns Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 10/15] netdevsim: merge sdev into dev Jiri Pirko
2019-04-15 20:49 ` Jakub Kicinski
2019-04-16 8:49 ` Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 11/15] netdevsim: generate random switch id instead of using dev id Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 12/15] netdevsim: change debugfs tree topology Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 13/15] netdevsim: implement dev probe/remove skeleton with port initialization Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 14/15] netdevsim: move netdev creation/destruction to dev probe Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 15/15] netdevsim: implement ndo_get_devlink_port Jiri Pirko
2019-04-15 19:27 ` [patch net-next rfc 00/15] netdevsim: impement proper device model Jakub Kicinski
2019-04-16 8:53 ` Jiri Pirko
2019-04-16 17:58 ` Jakub Kicinski [this message]
2019-04-16 8:59 ` Jiri Pirko
2019-04-16 18:04 ` Jakub Kicinski
2019-04-18 7:22 ` Jiri Pirko
2019-04-18 17:07 ` Jakub Kicinski
2019-04-19 5:25 ` Jiri Pirko
2019-04-19 21:00 ` Jakub Kicinski
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=20190416105853.6c39b9c2@cakuba.netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
/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).