OpenCloudOS-Kernel/drivers/net/ethernet/mellanox/mlxsw
Jiri Pirko fc56be47da devlink: convert occ_get op to separate registration
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.

The example flows, as it is in mlxsw:
1) driver load/asic probe:
   mlxsw_core
      -> mlxsw_sp_resources_register
        -> mlxsw_sp_kvdl_resources_register
          -> devlink_resource_register IDX
   mlxsw_spectrum
      -> mlxsw_sp_kvdl_init
        -> mlxsw_sp_kvdl_parts_init
          -> mlxsw_sp_kvdl_part_init
            -> devlink_resource_size_get IDX (to get the current setup
                                              size from devlink)
        -> devlink_resource_occ_get_register IDX (register current
                                                  occupancy getter)
2) reload triggered by devlink command:
  -> mlxsw_devlink_core_bus_device_reload
    -> mlxsw_sp_fini
      -> mlxsw_sp_kvdl_fini
	-> devlink_resource_occ_get_unregister IDX
    (struct mlxsw_sp *mlxsw_sp is freed at this point, call to occ get
     which is using mlxsw_sp would cause use-after free)
    -> mlxsw_sp_init
      -> mlxsw_sp_kvdl_init
        -> mlxsw_sp_kvdl_parts_init
          -> mlxsw_sp_kvdl_part_init
            -> devlink_resource_size_get IDX (to get the current setup
                                              size from devlink)
        -> devlink_resource_occ_get_register IDX (register current
                                                  occupancy getter)

