1. Jul 12, 2019
    • Gustavo A. R. Silva's avatar
      RDMA/siw: Mark expected switch fall-throughs · cea743f2
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
      we are expecting to fall through.
      
      This patch fixes the following warnings:
      
      drivers/infiniband/sw/siw/siw_qp_rx.c: In function ‘siw_rdmap_complete’:
      drivers/infiniband/sw/siw/siw_qp_rx.c:1214:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         wqe->rqe.flags |= SIW_WQE_SOLICITED;
         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      drivers/infiniband/sw/siw/siw_qp_rx.c:1215:2: note: here
        case RDMAP_SEND:
        ^~~~
      
      drivers/infiniband/sw/siw/siw_qp_tx.c: In function ‘siw_qp_sq_process’:
      drivers/infiniband/sw/siw/siw_qp_tx.c:1044:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
          siw_wqe_put_mem(wqe, tx_type);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/infiniband/sw/siw/siw_qp_tx.c:1045:3: note: here
         case SIW_OP_INVAL_STAG:
         ^~~~
      drivers/infiniband/sw/siw/siw_qp_tx.c:1128:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
          siw_wqe_put_mem(wqe, tx_type);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/infiniband/sw/siw/siw_qp_tx.c:1129:3: note: here
         case SIW_OP_INVAL_STAG:
         ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      cea743f2
  2. Jul 11, 2019
  3. Jul 10, 2019
    • Dag Moxnes's avatar
      RDMA/core: Fix race when resolving IP address · d8d9ec7d
      Dag Moxnes authored
      Use the neighbour lock when copying the MAC address from the neighbour
      data struct in dst_fetch_ha.
      
      When not using the lock, it is possible for the function to race with
      neigh_update(), causing it to copy an torn MAC address:
      
      rdma_resolve_addr()
        rdma_resolve_ip()
          addr_resolve()
            addr_resolve_neigh()
              fetch_ha()
                dst_fetch_ha()
      	     memcpy(dev_addr->dst_dev_addr, n->ha, MAX_ADDR_LEN)
      
      and
      
      net_ioctl()
        arp_ioctl()
          arp_rec_delete()
            arp_invalidate()
              neigh_update()
                __neigh_update()
      	    memcpy(&neigh->ha, lladdr, dev->addr_len)
      
      It is possible to provoke this error by calling rdma_resolve_addr() in a
      tight loop, while deleting the corresponding ARP entry in another tight
      loop.
      
      Fixes: 51d45974
      
       ("infiniband: addr: Consolidate code to fetch neighbour hardware address from dst.")
      Signed-off-by: default avatarDag Moxnes <dag.moxnes@oracle.com>
      Signed-off-by: default avatarHåkon Bugge <haakon.bugge@oracle.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      d8d9ec7d
  4. Jul 09, 2019
  5. Jul 08, 2019
    • Jason Gunthorpe's avatar
      RDMA/siw: Fix DEFINE_PER_CPU compilation when ARCH_NEEDS_WEAK_PER_CPU · 4c7d6dcd
      Jason Gunthorpe authored
      The initializer for the variable cannot be inside the macro (and zero
      initialization isn't needed anyhow).
      
      include/linux/percpu-defs.h:92:33: warning: '__pcpu_unique_use_cnt' initialized and declared 'extern'
        extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;  \
                                       ^~~~~~~~~~~~~~
      include/linux/percpu-defs.h:115:2: note: in expansion of macro 'DEFINE_PER_CPU_SECTION'
        DEFINE_PER_CPU_SECTION(type, name, "")
        ^~~~~~~~~~~~~~~~~~~~~~
      drivers/infiniband/sw/siw/siw_main.c:129:8: note: in expansion of macro 'DEFINE_PER_CPU'
       static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
              ^~~~~~~~~~~~~~
      
      Also the rules for PER_CPU require the variable names to be globally
      unique, so prefix them with siw_
      
      Fixes: b9be6f18 ("rdma/siw: transmit path")
      Fixes: bdcf26bf
      
       ("rdma/siw: network and RDMA core interface")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      4c7d6dcd
  6. Jul 07, 2019
  7. Jul 05, 2019