1. 08 Mar, 2018 2 commits
  2. 07 Mar, 2018 19 commits
  3. 06 Mar, 2018 11 commits
    • Gustavo A. R. Silva's avatar
      RDMA/bnxt_re/qplib_sp: Use true and false for boolean values · 63231585
      Gustavo A. R. Silva authored
      Assign true or false to boolean variables instead of an integer value.
      
      This issue was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Acked-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      63231585
    • Sergey Gorenko's avatar
      IB/srp: Use the IB_DEVICE_SG_GAPS_REG HCA feature if supported · fbd36818
      Sergey Gorenko authored
      If a HCA supports the SG_GAPS_REG feature then fewer memory regions
      are required per command. This patch reduces the number of memory
      regions that is allocated per SRP session.
      Signed-off-by: default avatarSergey Gorenko <sergeygo@mellanox.com>
      Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
      Tested-by: default avatarLaurence Oberman <loberman@redhat.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Acked-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      fbd36818
    • Bart Van Assche's avatar
      IB/hfi1: Add a missing rcu_read_unlock() · 41904439
      Bart Van Assche authored
      This patch avoids that sparse reports the following:
      
      drivers/infiniband/hw/hfi1/driver.c:251:13: warning: context imbalance in 'rcv_hdrerr' - different lock contexts for basic block
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
      Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      41904439
    • Arushi's avatar
      infiniband: hw: Drop unnecessary continue · 666fe24b
      Arushi authored
      Continue at the bottom of a loop are removed.
      Issue found using drop_continue.cocci Coccinelle script.
      Signed-off-by: default avatarArushi Singhal <arushisinghal19971997@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      666fe24b
    • Shiraz Saleem's avatar
      i40iw: Implement get_vector_affinity API · 7e952b19
      Shiraz Saleem authored
      Storage ULPs (like NVMEoF) benefit from exposing affinity mapping
      per completion vector to find the optimal multi-queue affinity
      assignments. The ULPs call the verbs API ib_get_vector_affinity
      introduced in commit c66cd353 ("RDMA/core: expose affinity mappings per
      completion vector") to get the underlying devices affinity mappings.
      
      Add support in driver to expose the affinity masks per MSI-X
      completion vector.
      Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      7e952b19
    • Shiraz Saleem's avatar
      i40iw: Improve CM node lookup time on connection setup · 7de8b357
      Shiraz Saleem authored
      Currently all CM nodes involved in a connection are
      maintained in a connected_node list per dev. During
      connection setup, we need to search this every time
      we receive a packet on the iWARP LAN Queue (ILQ) and
      this can be pretty inefficient for large number of
      connections.
      
      Fix this by organizing the CM nodes in two lists -
      accelerated list and non-accelerated list. The search
      on ILQ receive would be limited to only non accelerated
      nodes. When a node moves to RTS, it is added to the
      accelerated list.
      
      Benchmarking ucmatose 16k connections shows a 20%
      improvement in test completion time.
      Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      7de8b357
    • Mustafa Ismail's avatar
      i40iw: Refactor handling of txpend list · 6b0c549f
      Mustafa Ismail authored
      Currently the TX pending lists for IEQ and ILQ are
      handled separately. The handling of both can be
      consolidated in i40iw_poll_completion.
      Signed-off-by: default avatarMustafa Ismail <mustafa.ismail@intel.com>
      Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      6b0c549f
    • Bart Van Assche's avatar
      IB/srpt: Fix an out-of-bounds stack access in srpt_zerolength_write() · 2a78cb4d
      Bart Van Assche authored
      Avoid triggering an out-of-bounds stack access by changing the type
      of 'wr' from ib_send_wr into ib_rdma_wr.
      
      This patch fixes the following KASAN bug report:
      
      BUG: KASAN: stack-out-of-bounds in rxe_post_send+0x7a9/0x9a0 [rdma_rxe]
      Read of size 8 at addr ffff880068197a48 by task kworker/2:1/44
      
      Workqueue: ib_cm cm_work_handler [ib_cm]
      Call Trace:
       dump_stack+0x8e/0xcd
       print_address_description+0x6f/0x280
       kasan_report+0x25a/0x380
       __asan_load8+0x54/0x90
       rxe_post_send+0x7a9/0x9a0 [rdma_rxe]
       srpt_zerolength_write+0xf0/0x180 [ib_srpt]
       srpt_cm_rtu_recv+0x68/0x110 [ib_srpt]
       srpt_rdma_cm_handler+0xbb/0x15b [ib_srpt]
       cma_ib_handler+0x1aa/0x4a0 [rdma_cm]
       cm_process_work+0x30/0x100 [ib_cm]
       cm_work_handler+0xa86/0x351b [ib_cm]
       process_one_work+0x475/0x9f0
       worker_thread+0x69/0x690
       kthread+0x1ad/0x1d0
       ret_from_fork+0x3a/0x50
      
      Fixes: aaf45bd8 ("IB/srpt: Detect session shutdown reliably")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      2a78cb4d
    • Bart Van Assche's avatar
      RDMA/rxe: Fix an out-of-bounds read · a6544a62
      Bart Van Assche authored
      This patch avoids that KASAN reports the following when the SRP initiator
      calls srp_post_send():
      
      ==================================================================
      BUG: KASAN: stack-out-of-bounds in rxe_post_send+0x5c4/0x980 [rdma_rxe]
      Read of size 8 at addr ffff880066606e30 by task 02-mq/1074
      
      CPU: 2 PID: 1074 Comm: 02-mq Not tainted 4.16.0-rc3-dbg+ #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
      Call Trace:
      dump_stack+0x85/0xc7
      print_address_description+0x65/0x270
      kasan_report+0x231/0x350
      rxe_post_send+0x5c4/0x980 [rdma_rxe]
      srp_post_send.isra.16+0x149/0x190 [ib_srp]
      srp_queuecommand+0x94d/0x1670 [ib_srp]
      scsi_dispatch_cmd+0x1c2/0x550 [scsi_mod]
      scsi_queue_rq+0x843/0xa70 [scsi_mod]
      blk_mq_dispatch_rq_list+0x143/0xac0
      blk_mq_do_dispatch_ctx+0x1c5/0x260
      blk_mq_sched_dispatch_requests+0x2bf/0x2f0
      __blk_mq_run_hw_queue+0xdb/0x160
      __blk_mq_delay_run_hw_queue+0xba/0x100
      blk_mq_run_hw_queue+0xf2/0x190
      blk_mq_sched_insert_request+0x163/0x2f0
      blk_execute_rq+0xb0/0x130
      scsi_execute+0x14e/0x260 [scsi_mod]
      scsi_probe_and_add_lun+0x366/0x13d0 [scsi_mod]
      __scsi_scan_target+0x18a/0x810 [scsi_mod]
      scsi_scan_target+0x11e/0x130 [scsi_mod]
      srp_create_target+0x1522/0x19e0 [ib_srp]
      kernfs_fop_write+0x180/0x210
      __vfs_write+0xb1/0x2e0
      vfs_write+0xf6/0x250
      SyS_write+0x99/0x110
      do_syscall_64+0xee/0x2b0
      entry_SYSCALL_64_after_hwframe+0x42/0xb7
      
      The buggy address belongs to the page:
      page:ffffea0001998180 count:0 mapcount:0 mapping:0000000000000000 index:0x0
      flags: 0x4000000000000000()
      raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
      raw: dead000000000100 dead000000000200 0000000000000000 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
      ffff880066606d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1
      ffff880066606d80: f1 00 f2 f2 f2 f2 f2 f2 f2 00 00 f2 f2 f2 f2 f2
      >ffff880066606e00: f2 00 00 00 00 00 f2 f2 f2 f3 f3 f3 f3 00 00 00
                                          ^
      ffff880066606e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff880066606f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ==================================================================
      
      Fixes: 8700e3e7 ("Soft RoCE driver")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Moni Shoua <monis@mellanox.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      a6544a62
    • Bart Van Assche's avatar
      RDMA/core: Avoid that ib_drain_qp() triggers an out-of-bounds stack access · a1ae7d03
      Bart Van Assche authored
      This patch fixes the following KASAN complaint:
      
      ==================================================================
      BUG: KASAN: stack-out-of-bounds in rxe_post_send+0x77d/0x9b0 [rdma_rxe]
      Read of size 8 at addr ffff880061aef860 by task 01/1080
      
      CPU: 2 PID: 1080 Comm: 01 Not tainted 4.16.0-rc3-dbg+ #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
      Call Trace:
      dump_stack+0x85/0xc7
      print_address_description+0x65/0x270
      kasan_report+0x231/0x350
      rxe_post_send+0x77d/0x9b0 [rdma_rxe]
      __ib_drain_sq+0x1ad/0x250 [ib_core]
      ib_drain_qp+0x9/0x30 [ib_core]
      srp_destroy_qp+0x51/0x70 [ib_srp]
      srp_free_ch_ib+0xfc/0x380 [ib_srp]
      srp_create_target+0x1071/0x19e0 [ib_srp]
      kernfs_fop_write+0x180/0x210
      __vfs_write+0xb1/0x2e0
      vfs_write+0xf6/0x250
      SyS_write+0x99/0x110
      do_syscall_64+0xee/0x2b0
      entry_SYSCALL_64_after_hwframe+0x42/0xb7
      
      The buggy address belongs to the page:
      page:ffffea000186bbc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
      flags: 0x4000000000000000()
      raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
      raw: 0000000000000000 ffffea000186bbe0 0000000000000000 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
      ffff880061aef700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff880061aef780: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
      >ffff880061aef800: f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 f2 f2 f2 f2
                                                            ^
      ffff880061aef880: f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 f2 f2
      ffff880061aef900: f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00
      ==================================================================
      
      Fixes: 765d6774 ("IB: new common API for draining queues")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Steve Wise <swise@opengridcomputing.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      a1ae7d03
    • Colin Ian King's avatar
      infiniband: remove redundant assignment to pointer 'rdi' · 042932f7
      Colin Ian King authored
      The pointer rdi is being initialized with a value that is never read
      and re-assigned immediately after, hence the initialization is redundant
      and can be removed.
      
      Cleans up clang warning:
      drivers/infiniband/sw/rdmavt/vt.c:94:23: warning: Value stored to 'rdi'
      during its initialization is never read
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      042932f7
  4. 28 Feb, 2018 8 commits
    • Hernán Gonzalez's avatar
      IB/rxe: Remove unused variable (char *rxe_qp_state_name[]) · c33bab62
      Hernán Gonzalez authored
      Note: This is compile only tested as I have no access to the hw.  This
      variable was not used anywhere in the code. Removing it saves 24 bytes.
      
      add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-24 (-24)
      Function                                     old     new   delta
      rxe_qp_state_name                             24       -     -24
      Total: Before=3348732, After=3348708, chg -0.00%
      Signed-off-by: default avatarHernán Gonzalez <hernan@vanguardiasur.com.ar>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      c33bab62
    • Hernán Gonzalez's avatar
      IB/qib: Move char *qib_sdma_state_names[] and constify while there. · 7f566a91
      Hernán Gonzalez authored
      Note: This is compile only tested as I have no access to the hw.
      This variable was not used in qib_sdma.c but in qib_iba7322.c. Declaring it
      there, as static, saves 56 bytes.
      
      add/remove: 0/2 grow/shrink: 0/0 up/down: 0/-144 (-144)
      Function                                     old     new   delta
      qib_sdma_state_names                          56       -     -56
      qib_sdma_event_names                          88       -     -88
      Total: Before=2874565, After=2874421, chg -0.01%
      Signed-off-by: default avatarHernán Gonzalez <hernan@vanguardiasur.com.ar>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      7f566a91
    • Hernán Gonzalez's avatar
      IB/qib: Remove unused variable (char *qib_sdma_event_names[]) · 4f1d5834
      Hernán Gonzalez authored
      Note: This is compile only tested as I have no access to the hw.
      
      This variable was not used anywhere in the code. Removing it saves 88
      bytes.
      
      add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-88 (-88)
      Function                                     old     new   delta
      qib_sdma_event_names                          88       -     -88
      Total: Before=2874565, After=2874477, chg -0.00%
      Signed-off-by: default avatarHernán Gonzalez <hernan@vanguardiasur.com.ar>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      4f1d5834
    • Bart Van Assche's avatar
      IB/srp: Use %pIS instead of inet_ntop() · 7da09af9
      Bart Van Assche authored
      Except for a minor log message change, this patch does not change
      any functionality. For the introduction of %pIS, see also commit
      10679643 ("lib: vsprintf: add IPv4/v6 generic %p[Ii]S[pfs]
      format specifier").
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      7da09af9
    • Bart Van Assche's avatar
      Revert "IB/srp: Avoid that a cable pull can trigger a kernel crash" · c74ff750
      Bart Van Assche authored
      The caller of srp_ib_lookup_path() is responsible for holding a reference
      on the SCSI host. That means that commit 8a0d18c6 was not necessary.
      Hence revert it.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      c74ff750
    • Bart Van Assche's avatar
      IB/srp: Fix srp_abort() · e68088e7
      Bart Van Assche authored
      Before commit e494f6a7 ("[SCSI] improved eh timeout handler") it
      did not really matter whether or not abort handlers like srp_abort()
      called .scsi_done() when returning another value than SUCCESS. Since
      that commit however this matters. Hence only call .scsi_done() when
      returning SUCCESS.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      e68088e7
    • Arnd Bergmann's avatar
      infiniband: bnxt_re: use BIT_ULL() for 64-bit bit masks · a8ed7487
      Arnd Bergmann authored
      On 32-bit targets, we otherwise get a warning about an impossible constant
      integer expression:
      
      In file included from include/linux/kernel.h:11,
                       from include/linux/interrupt.h:6,
                       from drivers/infiniband/hw/bnxt_re/ib_verbs.c:39:
      drivers/infiniband/hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_query_device':
      include/linux/bitops.h:7:24: error: left shift count >= width of type [-Werror=shift-count-overflow]
       #define BIT(nr)   (1UL << (nr))
                              ^~
      drivers/infiniband/hw/bnxt_re/bnxt_re.h:61:34: note: in expansion of macro 'BIT'
       #define BNXT_RE_MAX_MR_SIZE_HIGH BIT(39)
                                        ^~~
      drivers/infiniband/hw/bnxt_re/bnxt_re.h:62:30: note: in expansion of macro 'BNXT_RE_MAX_MR_SIZE_HIGH'
       #define BNXT_RE_MAX_MR_SIZE  BNXT_RE_MAX_MR_SIZE_HIGH
                                    ^~~~~~~~~~~~~~~~~~~~~~~~
      drivers/infiniband/hw/bnxt_re/ib_verbs.c:149:25: note: in expansion of macro 'BNXT_RE_MAX_MR_SIZE'
        ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
                               ^~~~~~~~~~~~~~~~~~~
      
      Fixes: 872f3578 ("RDMA/bnxt_re: Add support for MRs with Huge pages")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      a8ed7487
    • Arnd Bergmann's avatar
      infiniband: qplib_fp: fix pointer cast · e5d6574d
      Arnd Bergmann authored
      Building for a 32-bit target results in a couple of warnings from casting
      between a 32-bit pointer and a 64-bit integer:
      
      drivers/infiniband/hw/bnxt_re/qplib_fp.c: In function 'bnxt_qplib_service_nq':
      drivers/infiniband/hw/bnxt_re/qplib_fp.c:333:23: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
          bnxt_qplib_arm_srq((struct bnxt_qplib_srq *)q_handle,
                             ^
      drivers/infiniband/hw/bnxt_re/qplib_fp.c:336:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
                  (struct bnxt_qplib_srq *)q_handle,
                  ^
      In file included from include/linux/byteorder/little_endian.h:5,
                       from arch/arm/include/uapi/asm/byteorder.h:22,
                       from include/asm-generic/bitops/le.h:6,
                       from arch/arm/include/asm/bitops.h:342,
                       from include/linux/bitops.h:38,
                       from include/linux/kernel.h:11,
                       from include/linux/interrupt.h:6,
                       from drivers/infiniband/hw/bnxt_re/qplib_fp.c:39:
      drivers/infiniband/hw/bnxt_re/qplib_fp.c: In function 'bnxt_qplib_create_srq':
      include/uapi/linux/byteorder/little_endian.h:31:43: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
       #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
                                                 ^
      include/linux/byteorder/generic.h:86:21: note: in expansion of macro '__cpu_to_le64'
       #define cpu_to_le64 __cpu_to_le64
                           ^~~~~~~~~~~~~
      drivers/infiniband/hw/bnxt_re/qplib_fp.c:569:19: note: in expansion of macro 'cpu_to_le64'
        req.srq_handle = cpu_to_le64(srq);
      
      Using a uintptr_t as an intermediate works on all architectures.
      
      Fixes: 37cb11ac ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      e5d6574d