1. 11 Jun, 2017 4 commits
    • Netanel Belgazal's avatar
      net: ena: fix race condition between submit and completion admin command · 661d2b0c
      Netanel Belgazal authored
      Bug:
      "Completion context is occupied" error printout will be noticed in
      dmesg.
      This error will cause the admin command to fail, which will lead to
      an ena_probe() failure or a watchdog reset (depends on which admin
      command failed).
      
      Root cause:
      __ena_com_submit_admin_cmd() is the function that submits new entries to
      the admin queue.
      The function have a check that makes sure the queue is not full and the
      function does not override any outstanding command.
      It uses head and tail indexes for this check.
      The head is increased by ena_com_handle_admin_completion() which runs
      from interrupt context, and the tail index is increased by the submit
      function (the function is running under ->q_lock, so there is no risk
      of multithread increment).
      Each command is associated with a completion context. This context
      allocated before call to __ena_com_submit_admin_cmd() and freed by
      ena_com_wait_and_process_admin_cq_interrupts(), right after the command
      was completed.
      
      This can lead to a state where the head was increased, the check passed,
      but the completion context is still in use.
      
      Solution:
      Use the atomic variable ->outstanding_cmds instead of using the head and
      the tail indexes.
      This variable is safe for use since it is bumped in get_comp_ctx() in
      __ena_com_submit_admin_cmd() and is freed by comp_ctxt_release()
      
      Fixes: 1738cd3e ("Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarNetanel Belgazal <netanel@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      661d2b0c
    • Netanel Belgazal's avatar
      net: ena: add missing return when ena_com_get_io_handlers() fails · 2d2c600a
      Netanel Belgazal authored
      Fixes: 1738cd3e ("Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarNetanel Belgazal <netanel@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d2c600a
    • Netanel Belgazal's avatar
      net: ena: fix bug that might cause hang after consecutive open/close interface. · 418df30f
      Netanel Belgazal authored
      Fixing a bug that the driver does not unmask the IO interrupts
      in ndo_open():
      occasionally, the MSI-X interrupt (for one or more IO queues)
      can be masked when ndo_close() was called.
      If that is followed by ndo open(),
      then the MSI-X will be still masked so no interrupt
      will be received by the driver.
      
      Fixes: 1738cd3e ("Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarNetanel Belgazal <netanel@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      418df30f
    • Netanel Belgazal's avatar
      net: ena: fix rare uncompleted admin command false alarm · a77c1aaf
      Netanel Belgazal authored
      The current flow to detect admin completion is:
      while (command_not_completed) {
      	if (timeout)
      		error
      
      	check_for_completion()
      		sleep()
         }
      So in case the sleep took more than the timeout
      (in case the thread/workqueue was not scheduled due to higher priority
      task or prolonged VMexit), the driver can detect a stall even if
      the completion is present.
      
      The fix changes the order of this function to first check for
      completion and only after that check if the timeout expired.
      
      Fixes: 1738cd3e ("Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarNetanel Belgazal <netanel@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a77c1aaf
  2. 10 Jun, 2017 13 commits
  3. 09 Jun, 2017 14 commits
  4. 08 Jun, 2017 9 commits