From: Jakub Kicinski <kubakici@wp.pl>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com
Subject: Re: [PATCH net-next 2/4] nfp: register ports as devlink ports
Date: Wed, 24 May 2017 12:24:13 -0700 [thread overview]
Message-ID: <20170524122413.702e0eef@cakuba.netronome.com> (raw)
In-Reply-To: <20170524123514.GB1908@nanopsycho>
On Wed, 24 May 2017 14:35:14 +0200, Jiri Pirko wrote:
> >+void nfp_devlink_port_unregister(struct nfp_port *port)
> >+{
> >+ /* Due to unpleasant lock ordering we may see the port go away before
> >+ * we have fully probed.
>
> Could you elaborate on this a bit more please?
It's partially due to peculiarities of the management FW more than
kernel stuff. Unfortunately some ethtool media config requires reboot
to be applied, so we print a friendly message to the logs and
unregister the associated netdevs. Which means once netdevs get
registered ports may go away.
Enter devlink, I need the ability to grab the adapater lock in
split/unsplit callbacks to find the ports, which implies having to drop
that lock before I register devlink. And only after I register devlink
can I register the ports.
I could do init without registering anything, drop the adapter lock,
register devlink, and then grab the adapter lock back and register
devlink ports and netdevs. But there is another issue...
Since I look for ports on a list maintained in the adapter struct,
driver code doesn't care if devlink_port has been registered or not.
The moment devlink is registered, split/unsplit requests will be
accepted - potentially trying to unregister devlink_port before the
register could happen.
Further down the line, also, the eswitch mode setting is coming. Which
means the moment I register devlink itself ports will get shuffled (due
to the plan of registering VFs as ports :)).
I feel like registering devlink should be the last action of the
driver, really. My plan was to keep that simple if() for now, and once
we get to extending devlink with SR-IOV stuff also add the ability to
pre-register ports. Allow registering ports on not-yet-registered
devlink (probably put them on a private list within struct devlink).
This would make devlink_register() a single point when everything
devlink becomes visible, atomically, instead of devlink itself coming
first and then ports following.
Does that make sense? Am I misreading the code (again :S)?
next prev parent reply other threads:[~2017-05-24 19:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 15:12 [PATCH net-next 0/4] nfp: devlink port implementation Jakub Kicinski
2017-05-23 15:12 ` [PATCH net-next 1/4] nfp: add devlink support Jakub Kicinski
2017-05-23 15:12 ` [PATCH net-next 2/4] nfp: register ports as devlink ports Jakub Kicinski
2017-05-24 12:35 ` Jiri Pirko
2017-05-24 19:24 ` Jakub Kicinski [this message]
2017-05-25 8:20 ` Jiri Pirko
2017-05-23 15:12 ` [PATCH net-next 3/4] nfp: calculate total port lanes for split Jakub Kicinski
2017-05-23 15:12 ` [PATCH net-next 4/4] nfp: support port splitting via devlink 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=20170524122413.702e0eef@cakuba.netronome.com \
--to=kubakici@wp.pl \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/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).