RDMA/mlx5: Refactor mlx5_ib_alloc_ucontext() response
authorYishai Hadas <yishaih@mellanox.com>
Tue, 30 Jun 2020 09:39:13 +0000 (12:39 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 6 Jul 2020 22:50:33 +0000 (19:50 -0300)
commit45ec21c971eddfb5e8e953e49a9dbe780f4a4997
tree75c1a754745f0b3e01be20c649274d79a97702e5
parent1c8fb1ea5a1dbd2159e78fa580aaffb001794cfa
RDMA/mlx5: Refactor mlx5_ib_alloc_ucontext() response

Refactor mlx5_ib_alloc_ucontext() to set its response fields in a
cleaner way.

It includes,
- Move the relevant code to a self contained function.
- Calculate the response length once and drop redundant code all around.
- Reuse previously set ucontext fields once preparing the response.

The self contained function will be used in next patch as part of
implementing the query ucontext functionality.

Link: https://lore.kernel.org/r/20200630093916.332097-5-leon@kernel.org
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/main.c