1. 20 Aug, 2019 27 commits
  2. 13 Aug, 2019 13 commits
    • Masahiro Yamada's avatar
      scsi: use __u{8,16,32,64} instead of uint{8,16,32,64}_t in uapi headers · 075c2b6b
      Masahiro Yamada authored
      When CONFIG_UAPI_HEADER_TEST=y, exported headers are compile-tested to make
      sure they can be included from user-space.
      
      Currently, scsi_bsg_fc.h, scsi_netlink.h, and scsi_netlink_fc.h are
      excluded from the test coverage. To make them join the compile-test, we
      need to fix the build errors attached below.
      
      For a case like this, we decided to use __u{8,16,32,64} variable types in
      this discussion:
      
        https://lkml.org/lkml/2019/6/5/18
      
      Build log:
      
        CC      usr/include/scsi/scsi_netlink_fc.h.s
        CC      usr/include/scsi/scsi_netlink.h.s
        CC      usr/include/scsi/scsi_bsg_fc.h.s
      In file included from ./usr/include/scsi/scsi_netlink_fc.h:10:0,
                       from <command-line>:32:
      ./usr/include/scsi/scsi_netlink.h:29:2: error: unknown type name  uint8_t
        uint8_t version;
        ^~~~~~~
      ./usr/include/scsi/scsi_netlink.h:30:2: error: unknown type name  uint8_t
        uint8_t transport;
        ^~~~~~~
      ./usr/include/scsi/scsi_netlink.h:31:2: error: unknown type name  uint16_t
        uint16_t magic;
        ^~~~~~~~
      ./usr/include/scsi/scsi_netlink.h:32:2: error: unknown type name  uint16_t
        uint16_t msgtype;
        ^~~~~~~~
        CC      usr/include/rdma/vmw_pvrdma-abi.h.s
      ./usr/include/scsi/scsi_netlink.h:33:2: error: unknown type name  uint16_t
        uint16_t msglen;
        ^~~~~~~~
      ./usr/include/scsi/scsi_netlink.h:34:33: error:  uint64_t  undeclared here (not in a function); did you mean  __uint128_t ?
       } __attribute__((aligned(sizeof(uint64_t))));
                                       ^~~~~~~~
                                       __uint128_t
      ./usr/include/scsi/scsi_netlink.h:78:2: error: expected specifier-qualifier-list before  uint64_t
        uint64_t vendor_id;
        ^~~~~~~~
      In file included from <command-line>:32:0:
      ./usr/include/scsi/scsi_netlink_fc.h:46:2: error: expected specifier-qualifier-list before  uint64_t
        uint64_t seconds;
        ^~~~~~~~
      make[2]: *** [scripts/Makefile.build;302: usr/include/scsi/scsi_netlink_fc.h.s] Error 1
      make[2]: *** Waiting for unfinished jobs....
      In file included from <command-line>:32:0:
      ./usr/include/scsi/scsi_netlink.h:29:2: error: unknown type name  uint8_t
        uint8_t version;
        ^~~~~~~
      ./usr/include/scsi/scsi_netlink.h:30:2: error: unknown type name  uint8_t
        uint8_t transport;
        ^~~~~~~
      ./usr/include/scsi/scsi_netlink.h:31:2: error: unknown type name  uint16_t
        uint16_t magic;
        ^~~~~~~~
      ./usr/include/scsi/scsi_netlink.h:32:2: error: unknown type name  uint16_t
        uint16_t msgtype;
        ^~~~~~~~
      ./usr/include/scsi/scsi_netlink.h:33:2: error: unknown type name  uint16_t
        uint16_t msglen;
        ^~~~~~~~
      ./usr/include/scsi/scsi_netlink.h:34:33: error:  uint64_t  undeclared here (not in a function); did you mean  __uint128_t ?
       } __attribute__((aligned(sizeof(uint64_t))));
                                       ^~~~~~~~
                                       __uint128_t
      ./usr/include/scsi/scsi_netlink.h:78:2: error: expected specifier-qualifier-list before  uint64_t
        uint64_t vendor_id;
        ^~~~~~~~
      make[2]: *** [scripts/Makefile.build;302: usr/include/scsi/scsi_netlink.h.s] Error 1
      In file included from <command-line>:32:0:
      ./usr/include/scsi/scsi_bsg_fc.h:69:2: error: unknown type name  uint8_t
        uint8_t  reserved;
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:72:2: error: unknown type name  uint8_t
        uint8_t  port_id[3];
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:90:2: error: unknown type name  uint8_t
        uint8_t  reserved;
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:93:2: error: unknown type name  uint8_t
        uint8_t  port_id[3];
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:114:2: error: unknown type name  uint8_t
        uint8_t  command_code;
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:117:2: error: unknown type name  uint8_t
        uint8_t  port_id[3];
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:154:2: error: unknown type name  uint32_t
        uint32_t status;  /* See FC_CTELS_STATUS_xxx */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:158:3: error: unknown type name  uint8_t
         uint8_t action;  /* fragment_id for CT REJECT */
         ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:159:3: error: unknown type name  uint8_t
         uint8_t reason_code;
         ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:160:3: error: unknown type name  uint8_t
         uint8_t reason_explanation;
         ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:161:3: error: unknown type name  uint8_t
         uint8_t vendor_unique;
         ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:177:2: error: unknown type name  uint8_t
        uint8_t  reserved;
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:180:2: error: unknown type name  uint8_t
        uint8_t  port_id[3];
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:185:2: error: unknown type name  uint32_t
        uint32_t preamble_word0; /* revision & IN_ID */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:186:2: error: unknown type name  uint32_t
        uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:187:2: error: unknown type name  uint32_t
        uint32_t preamble_word2; /* Cmd Code, Max Size */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:207:2: error: unknown type name  uint64_t
        uint64_t vendor_id;
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:210:2: error: unknown type name  uint32_t
        uint32_t vendor_cmd[0];
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:217:2: error: unknown type name  uint32_t
        uint32_t vendor_rsp[0];
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:236:2: error: unknown type name  uint8_t
        uint8_t els_code;
        ^~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:254:2: error: unknown type name  uint32_t
        uint32_t preamble_word0; /* revision & IN_ID */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:255:2: error: unknown type name  uint32_t
        uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:256:2: error: unknown type name  uint32_t
        uint32_t preamble_word2; /* Cmd Code, Max Size */
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:268:2: error: unknown type name  uint32_t
        uint32_t msgcode;
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:292:2: error: unknown type name  uint32_t
        uint32_t result;
        ^~~~~~~~
      ./usr/include/scsi/scsi_bsg_fc.h:295:2: error: unknown type name  uint32_t
        uint32_t reply_payload_rcv_len;
        ^~~~~~~~
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      075c2b6b
    • Frederick Lawler's avatar
      scsi: esas2r: Prefer pcie_capability_read_word() · 2b4f4cb9
      Frederick Lawler authored
      Commit 8c0d3a02 ("PCI: Add accessors for PCI Express Capability") added
      accessors for the PCI Express Capability so that drivers didn't need to be
      aware of differences between v1 and v2 of the PCI Express Capability.
      
      Replace pci_read_config_word() and pci_write_config_word() calls with
      pcie_capability_read_word() and pcie_capability_write_word().
      Signed-off-by: default avatarFrederick Lawler <fred@fredlawl.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      2b4f4cb9
    • Frederick Lawler's avatar
      scsi: csiostor: Prefer pcie_capability_read_word() · 3e76ca95
      Frederick Lawler authored
      Commit 8c0d3a02 ("PCI: Add accessors for PCI Express Capability") added
      accessors for the PCI Express Capability so that drivers didn't need to be
      aware of differences between v1 and v2 of the PCI Express Capability.
      
      Replace pci_read_config_word() and pci_write_config_word() calls with
      pcie_capability_read_word() and pcie_capability_write_word().
      Signed-off-by: default avatarFrederick Lawler <fred@fredlawl.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      3e76ca95
    • Colin Ian King's avatar
      scsi: sym53c8xx_2: remove redundant assignment to retv · 1d4f4a5e
      Colin Ian King authored
      Variable retv is initialized to a value that is never read and it is
      re-assigned later. The initialization is redundant and can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      1d4f4a5e
    • Christophe JAILLET's avatar
      scsi: pmcraid: Fix a typo - pcmraid --> pmcraid · 18daf910
      Christophe JAILLET authored
      This should be 'pmcraid', not 'pcmraid'
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      18daf910
    • Gustavo A. R. Silva's avatar
      scsi: fas216: Mark expected switch fall-throughs · dbe447ac
      Gustavo A. R. Silva authored
      Mark switch cases where we are expecting to fall through.
      
      Fix the following warnings (Building: rpc_defconfig arm):
      
      drivers/scsi/arm/fas216.c: In function  fas216_disconnect_intr :
      drivers/scsi/arm/fas216.c:913:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (fas216_get_last_msg(info, info->scsi.msgin_fifo) == ABORT) {
            ^
      drivers/scsi/arm/fas216.c:919:2: note: here
        default:    /* huh?     */
        ^~~~~~~
      drivers/scsi/arm/fas216.c: In function  fas216_kick :
      drivers/scsi/arm/fas216.c:1959:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
         fas216_allocate_tag(info, SCpnt);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/arm/fas216.c:1960:2: note: here
        case TYPE_OTHER:
        ^~~~
      drivers/scsi/arm/fas216.c: In function  fas216_busservice_intr :
      drivers/scsi/arm/fas216.c:1413:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
         fas216_stoptransfer(info);
         ^~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/arm/fas216.c:1414:2: note: here
        case STATE(STAT_STATUS, PHASE_SELSTEPS):/* Sel w/ steps -> Status       */
        ^~~~
      drivers/scsi/arm/fas216.c:1424:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
         fas216_stoptransfer(info);
         ^~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/arm/fas216.c:1425:2: note: here
        case STATE(STAT_MESGIN, PHASE_COMMAND): /* Command -> Message In */
        ^~~~
      drivers/scsi/arm/fas216.c: In function  fas216_funcdone_intr :
      drivers/scsi/arm/fas216.c:1573:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if ((stat & STAT_BUSMASK) == STAT_MESGIN) {
            ^
      drivers/scsi/arm/fas216.c:1579:2: note: here
        default:
        ^~~~~~~
      drivers/scsi/arm/fas216.c: In function  fas216_handlesync :
      drivers/scsi/arm/fas216.c:605:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
         info->scsi.phase = PHASE_MSGOUT_EXPECT;
         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/arm/fas216.c:607:2: note: here
        case async:
        ^~~~
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      dbe447ac
    • Chandrakanth Patil's avatar
      scsi: megaraid_sas: Introduce module parameter for default queue depth · 9ab089d3
      Chandrakanth Patil authored
      This patch provides a module parameter and sysfs interface to select
      whether the queue depth for each device should be based on the value
      suggested by firmware (the default) or the maximum supported by the
      controller (can_queue).
      
      Although we have a sysfs interface per sdev to change the queue depth of
      individual scsi devices, this implementation provides a single sysfs entry
      per shost to switch between the controller max and the value reported by
      firmware. The module parameter can provide an interface for one time grub
      settings and provides persistent settings across the boot.
      
      [mkp: tweaked commit desc]
      Signed-off-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
      Signed-off-by: default avatarChandrakanth Patil <chandrakanth.patil@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      9ab089d3
    • Bart Van Assche's avatar
      scsi: qla2xxx: Fix a NULL pointer dereference · d1436e45
      Bart Van Assche authored
      BUG: KASAN: null-ptr-deref in qla24xx_handle_plogi_done_event+0x134/0x9f0 [qla2xxx]
      Read of size 4 at addr 00000000000000a0 by task swapper/2/0
      
      CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.2.0-dbg+ #1
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      Call Trace:
       <IRQ>
       dump_stack+0x8a/0xd6
       __kasan_report.cold+0x5/0x41
       kasan_report+0x16/0x20
       __asan_load4+0x7e/0x80
       qla24xx_handle_plogi_done_event+0x134/0x9f0 [qla2xxx]
       qla2x00_els_dcmd2_sp_done+0x15f/0x230 [qla2xxx]
       qla24xx_els_ct_entry+0x3b3/0x610 [qla2xxx]
       qla24xx_process_response_queue+0x514/0x10e0 [qla2xxx]
       qla24xx_msix_rsp_q+0x80/0x100 [qla2xxx]
       __handle_irq_event_percpu+0x72/0x450
       handle_irq_event_percpu+0x74/0xf0
       handle_irq_event+0x5e/0x8f
       handle_edge_irq+0x13a/0x320
       handle_irq+0x30/0x40
       do_IRQ+0x91/0x190
       common_interrupt+0xf/0xf
       </IRQ>
      RIP: 0010:default_idle+0x31/0x230
      
      Fixes: 8777e431 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine") # v4.19.
      Cc: Himanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Reviewed-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      d1436e45
    • Bart Van Assche's avatar
      scsi: qla2xxx: Simplify qla24xx_async_abort_cmd() · fe6b52c9
      Bart Van Assche authored
      Make the code easier to read by converting 'goto' statements into
      'return' statements.
      
      Cc: Himanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Reviewed-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      fe6b52c9
    • Bart Van Assche's avatar
      scsi: qla2xxx: Remove two superfluous if-tests · 1778a0e7
      Bart Van Assche authored
      This patch fixes the following Coverity complaint:
      
      Null-checking sp->u.iocb_cmd.u.ctarg.rsp suggests that it may be null, but
      it has already been dereferenced on all paths leading to the check.
      
      See also commit e374f9f5 ("scsi: qla2xxx: Migrate switch registration commands away from mailbox interface") # v4.16.
      
      Cc: Himanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Reviewed-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      1778a0e7
    • Bart Van Assche's avatar
      scsi: qla2xxx: Introduce qla2x00_els_dcmd2_free() · c6e58160
      Bart Van Assche authored
      This patch reduces code duplication.
      
      Cc: Himanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Reviewed-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      c6e58160
    • Bart Van Assche's avatar
      scsi: qla2xxx: Inline the qla2x00_fcport_event_handler() function · 897def20
      Bart Van Assche authored
      Instead of calling qla2x00_fcport_event_handler() and letting the switch
      statement inside that function decide which other function to call, call
      the latter function directly. Remove the event member from the event_arg
      structure because it is no longer needed. Remove the
      qla_handle_els_plogi_done() function because it is never called.
      
      Cc: Himanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Reviewed-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      897def20
    • Bart Van Assche's avatar
      scsi: qla2xxx: Report invalid mailbox status codes · 72436192
      Bart Van Assche authored
      It is easy to mix up the QLA_* and the MBS_* status codes. Complain loudly
      if that happens.
      
      Cc: Himanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Reviewed-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      72436192