Fixes: d9f9b9a4d0 ("devlink: Add support for resource abstraction")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-04-08 12:45:57 -04:00
..
Kconfig mlxsw: spectrum: Don't depend on ip_gre and ip6_gre 2018-03-12 11:07:16 -04:00
Makefile mlxsw: spectrum: Move SPAN code to separate module 2018-02-13 12:26:25 -05:00
cmd.h mlxsw: pci: Remove unused bit 2017-03-08 23:17:38 -08:00
core.c mlxsw: Move "resources_query_enable" out of mlxsw_config_profile 2018-04-01 10:56:43 -04:00
core.h mlxsw: Move "resources_query_enable" out of mlxsw_config_profile 2018-04-01 10:56:43 -04:00
core_acl_flex_actions.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-03-23 11:31:58 -04:00
core_acl_flex_actions.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-03-23 11:31:58 -04:00
core_acl_flex_keys.c mlxsw: core: Introduce flexible keys support 2017-02-03 16:35:41 -05:00
core_acl_flex_keys.h mlxsw: core: Fix flex keys scratchpad offset conflict 2018-02-28 12:32:36 -05:00
core_hwmon.c ethernet: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
core_thermal.c mlxsw: core: Implement thermal zone 2016-11-22 10:04:19 -05:00
emad.h
i2c.c mlxsw: core: Add support for reload 2018-01-16 14:15:35 -05:00
i2c.h mlxsw: Introduce support for I2C bus 2016-11-16 23:29:04 -05:00
ib.h mlxsw: switchx2: Add IB port support 2016-10-30 16:50:17 -04:00
item.h mlxsw: reg: add rdpm register 2018-01-14 12:21:11 -05:00
minimal.c mlxsw: minimal: Add I2C support for Mellanox ASICs 2016-11-16 23:29:04 -05:00
pci.c mlxsw: Move "resources_query_enable" out of mlxsw_config_profile 2018-04-01 10:56:43 -04:00
pci.h mlxsw: switchib: Introduce SwitchIB and SwitchIB silicon driver 2016-10-30 16:50:17 -04:00
pci_hw.h mlxsw: pci: Wait after reset before accessing HW 2018-01-10 15:58:22 -05:00
port.h mlxsw: Query maximum number of ports from firmware 2017-03-24 13:53:28 -07:00
reg.h mlxsw: reg: Add register settings for IPv6 multicast routing 2018-03-26 13:14:44 -04:00
resources.h mlxsw: resources: Add multicast ERIF list entries resource 2017-09-19 14:21:40 -07:00
spectrum.c devlink: convert occ_get op to separate registration 2018-04-08 12:45:57 -04:00
spectrum.h devlink: convert occ_get op to separate registration 2018-04-08 12:45:57 -04:00
spectrum_acl.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-03-23 11:31:58 -04:00
spectrum_acl_flex_actions.c mlxsw: spectrum: Keep mirror netdev in mlxsw_sp_span_entry 2018-02-27 14:46:27 -05:00
spectrum_acl_flex_actions.h mlxsw: spectrum_acl: Fix flex actions header ifndef define construct 2018-04-01 10:56:41 -04:00
spectrum_acl_flex_keys.h mlxsw: spectrum: Add tos to the ipv4 acl block 2017-07-17 09:18:23 -07:00
spectrum_acl_tcam.c mlxsw: spectrum_acl: Do not invalidate already invalid ACL groups 2018-03-20 12:11:02 -04:00
spectrum_buffers.c mlxsw: spectrum_buffers: Set a minimum quota for CPU port traffic 2018-03-17 17:34:54 -04:00
spectrum_cnt.c mlxsw: spectrum: Support for counters on router interfaces 2017-03-28 17:11:55 -07:00
spectrum_cnt.h mlxsw: spectrum: Support for counters on router interfaces 2017-03-28 17:11:55 -07:00
spectrum_dcb.c mlxsw: spectrum: Do not override PAUSE settings 2016-08-08 12:57:27 -07:00
spectrum_dpipe.c mlxsw: spectrum_dpipe: Connect dpipe tables to resources 2018-01-16 14:15:35 -05:00
spectrum_dpipe.h mlxsw: spectrum_dpipe: Add initial support for the router adjacency table 2017-09-26 20:04:35 -07:00
spectrum_fid.c mlxsw: spectrum: Treat IPv6 unregistered multicast as broadcast 2018-02-28 12:32:36 -05:00
spectrum_flower.c mlxsw: spectrum: Fix gact_ok offloading 2018-03-09 13:02:13 -05:00
spectrum_ipip.c mlxsw: spectrum_ipip: Support decoding IPv6 tunnel addresses 2018-02-27 14:46:26 -05:00
spectrum_ipip.h mlxsw: spectrum_ipip: Support decoding IPv6 tunnel addresses 2018-02-27 14:46:26 -05:00
spectrum_kvdl.c devlink: convert occ_get op to separate registration 2018-04-08 12:45:57 -04:00
spectrum_mr.c mlxsw: spectrum_mr: Add ipv6 specific operations 2018-03-26 13:14:44 -04:00
spectrum_mr.h mlxsw: spectrum_mr: Add ipv6 specific operations 2018-03-26 13:14:44 -04:00
spectrum_mr_tcam.c mlxsw: spectrum_router: Support IPv6 multicast to host CPU 2018-03-26 13:14:44 -04:00
spectrum_mr_tcam.h mlxsw: spectrum: Add the multicast routing hardware logic 2017-09-27 11:33:28 -07:00
spectrum_qdisc.c mlxsw: spectrum: qdiscs: prio: Handle graft command 2018-02-28 12:06:01 -05:00
spectrum_router.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
spectrum_router.h mlxsw: spectrum_router: Support IPv6 multicast to host CPU 2018-03-26 13:14:44 -04:00
spectrum_span.c mlxsw: spectrum_span: Prevent duplicate mirrors 2018-03-23 21:50:28 -04:00
spectrum_span.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-03-23 11:31:58 -04:00
spectrum_switchdev.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-03-06 01:20:46 -05:00
switchib.c mlxsw: Move "resources_query_enable" out of mlxsw_config_profile 2018-04-01 10:56:43 -04:00
switchx2.c mlxsw: Move "resources_query_enable" out of mlxsw_config_profile 2018-04-01 10:56:43 -04:00
trap.h mlxsw: spectrum: Add multicast router trap for PIMv6 2018-03-26 13:14:45 -04:00
txheader.h