Merge branch 'mlx5-dump-fill-mkey' into rdma.git for-next
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 4 Jul 2018 19:19:46 +0000 (13:19 -0600)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 4 Jul 2018 19:23:46 +0000 (13:23 -0600)
For dependencies, branch based on 'mellanox/mlx5-next' of
git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git

Pull Dump and fill MKEY from Leon Romanovsky:

====================
MLX5 IB HCA offers the memory key, dump_fill_mkey to increase performance,
when used in a send or receive operations.

It is used to force local HCA operations to skip the PCI bus access, while
keeping track of the processed length in the ibv_sge handling.

In this three patch series, we expose various bits in our HW spec
file (mlx5_ifc.h), move unneeded for mlx5_core FW command and export such
memory key to user space thought our mlx5-abi header file.
====================

Botched auto-merge in mlx5_ib_alloc_ucontext() resolved by hand.

* branch 'mlx5-dump-fill-mkey':
  IB/mlx5: Expose dump and fill memory key
  net/mlx5: Add hardware definitions for dump_fill_mkey
  net/mlx5: Limit scope of dump_fill_mkey function
  net/mlx5: Rate limit errors in command interface

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
1  2 
drivers/infiniband/hw/mlx5/cmd.c
drivers/infiniband/hw/mlx5/cmd.h
drivers/infiniband/hw/mlx5/main.c
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
include/linux/mlx5/mlx5_ifc.h
include/uapi/rdma/mlx5-abi.h

Simple merge
Simple merge
@@@ -1727,22 -1756,18 +1728,28 @@@ static struct ib_ucontext *mlx5_ib_allo
        context->ibucontext.invalidate_range = &mlx5_ib_invalidate_range;
  #endif
  
 -      if (MLX5_CAP_GEN(dev->mdev, log_max_transport_domain)) {
 -              err = mlx5_ib_alloc_transport_domain(dev, &context->tdn);
 +      err = mlx5_ib_alloc_transport_domain(dev, &context->tdn);
 +      if (err)
 +              goto out_uars;
 +
 +      if (req.flags & MLX5_IB_ALLOC_UCTX_DEVX) {
 +              /* Block DEVX on Infiniband as of SELinux */
 +              if (mlx5_ib_port_link_layer(ibdev, 1) != IB_LINK_LAYER_ETHERNET) {
 +                      err = -EPERM;
 +                      goto out_td;
 +              }
 +
 +              err = mlx5_ib_devx_create(dev, context);
                if (err)
 -                      goto out_uars;
 +                      goto out_td;
        }
  
 -                      goto out_td;
+       if (MLX5_CAP_GEN(dev->mdev, dump_fill_mkey)) {
+               err = mlx5_cmd_dump_fill_mkey(dev->mdev, &dump_fill_mkey);
+               if (err)
++                      goto out_mdev;
+       }
        INIT_LIST_HEAD(&context->vma_private_list);
        mutex_init(&context->vma_private_list_mutex);
        INIT_LIST_HEAD(&context->db_page_list);
                resp.response_length += sizeof(resp.num_dyn_bfregs);
        }
  
+       if (field_avail(typeof(resp), dump_fill_mkey, udata->outlen)) {
+               if (MLX5_CAP_GEN(dev->mdev, dump_fill_mkey)) {
+                       resp.dump_fill_mkey = dump_fill_mkey;
+                       resp.comp_mask |=
+                               MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY;
+               }
+               resp.response_length += sizeof(resp.dump_fill_mkey);
+       }
        err = ib_copy_to_udata(udata, &resp, resp.response_length);
        if (err)
 -              goto out_td;
 +              goto out_mdev;
  
        bfregi->ver = ver;
        bfregi->num_low_latency_bfregs = req.num_low_latency_bfregs;
Simple merge
Simple merge