]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Nov 2016 21:53:02 +0000 (13:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Nov 2016 21:53:02 +0000 (13:53 -0800)
Pull rmda fixes from Doug Ledford.
 "First round of -rc fixes.

  Due to various issues, I've been away and couldn't send a pull request
  for about three weeks. There were a number of -rc patches that built
  up in the meantime (some where there already from the early -rc
  stages). Obviously, there were way too many to send now, so I tried to
  pare the list down to the more important patches for the -rc cycle.

  Most of the code has had plenty of soak time at the various vendor's
  testing setups, so I doubt there will be another -rc pull request this
  cycle. I also tried to limit the patches to those with smaller
  footprints, so even though a shortlog is longer than I would like, the
  actual diffstat is mostly very small with the exception of just three
  files that had more changes, and a couple files with pure removals.

  Summary:
   - Misc Intel hfi1 fixes
   - Misc Mellanox mlx4, mlx5, and rxe fixes
   - A couple cxgb4 fixes"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (34 commits)
  iw_cxgb4: invalidate the mr when posting a read_w_inv wr
  iw_cxgb4: set *bad_wr for post_send/post_recv errors
  IB/rxe: Update qp state for user query
  IB/rxe: Clear queue buffer when modifying QP to reset
  IB/rxe: Fix handling of erroneous WR
  IB/rxe: Fix kernel panic in UDP tunnel with GRO and RX checksum
  IB/mlx4: Fix create CQ error flow
  IB/mlx4: Check gid_index return value
  IB/mlx5: Fix NULL pointer dereference on debug print
  IB/mlx5: Fix fatal error dispatching
  IB/mlx5: Resolve soft lock on massive reg MRs
  IB/mlx5: Use cache line size to select CQE stride
  IB/mlx5: Validate requested RQT size
  IB/mlx5: Fix memory leak in query device
  IB/core: Avoid unsigned int overflow in sg_alloc_table
  IB/core: Add missing check for addr_resolve callback return value
  IB/core: Set routable RoCE gid type for ipv4/ipv6 networks
  IB/cm: Mark stale CM id's whenever the mad agent was unregistered
  IB/uverbs: Fix leak of XRC target QPs
  IB/hfi1: Remove incorrect IS_ERR check
  ...

1  2 
drivers/infiniband/core/cma.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qp.c

index 89a6b05468045cbca835573fd450d4e4466f75d7,9ca0da0a37c48a7853949c13c895ed2fcec46c07..2a6fc47a1dfbb578324ada2cd899ed22c4e1c8ad
@@@ -1094,47 -1094,47 +1094,47 @@@ static void cma_save_ib_info(struct soc
        }
  }
  
 -static void cma_save_ip4_info(struct sockaddr *src_addr,
 -                            struct sockaddr *dst_addr,
 +static void cma_save_ip4_info(struct sockaddr_in *src_addr,
 +                            struct sockaddr_in *dst_addr,
                              struct cma_hdr *hdr,
                              __be16 local_port)
  {
 -      struct sockaddr_in *ip4;
 -
        if (src_addr) {
 -              ip4 = (struct sockaddr_in *)src_addr;
 -              ip4->sin_family = AF_INET;
 -              ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr;
 -              ip4->sin_port = local_port;
 +              *src_addr = (struct sockaddr_in) {
 +                      .sin_family = AF_INET,
 +                      .sin_addr.s_addr = hdr->dst_addr.ip4.addr,
 +                      .sin_port = local_port,
 +              };
        }
  
        if (dst_addr) {
 -              ip4 = (struct sockaddr_in *)dst_addr;
 -              ip4->sin_family = AF_INET;
 -              ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr;
 -              ip4->sin_port = hdr->port;
 +              *dst_addr = (struct sockaddr_in) {
 +                      .sin_family = AF_INET,
 +                      .sin_addr.s_addr = hdr->src_addr.ip4.addr,
 +                      .sin_port = hdr->port,
 +              };
        }
  }
  
 -static void cma_save_ip6_info(struct sockaddr *src_addr,
 -                            struct sockaddr *dst_addr,
 +static void cma_save_ip6_info(struct sockaddr_in6 *src_addr,
 +                            struct sockaddr_in6 *dst_addr,
                              struct cma_hdr *hdr,
                              __be16 local_port)
  {
 -      struct sockaddr_in6 *ip6;
 -
        if (src_addr) {
 -              ip6 = (struct sockaddr_in6 *)src_addr;
 -              ip6->sin6_family = AF_INET6;
 -              ip6->sin6_addr = hdr->dst_addr.ip6;
 -              ip6->sin6_port = local_port;
 +              *src_addr = (struct sockaddr_in6) {
 +                      .sin6_family = AF_INET6,
 +                      .sin6_addr = hdr->dst_addr.ip6,
 +                      .sin6_port = local_port,
 +              };
        }
  
        if (dst_addr) {
 -              ip6 = (struct sockaddr_in6 *)dst_addr;
 -              ip6->sin6_family = AF_INET6;
 -              ip6->sin6_addr = hdr->src_addr.ip6;
 -              ip6->sin6_port = hdr->port;
 +              *dst_addr = (struct sockaddr_in6) {
 +                      .sin6_family = AF_INET6,
 +                      .sin6_addr = hdr->src_addr.ip6,
 +                      .sin6_port = hdr->port,
 +              };
        }
  }
  
@@@ -1159,12 -1159,10 +1159,12 @@@ static int cma_save_ip_info(struct sock
  
        switch (cma_get_ip_ver(hdr)) {
        case 4:
 -              cma_save_ip4_info(src_addr, dst_addr, hdr, port);
 +              cma_save_ip4_info((struct sockaddr_in *)src_addr,
 +                                (struct sockaddr_in *)dst_addr, hdr, port);
                break;
        case 6:
 -              cma_save_ip6_info(src_addr, dst_addr, hdr, port);
 +              cma_save_ip6_info((struct sockaddr_in6 *)src_addr,
 +                                (struct sockaddr_in6 *)dst_addr, hdr, port);
                break;
        default:
                return -EAFNOSUPPORT;
@@@ -2438,6 -2436,18 +2438,18 @@@ static int iboe_tos_to_sl(struct net_de
        return 0;
  }
  
+ static enum ib_gid_type cma_route_gid_type(enum rdma_network_type network_type,
+                                          unsigned long supported_gids,
+                                          enum ib_gid_type default_gid)
+ {
+       if ((network_type == RDMA_NETWORK_IPV4 ||
+            network_type == RDMA_NETWORK_IPV6) &&
+           test_bit(IB_GID_TYPE_ROCE_UDP_ENCAP, &supported_gids))
+               return IB_GID_TYPE_ROCE_UDP_ENCAP;
+       return default_gid;
+ }
  static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
  {
        struct rdma_route *route = &id_priv->id.route;
        route->num_paths = 1;
  
        if (addr->dev_addr.bound_dev_if) {
+               unsigned long supported_gids;
                ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
                if (!ndev) {
                        ret = -ENODEV;
  
                route->path_rec->net = &init_net;
                route->path_rec->ifindex = ndev->ifindex;
-               route->path_rec->gid_type = id_priv->gid_type;
+               supported_gids = roce_gid_type_mask_support(id_priv->id.device,
+                                                           id_priv->id.port_num);
+               route->path_rec->gid_type =
+                       cma_route_gid_type(addr->dev_addr.network,
+                                          supported_gids,
+                                          id_priv->gid_type);
        }
        if (!ndev) {
                ret = -ENODEV;
index 63036c7316264fec532c286a33373743cf163224,a014ad38d88942bb63a4b797ee0d4f3210cc9f3f..32b09f059c84a460b8e3bc5f80db2bb6fb892709
@@@ -1019,7 -1019,7 +1019,7 @@@ static struct ib_ucontext *mlx5_ib_allo
        resp.qp_tab_size = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp);
        if (mlx5_core_is_pf(dev->mdev) && MLX5_CAP_GEN(dev->mdev, bf))
                resp.bf_reg_size = 1 << MLX5_CAP_GEN(dev->mdev, log_bf_reg_size);
 -      resp.cache_line_size = L1_CACHE_BYTES;
 +      resp.cache_line_size = cache_line_size();
        resp.max_sq_desc_sz = MLX5_CAP_GEN(dev->mdev, max_wqe_sz_sq);
        resp.max_rq_desc_sz = MLX5_CAP_GEN(dev->mdev, max_wqe_sz_rq);
        resp.max_send_wqebb = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz);
@@@ -2311,14 -2311,14 +2311,14 @@@ static void mlx5_ib_event(struct mlx5_c
  {
        struct mlx5_ib_dev *ibdev = (struct mlx5_ib_dev *)context;
        struct ib_event ibev;
+       bool fatal = false;
        u8 port = 0;
  
        switch (event) {
        case MLX5_DEV_EVENT_SYS_ERROR:
-               ibdev->ib_active = false;
                ibev.event = IB_EVENT_DEVICE_FATAL;
                mlx5_ib_handle_internal_error(ibdev);
+               fatal = true;
                break;
  
        case MLX5_DEV_EVENT_PORT_UP:
  
        if (ibdev->ib_active)
                ib_dispatch_event(&ibev);
+       if (fatal)
+               ibdev->ib_active = false;
  }
  
  static void get_ext_port_caps(struct mlx5_ib_dev *dev)
@@@ -3115,7 -3118,7 +3118,7 @@@ static void *mlx5_ib_add(struct mlx5_co
        }
        err = init_node_data(dev);
        if (err)
-               goto err_dealloc;
+               goto err_free_port;
  
        mutex_init(&dev->flow_db.lock);
        mutex_init(&dev->cap_mask_mutex);
        if (ll == IB_LINK_LAYER_ETHERNET) {
                err = mlx5_enable_roce(dev);
                if (err)
-                       goto err_dealloc;
+                       goto err_free_port;
        }
  
        err = create_dev_resources(&dev->devr);
index 7ce97daf26c62f7de7bb0fb8693024ed5b371289,59c4c89460d1ee7c6322cb6c1a1fafccbef193db..d1e921816bfee3596c961e6671d87a84a3caa0ab
@@@ -52,6 -52,7 +52,6 @@@ enum 
  
  enum {
        MLX5_IB_SQ_STRIDE       = 6,
 -      MLX5_IB_CACHE_LINE_SIZE = 64,
  };
  
  static const u32 mlx5_ib_opcode[] = {
@@@ -2051,8 -2052,8 +2051,8 @@@ struct ib_qp *mlx5_ib_create_qp(struct 
  
                mlx5_ib_dbg(dev, "ib qpnum 0x%x, mlx qpn 0x%x, rcqn 0x%x, scqn 0x%x\n",
                            qp->ibqp.qp_num, qp->trans_qp.base.mqp.qpn,
-                           to_mcq(init_attr->recv_cq)->mcq.cqn,
-                           to_mcq(init_attr->send_cq)->mcq.cqn);
+                           init_attr->recv_cq ? to_mcq(init_attr->recv_cq)->mcq.cqn : -1,
+                           init_attr->send_cq ? to_mcq(init_attr->send_cq)->mcq.cqn : -1);
  
                qp->trans_qp.xrcdn = xrcdn;
  
@@@ -4814,6 -4815,14 +4814,14 @@@ struct ib_rwq_ind_table *mlx5_ib_create
                                 udata->inlen))
                return ERR_PTR(-EOPNOTSUPP);
  
+       if (init_attr->log_ind_tbl_size >
+           MLX5_CAP_GEN(dev->mdev, log_max_rqt_size)) {
+               mlx5_ib_dbg(dev, "log_ind_tbl_size = %d is bigger than supported = %d\n",
+                           init_attr->log_ind_tbl_size,
+                           MLX5_CAP_GEN(dev->mdev, log_max_rqt_size));
+               return ERR_PTR(-EINVAL);
+       }
        min_resp_len = offsetof(typeof(resp), reserved) + sizeof(resp.reserved);
        if (udata->outlen && udata->outlen < min_resp_len)
                return ERR_PTR(-EINVAL);