1. 22 9月, 2016 1 次提交
    • J
      net/mlx4_core: Fix deadlock when switching between polling and event fw commands · a7e1f049
      Jack Morgenstein 提交于
      When switching from polling-based fw commands to event-based fw
      commands, there is a race condition which could cause a fw command
      in another task to hang: that task will keep waiting for the polling
      sempahore, but may never be able to acquire it. This is due to
      mlx4_cmd_use_events, which "down"s the sempahore back to 0.
      
      During driver initialization, this is not a problem, since no other
      tasks which invoke FW commands are active.
      
      However, there is a problem if the driver switches to polling mode
      and then back to event mode during normal operation.
      
      The "test_interrupts" feature does exactly that.
      Running "ethtool -t <eth device> offline" causes the PF driver to
      temporarily switch to polling mode, and then back to event mode.
      (Note that for VF drivers, such switching is not performed).
      
      Fix this by adding a read-write semaphore for protection when
      switching between modes.
      
      Fixes: 225c7b1f ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NMatan Barak <matanb@mellanox.com>
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a7e1f049
  2. 16 6月, 2016 1 次提交
    • E
      net/mlx4_en: initialize cmd.context_lock spinlock earlier · 0c5ddb51
      Eric Dumazet 提交于
      Maciej Żenczykowski reported lockdep warning a spinlock
      was not registered before being held in mlx4_cmd_wake_completions()
      
      cmd.context_lock initialization is not at the right place.
      
      1) mlx4_cmd_use_events() can be called multiple times.
         Calling spin_lock_init() on a live spinlock can lead
         to hangs.
      
      2) mlx4_cmd_wake_completions() can be called while lock
         has not been initialized.
         Lockdep complains, and current logic is not race prone.
      
      It seems better to move the initialization earlier in
      mlx4_load_one()
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: NMaciej Żenczykowski <maze@google.com>
      Cc: Eugenia Emantayev <eugenia@mellanox.com>
      Cc: Tariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c5ddb51
  3. 12 2月, 2016 1 次提交
  4. 09 12月, 2015 1 次提交
  5. 28 10月, 2015 1 次提交
    • C
      net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes · c02b0501
      Carol L Soto 提交于
      When doing memcpy/memset of EQEs, we should use sizeof struct
      mlx4_eqe as the base size and not caps.eqe_size which could be bigger.
      
      If caps.eqe_size is bigger than the struct mlx4_eqe then we corrupt
      data in the master context.
      
      When using a 64 byte stride, the memcpy copied over 63 bytes to the
      slave_eq structure.  This resulted in copying over the entire eqe of
      interest, including its ownership bit -- and also 31 bytes of garbage
      into the next WQE in the slave EQ -- which did NOT include the ownership
      bit (and therefore had no impact).
      
      However, once the stride is increased to 128, we are overwriting the
      ownership bits of *three* eqes in the slave_eq struct.  This results
      in an incorrect ownership bit for those eqes, which causes the eq to
      seem to be full. The issue therefore surfaced only once 128-byte EQEs
      started being used in SRIOV and (overarchitectures that have 128/256
      byte cache-lines such as PPC) - e.g after commit 77507aa2
      "net/mlx4_core: Enable CQE/EQE stride support".
      
      Fixes: 08ff3235 ('mlx4: 64-byte CQE/EQE support')
      Signed-off-by: NCarol L Soto <clsoto@linux.vnet.ibm.com>
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c02b0501
  6. 27 7月, 2015 1 次提交
    • J
      net/mlx4_core: Relieve cpu load average on the port sending flow · 9f5b0317
      Jack Morgenstein 提交于
      When a port is not attached, the FW requires a longer than usual time to
      execute the SENSE_PORT command. In the command flow, the
      wait_for_completion_timeout call used in mlx4_cmd_wait puts the kernel
      thread into the uninterruptible state during this time. This, in turn,
      due to the computation method, causes the CPU load average to increase.
      
      Fix this by using wait_for_completion_interruptible_timeout() for the
      SENSE_PORT command, which puts the thread in the interruptible state.
      In this state, the thread does not contribute to the CPU load average.
      
      Treat the interrupted case as if the SENSE_PORT command returned
      port_type = NONE.
      
      Fix suggested by Gideon Naim <gideonn@mellanox.com> and
      Bart Van Assche <bart.vanassche@sandisk.com>.
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9f5b0317
  7. 16 6月, 2015 2 次提交
  8. 04 6月, 2015 1 次提交
  9. 28 5月, 2015 1 次提交
  10. 25 5月, 2015 2 次提交
  11. 16 4月, 2015 2 次提交
  12. 07 4月, 2015 1 次提交
  13. 03 4月, 2015 7 次提交
  14. 25 3月, 2015 1 次提交
    • J
      net/mlx4_core: Fix GEN_EQE accessing uninitialixed mutex · bffb023a
      Jack Morgenstein 提交于
      We occasionally see in procedure mlx4_GEN_EQE that the driver tries
      to grab an uninitialized mutex.
      
      This can occur in only one of two ways:
      1. We are trying to generate an async event on an uninitialized slave.
      2. We are trying to generate an async event on an illegal slave number
         ( < 0 or > persist->num_vfs) or an inactive slave.
      
      To deal with #1: move the mutex initialization from specific slave init
      sequence in procedure mlx_master_do_cmd to mlx4_multi_func_init() (so that
      the mutex is always initialized for all slaves).
      
      To deal with #2: check in procedure mlx4_GEN_EQE that the slave number
      provided is in the proper range and that the slave is active.
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bffb023a
  15. 07 3月, 2015 1 次提交
  16. 05 2月, 2015 1 次提交
  17. 28 1月, 2015 2 次提交
  18. 26 1月, 2015 4 次提交
    • Y
      net/mlx4_core: Reset flow activation upon SRIOV fatal command cases · 0cd93027
      Yishai Hadas 提交于
      When SRIOV commands are executed over the comm-channel and get
      a fatal error (e.g. timeout, closing command failure) the VF enters
      into error state and reset flow is activated.
      
      To be able to recognize whether the failure was on a closing command, the
      operational code for the given VHCR command is used. Once the device entered
      into an error state we prevent redundant error messages from being printed.
      Signed-off-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0cd93027
    • Y
      net/mlx4_core: Enable device recovery flow with SRIOV · 55ad3592
      Yishai Hadas 提交于
      In SRIOV, both the PF and the VF may attempt device recovery whenever they
      assume that the device is not functioning.  When the PF driver resets the
      device, the VF should detect this and attempt to reinitialize itself.
      
      The VF must be able to reset itself under all circumstances, even
      if the PF is not responsive.
      
      The VF shall reset itself in the following cases:
      
      1. Commands are not processed within reasonable time over the communication channel.
      This is done considering device state and the correct return code based on
      the command as was done in the native mode, done in the next patch.
      
      2. The VF driver receives an internal error event reported by the PF on the
      communication channel. This occurs when the PF driver resets the device or
      when VF is out of sync with the PF.
      
      Add 'VF reset' capability, which allows the VF to reinitialize itself even when the
      PF is not responsive.
      
      As PF and VF may run their reset flow simulantanisly, there are several cases
      that are handled:
      - Prevent freeing VF resources upon FLR, when PF is in its unloading stage.
      - Prevent PF getting VF commands before it has finished initializing its resources.
      - Upon VF startup, check that comm-channel is online before sending
        commands to the PF and getting timed-out.
      Signed-off-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55ad3592
    • Y
      net/mlx4_core: Activate reset flow upon fatal command cases · f5aef5aa
      Yishai Hadas 提交于
      We activate reset flow upon command fatal errors, when the device enters an
      erroneous state, and must be reset.
      
      The cases below are assumed to be fatal: FW command timed-out, an error from FW
      on closing commands, pci is offline when posting/pending a command.
      
      In those cases we place the device into an error state: chip is reset, pending
      commands are awakened and completed immediately. Subsequent commands will
      return immediately.
      
      The return code in the above cases will depend on the command. Commands which
      free and close resources will return success (because the chip was reset, so
      callers may safely free their kernel resources). Other commands will return -EIO.
      
      Since the device's state was marked as error, the catas poller will
      detect this and restart the device's software stack (as is done when a FW
      internal error is directly detected). The device state is protected by a
      persistent mutex lives on its mlx4_dev, as such no need any more for the
      hcr_mutex which is removed.
      Signed-off-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f5aef5aa
    • Y
      net/mlx4_core: Maintain a persistent memory for mlx4 device · 872bf2fb
      Yishai Hadas 提交于
      Maintain a persistent memory that should survive reset flow/PCI error.
      This comes as a preparation for coming series to support above flows.
      Signed-off-by: NYishai Hadas <yishaih@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      872bf2fb
  19. 14 11月, 2014 1 次提交
  20. 04 11月, 2014 2 次提交
  21. 29 10月, 2014 1 次提交
  22. 01 10月, 2014 1 次提交
    • J
      net/mlx4_core: Deprecate error message at ConnectX-2 cards startup to debug · 1daa4303
      Jack Morgenstein 提交于
      ConnectX2 HCAs have max_mtu=4k and max_vl=8 vls. However, if you specify
      a 4K mtu, the max_vl supported for 4K is 4 vls. The driver at startup
      attempts to set a 4K mtu using the max_vl value obtained from QUERY_PORT.
      
      Since the max_vl value is 8 vls (which is supported up to 2K mtu size),
      the first attempt to set the mtl/vl port value will fail, generating
      the following error message in the log:
      
        mlx4_core 0000:06:00.0: command 0xc failed: fw status = 0x40
      
      The driver then tries again, using mtu=4k, vls=4, and this succeeds.
      
      Since we do not want to have this error message always displayed at driver
      start when there are ConnectX2 HCAs on the host, we deprecate the error
      message for this specific command/input_modifier/opcode_modifier/fw-status
      to be debug.
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1daa4303
  23. 11 9月, 2014 1 次提交
  24. 01 9月, 2014 1 次提交
  25. 05 8月, 2014 1 次提交
    • J
      mlx4_core: Add support for secure-host and SMP firewall · 114840c3
      Jack Morgenstein 提交于
      Secure-host is the general term for the capability of a device
      to protect itself and the subnet from malicious host software.
      
      This is achieved by:
      1. Not allowing un-trusted entities to access device configuration
         registers, directly (through pci_cr or pci_conf) and indirectly
         (through MADs).
      
      2. Hiding M_Key from untrusted entities.
      
      3. Preventing the modification of GUID0 by un-trusted entities
      
      4. Not allowing drivers on untrusted hosts to receive nor to transmit
         packets over QP0 (SMP Firewall).
      
      The secure-host capability depends on firmware handling all QP0
      packets, and not passing these packets up to the driver. Any information
      required by the driver for proper operation (e.g., SM lid) is passed
      via events generated by the firmware while processing QP0 MADs.
      
      Driver support mainly requires using the MAD_DEMUX FW command at startup,
      where the feature is enabled/disabled through a procedure described in
      the Mellanox HCA tools package.
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      
      [ Fix error path in mlx4_setup_hca to go to err_mcg_table_free. - Roland ]
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      114840c3
  26. 30 5月, 2014 1 次提交