1. 26 Aug, 2024 9 commits
    • Aleksandr Mishin's avatar
      ice: Adjust over allocation of memory in ice_sched_add_root_node() and ice_sched_add_node() · 62fdaf9e
      Aleksandr Mishin authored
      In ice_sched_add_root_node() and ice_sched_add_node() there are calls to
      devm_kcalloc() in order to allocate memory for array of pointers to
      'ice_sched_node' structure. But incorrect types are used as sizeof()
      arguments in these calls (structures instead of pointers) which leads to
      over allocation of memory.
      
      Adjust over allocation of memory by correcting types in devm_kcalloc()
      sizeof() arguments.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Signed-off-by: default avatarAleksandr Mishin <amishin@t-argos.ru>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      62fdaf9e
    • Sergey Temerkhanov's avatar
      ice: Report NVM version numbers on mismatch during load · b1703d5f
      Sergey Temerkhanov authored
      Report NVM version numbers (both detected and expected) when a mismatch b/w
      driver and firmware is detected. This provides more useful information
      about which NVM version the driver expects, rather than requiring manual
      code inspection.
      Signed-off-by: default avatarSergey Temerkhanov <sergey.temerkhanov@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      b1703d5f
    • Jacob Keller's avatar
      ice: remove unnecessary control queue cmd_buf arrays · 448711c1
      Jacob Keller authored
      The driver allocates a cmd_buf array in addition to the desc_buf array.
      This array stores an ice_sq_cd command details structure for each entry in
      the control queue ring.
      
      The contents of the structure are copied from the value passed in via
      ice_sq_send_cmd, and include only a pointer to storage for the write back
      descriptor contents.
      
      Originally this array was intended to support asynchronous completion
      including features such as a callback function. This support was never
      implemented. All that exists today is needless copying and resetting of a
      cmd_buf array that is otherwise functionally unused.
      
      Since we do not plan to implement asynchronous completions, drop this
      unnecessary memory and logic. This saves memory for each control queue, and
      avoids the pointless copying and memset.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      448711c1
    • Jacob Keller's avatar
      ice: reword comments referring to control queues · 1d95d925
      Jacob Keller authored
      Many comments in ice_controlq.c use the term "Admin queue" despite the code
      being intended for arbitrary control queues, not just the Admin queue.
      Reword the comments to make it clear that this code is the generic control
      queue logic that is shared by all of the control queues, and is not
      specific to the Admin queue.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      1d95d925
    • Przemek Kitszel's avatar
      ice: stop intermixing AQ commands/responses debug dumps · 74ce564a
      Przemek Kitszel authored
      The ice_debug_cq() function is called to generate a debug log of control
      queue messages both sent and received. It currently does this over a
      potential total of 6 different printk invocations.
      
      The main logic prints over 4 calls to ice_debug():
      
       1. The metadata including opcode, flags, datalength and return value.
       2. The cookie in the descriptor.
       3. The parameter values.
       4. The address for the databuffer.
      
      In addition, if the descriptor has a data buffer, it can be logged with two
      additional prints:
      
       5. A message indicating the start of the data buffer.
       6. The actual data buffer, printed using print_hex_dump_debug.
      
      This can lead to trouble in the event that two different PFs are logging
      messages. The messages become intermixed and it may not be possible to
      determine which part of the output belongs to which control queue message.
      
      To fix this, it needs to be possible to unambiguously determine which
      messages belong together. This is trivial for the messages that comprise
      the main printing. Combine them together into a single invocation of
      ice_debug().
      
      The message containing a hex-dump of the data buffer is a bit more
      complicated. This is printed separately as part of print_hex_dump_debug.
      This function takes a prefix, which is currently always set to
      KBUILD_MODNAME. Extend this prefix to include the buffer address for the
      databuffer, which is printed as part of the main print, and which is
      guaranteed to be unique for each buffer.
      
      Refactor the ice_debug_array(), introducing an ice_debug_array_w_prefix().
      Build the prefix by combining KBUILD_MODNAME with the databuffer address
      using snprintf().
      
      These changes make it possible to unambiguously determine what data belongs
      to what control queue message.
      Reported-by: default avatarJacek Wierzbicki <jacek.wierzbicki@intel.com>
      Signed-off-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      74ce564a
    • Bruce Allan's avatar
      ice: do not clutter debug logs with unused data · 6bd7cb52
      Bruce Allan authored
      Currently, debug logs are unnecessarily cluttered with the contents of
      command data buffers even if the receiver of that command (i.e. FW or MBX)
      are not told to read the buffer.  Change to only log command data buffers
      when the RD flag (indicates receiver needs to read the buffer) is set.
      Continue to log response data buffer when the returned datalen is non-zero.
      
      Also, rename a local variable to reflect what is in the hardware
      specification and how it is used elsewhere in the code, use local variables
      instead of duplicating endian conversions unnecessarily and remove an
      unnecessary assignment.
      Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      6bd7cb52
    • Jacob Keller's avatar
      ice: improve debug print for control queue messages · caf4daae
      Jacob Keller authored
      The ice_debug_cq function is called to print debug data for a control queue
      descriptor in multiple places. This includes both before we send a message
      on a transmit queue, after the writeback completion of a message on the
      transmit queue, and when we receive a message on a receive queue.
      
      This function does not include data about *which* control queue the message
      is on, nor whether it was what we sent to the queue or what we received
      from the queue.
      
      Modify ice_debug_cq to take two extra parameters, a pointer to the control
      queue and a boolean indicating if this was a response or a command. Improve
      the debug messages by replacing "CQ CMD" with a string indicating which
      specific control queue (based on cq->qtype) and whether this was a command
      sent by the PF or a response from the queue.
      
      This helps make the log output easier to understand and consume when
      debugging.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      caf4daae
    • Jacob Keller's avatar
      ice: implement and use rd32_poll_timeout for ice_sq_done timeout · 5f6df173
      Jacob Keller authored
      The ice_sq_done function is used to check the control queue head register
      and determine whether or not the control queue processing is done. This
      function is called in a loop checking against jiffies for a specified
      timeout.
      
      The pattern of reading a register in a loop until a condition is true or a
      timeout is reached is a relatively common pattern. In fact, the kernel
      provides a read_poll_timeout function implementing this behavior in
      <linux/iopoll.h>
      
      Use of read_poll_timeout is preferred over directly coding these loops.
      However, using it in the ice driver is a bit more difficult because of the
      rd32 wrapper. Implement a rd32_poll_timeout wrapper based on
      read_poll_timeout.
      
      Refactor ice_sq_done to use rd32_poll_timeout, replacing the loop calling
      ice_sq_done in ice_sq_send_cmd. This simplifies the logic down to a single
      ice_sq_done() call.
      
      The implementation of rd32_poll_timeout uses microseconds for its timeout
      value, so update the CQ timeout macros used to be specified in microseconds
      units as well instead of using HZ for jiffies.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      5f6df173
    • Christophe JAILLET's avatar
      net: netlink: Remove the dump_cb_mutex field from struct netlink_sock · 18aaa82b
      Christophe JAILLET authored
      Commit 5fbf57a9 ("net: netlink: remove the cb_mutex "injection" from
      netlink core") has removed the usage of the 'dump_cb_mutex' field from the
      struct netlink_sock.
      
      Remove the field itself now. It saves a few bytes in the structure.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18aaa82b
  2. 24 Aug, 2024 1 commit
  3. 23 Aug, 2024 27 commits
  4. 22 Aug, 2024 3 commits