1. 24 Aug, 2022 2 commits
    • Vadim Pasternak's avatar
      mlxsw: core: Add registration APIs for system event handler · 2ab4e709
      Vadim Pasternak authored
      The purpose of system event handler is to handle system interrupts.
      Such interrupts are raised to CPU from system programmable logic
      devices, upon specific system wide changes, like line card activation
      and deactivation.
      
      The purpose is to create an alternative to trap mechanism, which
      delivers these events to driver over PCI bus, but not available for
      the driver working over I2C bus.
      
      Mechanism is system dependent and applicable only for the systems
      equipped with programmable devices with custom logic.
      
      Add APIs for event handler registration and un-registration and API
      which should be invoked from the registered callbacks when system
      interrupt is raised to CPU.
      Signed-off-by: default avatarVadim Pasternak <vadimp@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2ab4e709
    • Vadim Pasternak's avatar
      mlxsw: core_linecards: Separate line card init and fini flow · 4be4779b
      Vadim Pasternak authored
      Currently, each line card is initialized using the following steps:
      
      1. Initializing its various fields (e.g., slot index).
      2. Creating the corresponding devlink object.
      3. Enabling events (i.e., traps) for changes in line card status.
      4. Querying and processing line card status.
      
      Unlike traps, the IRQ that notifies the CPU about line card status
      changes cannot be enabled / disabled on a per line card basis.
      
      If a handler is registered before the line cards are initialized, the
      handler risks accessing uninitialized memory.
      
      On the other hand, if the handler is registered after initialization,
      we risk missing events. For example, in step 4, the driver might see
      that a line card is in ready state and will tell the device to enable
      it. When enablement is done, the line card will be activated and the
      IRQ will be triggered. Since a handler was not registered, the event
      will be missed.
      
      Solve this by splitting the initialization sequence into two steps
      (1-2 and 3-4). In a subsequent patch, the handler will be registered
      between both steps.
      Signed-off-by: default avatarVadim Pasternak <vadimp@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4be4779b
  2. 23 Aug, 2022 38 commits