netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: Ido Schimmel <idosch@mellanox.com>,
	netdev@vger.kernel.org, davem@davemloft.net, jiri@mellanox.com,
	petrm@mellanox.com, mlxsw@mellanox.com
Subject: Re: [PATCH net-next 09/11] devlink: convert occ_get op to separate registration
Date: Tue, 3 Apr 2018 08:33:11 -0600	[thread overview]
Message-ID: <a17e5ad7-e79d-0e83-43d3-0c06b0400ed6@gmail.com> (raw)
In-Reply-To: <20180403073212.GI3313@nanopsycho>

On 4/3/18 1:32 AM, Jiri Pirko wrote:
> Fri, Mar 30, 2018 at 04:45:50PM CEST, dsahern@gmail.com wrote:
>> On 3/29/18 2:33 PM, Ido Schimmel wrote:
>>> From: Jiri Pirko <jiri@mellanox.com>
>>>
>>> This resolves race during initialization where the resources with
>>> ops are registered before driver and the structures used by occ_get
>>> op is initialized. So keep occ_get callbacks registered only when
>>> all structs are initialized.
>>
>> Why can't the occ_get handler look at some flag in an mlxsw struct to
>> know if the system has initialized?
>>
>> Separate registration here is awkward. You register a resource and then
>> register its op later.
> 
> The separation is exactly why this patch is made. Note that devlink
> resouce is registered by core way before the initialization is done and
> the driver is actually able to perform the op. Also consider "reload"

That's how you have chose to code it. I hit this problem adding devlink
to netdevsim; the solution was to fix the init order.

> case, when the resource is still registered and the driver unloads and
> loads again. For that makes perfect sense to have that separated.
> Flag would just make things odd. Also, the priv could not be used in
> that case.
> 

I am not aware of any other API where you invoked the register function
at point A and then later add the operations at point B. In every API
that comes to mind the ops are part of the register.

I am sure there are options for you to fix the init order of mlxsw
without making the devlink API awkward.

  reply	other threads:[~2018-04-03 14:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 20:33 [PATCH net-next 00/11] mlxsw: Various cleanups Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 01/11] mlxsw: spectrum_acl: Fix flex actions header ifndef define construct Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 02/11] mlxsw: spectrum_kvdl: Fix handling of resource_size_param Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 03/11] mlxsw: Constify devlink_resource_ops Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 04/11] mlxsw: spectrum: Change KVD linear parts from list to array Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 05/11] mlxsw: remove kvd_hash_granularity from config profile struct Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 06/11] mlxsw: core: Fix arg name of MLXSW_CORE_RES_VALID and MLXSW_CORE_RES_GET Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 07/11] mlxsw: Move "used_kvd_sizes" check to mlxsw_pci_config_profile Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 08/11] mlxsw: Move "resources_query_enable" out of mlxsw_config_profile Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 09/11] devlink: convert occ_get op to separate registration Ido Schimmel
2018-03-30 14:45   ` David Ahern
2018-04-01  7:44     ` Ido Schimmel
2018-04-03  7:32     ` Jiri Pirko
2018-04-03 14:33       ` David Ahern [this message]
2018-04-03 15:30         ` Jiri Pirko
2018-04-04  0:47           ` David Ahern
2018-04-04  6:25             ` Jiri Pirko
2018-04-04 22:59               ` Jakub Kicinski
2018-04-04 23:00                 ` David Ahern
2018-04-05  5:36                   ` Jiri Pirko
2018-03-29 20:33 ` [PATCH net-next 10/11] mlxsw: spectrum: Pass mlxsw_core as arg of mlxsw_sp_kvdl_resources_register() Ido Schimmel
2018-03-29 20:33 ` [PATCH net-next 11/11] mlxsw: spectrum: Don't use resource ID of 0 Ido Schimmel
2018-04-01  1:54 ` [PATCH net-next 00/11] mlxsw: Various cleanups David Miller
2018-04-01  2:14   ` David Miller
2018-04-01  7:52     ` Ido Schimmel

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=a17e5ad7-e79d-0e83-43d3-0c06b0400ed6@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@mellanox.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).