1. 18 Jan, 2018 20 commits
  2. 17 Jan, 2018 14 commits
  3. 15 Jan, 2018 6 commits
    • Xiongfeng Wang's avatar
      IB/cma: use strlcpy() instead of strncpy() · 979a459c
      Xiongfeng Wang authored
      gcc-8 reports
      
      drivers/infiniband/core/cma_configfs.c: In function 'make_cma_dev':
      ./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
      bound 64 equals destination size [-Wstringop-truncation]
      
      We need to use strlcpy() to make sure the string is nul-terminated.
      Signed-off-by: default avatarXiongfeng Wang <xiongfeng.wang@linaro.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      979a459c
    • Parav Pandit's avatar
      RDMA/core: Clarify rdma_ah_find_type · a6532e71
      Parav Pandit authored
      iWARP does not use rdma_ah_attr_type, and for this reason we do not have a
      RDMA_AH_ATTR_TYPE_IWARP. rdma_ah_find_type should not even be called on iwarp
      ports and for clarity it shouldn't have a special test for iWarp.
      
      This changes the result from RDMA_AH_ATTR_TYPE_ROCE to RDMA_AH_ATTR_TYPE_IB
      when wrongly called on an iWarp port.
      
      Fixes: 44c58487 ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      a6532e71
    • Bodong Wang's avatar
      IB/core: Fix ib_wc structure size to remain in 64 bytes boundary · cd2a6e7d
      Bodong Wang authored
      The change of slid from u16 to u32 results in sizeof(struct ib_wc)
      cross 64B boundary, which causes more cache misses. This patch
      rearranges the fields and remain the size to 64B.
      
      Pahole output before this change:
      
      struct ib_wc {
              union {
                      u64                wr_id;                /*           8 */
                      struct ib_cqe *    wr_cqe;               /*           8 */
              };                                               /*     0     8 */
              enum ib_wc_status          status;               /*     8     4 */
              enum ib_wc_opcode          opcode;               /*    12     4 */
              u32                        vendor_err;           /*    16     4 */
              u32                        byte_len;             /*    20     4 */
              struct ib_qp *             qp;                   /*    24     8 */
              union {
                      __be32             imm_data;             /*           4 */
                      u32                invalidate_rkey;      /*           4 */
              } ex;                                            /*    32     4 */
              u32                        src_qp;               /*    36     4 */
              int                        wc_flags;             /*    40     4 */
              u16                        pkey_index;           /*    44     2 */
      
              /* XXX 2 bytes hole, try to pack */
      
              u32                        slid;                 /*    48     4 */
              u8                         sl;                   /*    52     1 */
              u8                         dlid_path_bits;       /*    53     1 */
              u8                         port_num;             /*    54     1 */
              u8                         smac[6];              /*    55     6 */
      
              /* XXX 1 byte hole, try to pack */
      
              u16                        vlan_id;              /*    62     2 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              u8                         network_hdr_type;     /*    64     1 */
      
              /* size: 72, cachelines: 2, members: 17 */
              /* sum members: 62, holes: 2, sum holes: 3 */
              /* padding: 7 */
              /* last cacheline: 8 bytes */
      };
      
      Pahole output after this change:
      
      struct ib_wc {
              union {
                      u64                wr_id;                /*           8 */
                      struct ib_cqe *    wr_cqe;               /*           8 */
              };                                               /*     0     8 */
              enum ib_wc_status          status;               /*     8     4 */
              enum ib_wc_opcode          opcode;               /*    12     4 */
              u32                        vendor_err;           /*    16     4 */
              u32                        byte_len;             /*    20     4 */
              struct ib_qp *             qp;                   /*    24     8 */
              union {
                      __be32             imm_data;             /*           4 */
                      u32                invalidate_rkey;      /*           4 */
              } ex;                                            /*    32     4 */
              u32                        src_qp;               /*    36     4 */
              u32                        slid;                 /*    40     4 */
              int                        wc_flags;             /*    44     4 */
              u16                        pkey_index;           /*    48     2 */
              u8                         sl;                   /*    50     1 */
              u8                         dlid_path_bits;       /*    51     1 */
              u8                         port_num;             /*    52     1 */
              u8                         smac[6];              /*    53     6 */
      
              /* XXX 1 byte hole, try to pack */
      
              u16                        vlan_id;              /*    60     2 */
              u8                         network_hdr_type;     /*    62     1 */
      
              /* size: 64, cachelines: 1, members: 17 */
              /* sum members: 62, holes: 1, sum holes: 1 */
              /* padding: 1 */
      };
      
      Cc: <stable@vger.kernel.org> # v4.13
      Fixes: 7db20ecd ("IB/core: Change wc.slid from 16 to 32 bits")
      Signed-off-by: default avatarBodong Wang <bodong@mellanox.com>
      Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      cd2a6e7d
    • Jack Morgenstein's avatar
      IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports · 852f6927
      Jack Morgenstein authored
      Allocating steerable UD QPs depends on having at least one IB port,
      while releasing those QPs does not.
      
      As a result, when there are only ETH ports, the IB (RoCE) driver
      requests releasing a qp range whose base qp is zero, with
      qp count zero.
      
      When SR-IOV is enabled, and the VF driver is running on a VM over
      a hypervisor which treats such qp release calls as errors
      (rather than NOPs), we see lines in the VM message log like:
      
       mlx4_core 0002:00:02.0: Failed to release qp range base:0 cnt:0
      
      Fix this by adding a check for a zero count in mlx4_release_qp_range()
      (which thus treats releasing 0 qps as a nop), and eliminating the
      check for device managed flow steering when releasing steerable UD QPs.
      (Freeing ib_uc_qpns_bitmap unconditionally is also OK, since it
      remains NULL when steerable UD QPs are not allocated).
      
      Cc: <stable@vger.kernel.org>
      Fixes: 4196670b ("IB/mlx4: Don't allocate range of steerable UD QPs for Ethernet-only device")
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      852f6927
    • Jason Gunthorpe's avatar
      RDMA/qedr: Fix endian problems around imm_data · 7bed7ebc
      Jason Gunthorpe authored
      The double swap matches what user space rdma-core does to imm_data.
      
      wc->imm_data is not used in the kernel so this change has no practical
      impact.
      Acked-by: default avatarMichal Kalderon <michal.kalderon@cavium.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      7bed7ebc
    • Jason Gunthorpe's avatar
      RDMA/hns: Fix endian problems around imm_data and rkey · ccb8a29e
      Jason Gunthorpe authored
      This matches the changes made recently to the userspace hns
      driver when it was made sparse clean.
      
      See rdma-core commit bffd380cfe56 ("libhns: Make the provider sparse
      clean")
      
      wc->imm_data is not used in the kernel so this change has no practical
      impact.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      ccb8a29e