Skip to content
  1. Jun 02, 2021
  2. Jun 01, 2021
  3. May 22, 2021
  4. May 16, 2021
    • Samuel Holland's avatar
      scsi: 3w-9xxx: Fix endianness issues in command packets · 05f7f1b9
      Samuel Holland authored
      
      
      The controller expects all data it sends/receives to be little-endian.
      Therefore, the packet struct definitions should use the __le16/32/64
      types. Once those are correct, sparse reports several issues with the
      driver code, which are fixed here as well.
      
      The main issue observed was at the call to scsi_set_resid(), where the
      byteswapped parameter would eventually trigger the alignment check at
      drivers/scsi/sd.c:2009. At that point, the kernel would continuously
      complain about an "Unaligned partial completion", and no further I/O could
      occur.
      
      This gets the controller working on big endian powerpc64.
      
      Link: https://lore.kernel.org/r/20210427235915.39211-4-samuel@sholland.org
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      05f7f1b9
    • Samuel Holland's avatar
      scsi: 3w-9xxx: Reduce scope of structure packing · d133b441
      Samuel Holland authored
      
      
      Currently, all command packet structs used by this driver are packed.
      However, only one (TW_SG_Entry) actually needs to be packed, because it
      uses 64-bit addresses at 32-bit alignment. To improve the quality of
      generated code, stop packing all of the other command packet structs.  This
      requires adjusting the type of one misaligned "reserved" member.
      
      After this change, pahole reports that only one type had its layout change:
      the tw_compat_info member of TW_Device_Extension is now naturally aligned.
      
      Link: https://lore.kernel.org/r/20210427235915.39211-3-samuel@sholland.org
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      d133b441
    • Samuel Holland's avatar
      scsi: 3w-9xxx: Use flexible array members to avoid struct padding · 44c5027b
      Samuel Holland authored
      
      
      In preparation for removing the "#pragma pack(1)" from the driver, fix all
      instances where a trailing array member could be replaced by a flexible
      array member. Since a flexible array member has zero size, it introduces no
      padding, whether or not the struct is packed.
      
      Link: https://lore.kernel.org/r/20210427235915.39211-2-samuel@sholland.org
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      44c5027b