linux-2.6-microblaze.git
4 years agoRDMA/mlx5: Rely on existence of udata to separate kernel/user flows
Leon Romanovsky [Mon, 27 Apr 2020 15:46:24 +0000 (18:46 +0300)]
RDMA/mlx5: Rely on existence of udata to separate kernel/user flows

Instead of keeping special field to separate kernel/user create/destroy
flows, rely on existence of udata pointer. All allocation flows are
using kzalloc() and leave uninitialized pointers as NULL which makes
MLX5_QP_EMPTY and MLX5_QP_KERNEL flows to be the same.

Link: https://lore.kernel.org/r/20200427154636.381474-25-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Remove second user copy in create_user_qp
Leon Romanovsky [Mon, 27 Apr 2020 15:46:23 +0000 (18:46 +0300)]
RDMA/mlx5: Remove second user copy in create_user_qp

Combine copy_from_user() from create_user_qp() and general code.

Link: https://lore.kernel.org/r/20200427154636.381474-24-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Combine copy of create QP command in RSS RAW QP
Leon Romanovsky [Mon, 27 Apr 2020 15:46:22 +0000 (18:46 +0300)]
RDMA/mlx5: Combine copy of create QP command in RSS RAW QP

Change the create QP flow to handle all copy_from_user() operations in
one place.

Link: https://lore.kernel.org/r/20200427154636.381474-23-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Promote RSS RAW QP attribute check in higher level
Leon Romanovsky [Mon, 27 Apr 2020 15:46:21 +0000 (18:46 +0300)]
RDMA/mlx5: Promote RSS RAW QP attribute check in higher level

Perform check of attributes of RAW PACKET QP in separate function.

Link: https://lore.kernel.org/r/20200427154636.381474-22-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Store QP type in the vendor QP structure
Leon Romanovsky [Mon, 27 Apr 2020 15:46:20 +0000 (18:46 +0300)]
RDMA/mlx5: Store QP type in the vendor QP structure

QP type is stored in the IB/core QP struct, but it doesn't have all the
needed information, like internal QP type used in the driver itself.
Update mlx5_ib to have cached QP type which includes both IBTA and
Mellanox specific one.

Such change allows us to make even further cleanup of QP creation flow.

Link: https://lore.kernel.org/r/20200427154636.381474-21-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Delete unsupported QP types
Leon Romanovsky [Mon, 27 Apr 2020 15:46:19 +0000 (18:46 +0300)]
RDMA/mlx5: Delete unsupported QP types

There is no need to explicitly check unsupported QP types,
rely on  "default" keyword in switch-case to catch them.

Link: https://lore.kernel.org/r/20200427154636.381474-20-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoMerge branch 'mlx5_ib_qp_refactor_1' into rdma.git for-next
Jason Gunthorpe [Wed, 29 Apr 2020 00:44:51 +0000 (21:44 -0300)]
Merge branch 'mlx5_ib_qp_refactor_1' into rdma.git for-next

Leon Romanovsky says:

====================
This is first part of series which tries to return some sanity to
mlx5_ib_create_qp() function. Such refactoring is required to make
extension of that function with less worries of breaking driver.

Extra goal of such refactoring is to ensure that QP is allocated at the
beginning of function and released at the end. It will allow us to move QP
allocation to be under IB/core responsibility.
====================

Based on the mlx5-next branch at
 git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
Due to dependencies

* branch 'mlx5_ib_qp_refactor_1': (66 commits)
  RDMA/mlx5: Process all vendor flags in one place
  RDMA/mlx5: Return all configured create flags through query QP
  RDMA/mlx5: Change scatter CQE flag to be set like other vendor flags
  RDMA/mlx5: Use flags_en mechanism to mark QP created with WQE signature
  RDMA/mlx5: Process create QP flags in one place
  RDMA/mlx5: Delete create QP flags obfuscation
  RDMA/mlx5: Initial separation of RAW_PACKET QP from common flow
  RDMA/mlx5: Remove second copy from user for non RSS RAW QPs
  RDMA/mlx5: Move DRIVER QP flags check into separate function
  RDMA/mlx5: Update all DRIVER QP places to use QP subtype
  RDMA/mlx5: Split scatter CQE configuration for DCT QP
  RDMA/mlx5: Separate create QP flows to be based on type
  RDMA/mlx5: Set QP subtype immediately when it is known
  RDMA/mlx5: Avoid setting redundant NULL for XRC QPs
  RDMA/mlx5: Prepare QP allocation for future removal
  RDMA/mlx5: Perform check if QP creation flow is valid
  RDMA/mlx5: Delete impossible GSI port check
  RDMA/mlx5: Organize QP types checks in one place

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Process all vendor flags in one place
Leon Romanovsky [Mon, 27 Apr 2020 15:46:18 +0000 (18:46 +0300)]
RDMA/mlx5: Process all vendor flags in one place

Check that vendor flags provided through ucmd are valid.

Link: https://lore.kernel.org/r/20200427154636.381474-19-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Return all configured create flags through query QP
Leon Romanovsky [Mon, 27 Apr 2020 15:46:17 +0000 (18:46 +0300)]
RDMA/mlx5: Return all configured create flags through query QP

The "flags" field in struct mlx5_ib_qp contains all UAPI flags
configured at the create QP stage. Return all the data as is
without masking.

Link: https://lore.kernel.org/r/20200427154636.381474-18-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Change scatter CQE flag to be set like other vendor flags
Leon Romanovsky [Mon, 27 Apr 2020 15:46:16 +0000 (18:46 +0300)]
RDMA/mlx5: Change scatter CQE flag to be set like other vendor flags

In similar way to wqe_sig, the scat_cqe was treated differently from
other create QP vendor flags. Change it to be similar to other flags
and use flags_en mechanism.

Link: https://lore.kernel.org/r/20200427154636.381474-17-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Use flags_en mechanism to mark QP created with WQE signature
Leon Romanovsky [Mon, 27 Apr 2020 15:46:15 +0000 (18:46 +0300)]
RDMA/mlx5: Use flags_en mechanism to mark QP created with WQE signature

MLX5_QP_FLAG_SIGNATURE is exposed to the users but in the kernel
the create_qp flow treated it differently from other MLX5_QP_FLAG_*s.
Fix it by ditching wq_sig boolean variable and use general flag_en
mechanism.

Link: https://lore.kernel.org/r/20200427154636.381474-16-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Process create QP flags in one place
Leon Romanovsky [Mon, 27 Apr 2020 15:46:14 +0000 (18:46 +0300)]
RDMA/mlx5: Process create QP flags in one place

create_flags is checked in too many places and scattered across all
the code, consolidate all the checks inside one function, so we will
be easily see the flow. As part of such change, delete unreachable code,
because IB/core is responsible sanitize the input.

Link: https://lore.kernel.org/r/20200427154636.381474-15-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Delete create QP flags obfuscation
Leon Romanovsky [Mon, 27 Apr 2020 15:46:13 +0000 (18:46 +0300)]
RDMA/mlx5: Delete create QP flags obfuscation

There is no point in redefinition of stable and exposed to users create
flags. Their values won't be changed and it is equal to used by the
mlx5. Delete the mlx5 definitions and use IB/core fields.

Link: https://lore.kernel.org/r/20200427154636.381474-14-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Initial separation of RAW_PACKET QP from common flow
Leon Romanovsky [Mon, 27 Apr 2020 15:46:12 +0000 (18:46 +0300)]
RDMA/mlx5: Initial separation of RAW_PACKET QP from common flow

Create initial function for IB_QPT_RAW_PACKET flow.

Link: https://lore.kernel.org/r/20200427154636.381474-13-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Remove second copy from user for non RSS RAW QPs
Leon Romanovsky [Mon, 27 Apr 2020 15:46:11 +0000 (18:46 +0300)]
RDMA/mlx5: Remove second copy from user for non RSS RAW QPs

Change the common code to use already copied user command buffer.

Link: https://lore.kernel.org/r/20200427154636.381474-12-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Move DRIVER QP flags check into separate function
Leon Romanovsky [Mon, 27 Apr 2020 15:46:10 +0000 (18:46 +0300)]
RDMA/mlx5: Move DRIVER QP flags check into separate function

Perform validation of DRIVER QP in relevant function.

Link: https://lore.kernel.org/r/20200427154636.381474-11-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Update all DRIVER QP places to use QP subtype
Leon Romanovsky [Mon, 27 Apr 2020 15:46:09 +0000 (18:46 +0300)]
RDMA/mlx5: Update all DRIVER QP places to use QP subtype

Instead of overwriting QP init attributes with driver QP subtype,
use that subtype directly. This change will allow us to remove
logic which cached QP init attributes.

Link: https://lore.kernel.org/r/20200427154636.381474-10-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Split scatter CQE configuration for DCT QP
Leon Romanovsky [Mon, 27 Apr 2020 15:46:08 +0000 (18:46 +0300)]
RDMA/mlx5: Split scatter CQE configuration for DCT QP

DCT QPs have separate creation flow and can be easily extracted
from configure_responder_scat_cqe(), this makes both updated
functions more clear.

Link: https://lore.kernel.org/r/20200427154636.381474-9-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Separate create QP flows to be based on type
Leon Romanovsky [Mon, 27 Apr 2020 15:46:07 +0000 (18:46 +0300)]
RDMA/mlx5: Separate create QP flows to be based on type

Move driver QP creation flow to separate functions to simplify
the create_qp() and allow future separation of create_qp_common()
to subtypes.

Link: https://lore.kernel.org/r/20200427154636.381474-8-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Set QP subtype immediately when it is known
Leon Romanovsky [Mon, 27 Apr 2020 15:46:06 +0000 (18:46 +0300)]
RDMA/mlx5: Set QP subtype immediately when it is known

There is no need to delay QP subtype assignment to the end of the
create_qp() function and it is better to move it to be immediately
after it is checked so we would be able to rewrite later checks
to be based on it and not on over-written struct ib_qp_init_attr.

Link: https://lore.kernel.org/r/20200427154636.381474-7-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Avoid setting redundant NULL for XRC QPs
Leon Romanovsky [Mon, 27 Apr 2020 15:46:05 +0000 (18:46 +0300)]
RDMA/mlx5: Avoid setting redundant NULL for XRC QPs

There is no need to set NULL in recv_cq and send_cq, they are already
set to NULL by the IB/core logic.

Link: https://lore.kernel.org/r/20200427154636.381474-6-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Prepare QP allocation for future removal
Leon Romanovsky [Mon, 27 Apr 2020 15:46:04 +0000 (18:46 +0300)]
RDMA/mlx5: Prepare QP allocation for future removal

Unify the QP memory allocation across different paths,
so it will be in one place.

Link: https://lore.kernel.org/r/20200427154636.381474-5-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Perform check if QP creation flow is valid
Leon Romanovsky [Mon, 27 Apr 2020 15:46:03 +0000 (18:46 +0300)]
RDMA/mlx5: Perform check if QP creation flow is valid

Fast check that kernel and user flows provides enough
data to create QP.

Link: https://lore.kernel.org/r/20200427154636.381474-4-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Delete impossible GSI port check
Leon Romanovsky [Mon, 27 Apr 2020 15:46:02 +0000 (18:46 +0300)]
RDMA/mlx5: Delete impossible GSI port check

GSI QP is created in the kernel with very strict parameters,
there is no possible way that port number will be wrong in
such flow.

Link: https://lore.kernel.org/r/20200427154636.381474-3-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Organize QP types checks in one place
Leon Romanovsky [Mon, 27 Apr 2020 15:46:01 +0000 (18:46 +0300)]
RDMA/mlx5: Organize QP types checks in one place

Perform check if QP type is supported in one place at the beginning of
the create_qp function instead of current implementation with checks
buried inside of the code.

Link: https://lore.kernel.org/r/20200427154636.381474-2-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agonet/mlx5: TX WQE Add trailer insertion field
Raed Salem [Fri, 24 Apr 2020 19:45:10 +0000 (12:45 -0700)]
net/mlx5: TX WQE Add trailer insertion field

Add new TX WQE field for Connect-X6DX trailer insertion support,
when set, the HW adds a trailer to the packet, the WQE trailer
association flags are used to set to HW the header which the
trailer belongs.

Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Add release all pages capability bit
Eran Ben Elisha [Fri, 24 Apr 2020 19:45:09 +0000 (12:45 -0700)]
net/mlx5: Add release all pages capability bit

Add a bit in HCA capabilities layout to indicate if release all pages is
supported.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Introduce TLS RX offload hardware bits
Tariq Toukan [Fri, 24 Apr 2020 19:45:08 +0000 (12:45 -0700)]
net/mlx5: Introduce TLS RX offload hardware bits

Add TLS RX offload related IFC hardware fields and enumerations.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Add structure and defines for pci sync for fw update event
Moshe Shemesh [Fri, 24 Apr 2020 19:45:07 +0000 (12:45 -0700)]
net/mlx5: Add structure and defines for pci sync for fw update event

Add needed structure layouts and defines for pci sync for fw update
event. The downstream patches will include event handlers for this event
type.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Add structure layout and defines for MFRL register
Moshe Shemesh [Fri, 24 Apr 2020 19:45:06 +0000 (12:45 -0700)]
net/mlx5: Add structure layout and defines for MFRL register

Add needed structure layouts and defines for MFRL (Management Firmware
Reset Level) register. This structure will be used for the firmware
upgrade and reset flow in the downstream patches.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Refactor imm_inval_pkey field in cqe struct
Raed Salem [Fri, 24 Apr 2020 19:45:05 +0000 (12:45 -0700)]
net/mlx5: Refactor imm_inval_pkey field in cqe struct

The imm_inval_pkey field can hold four different types of data,
depends on the usage, the data could be one of the below:
- Immediate field of the received message
- Invalidate rkey
- Pkey of the packet
- Flow table metadata

Current implementation doesn't reflect the intended usage of the
field at usage time.

Reflect the different types by replace this field with a union,
modify code where this field is used to reflect its intended
usage.

Signed-off-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Huy Nguyen <huyn@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Use aligned variable while allocating ICM memory
Erez Shitrit [Fri, 24 Apr 2020 19:45:04 +0000 (12:45 -0700)]
net/mlx5: Use aligned variable while allocating ICM memory

The alignment value is part of the input structure, so use it and spare
extra memory allocation when is not needed.
Now, using the new ability when allocating icm for Direct-Rule
insertion.
Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Introduce IPsec Connect-X offload hardware bits and structures
Raed Salem [Fri, 24 Apr 2020 19:45:03 +0000 (12:45 -0700)]
net/mlx5: Introduce IPsec Connect-X offload hardware bits and structures

Add IPsec offload related IFC structs, layouts and enumerations.

Signed-off-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Add support for COPY steering action
Huy Nguyen [Fri, 24 Apr 2020 19:45:02 +0000 (12:45 -0700)]
net/mlx5: Add support for COPY steering action

Add COPY type to modify_header action. IPsec feature is the first
feature that needs COPY steering action.

Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
4 years agoRDMA/hns: Simplify the status judgment code of hns_roce_v1_m_qp()
Lang Cheng [Wed, 15 Apr 2020 08:14:35 +0000 (16:14 +0800)]
RDMA/hns: Simplify the status judgment code of hns_roce_v1_m_qp()

Use status table to reduce cyclomatic complexity.

Link: https://lore.kernel.org/r/1586938475-37049-7-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Simplify the state judgment code of qp
Lang Cheng [Wed, 15 Apr 2020 08:14:34 +0000 (16:14 +0800)]
RDMA/hns: Simplify the state judgment code of qp

Use state table to make the qp state migrate code more readable.

Link: https://lore.kernel.org/r/1586938475-37049-6-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Simplify the cqe code of poll cq
Lang Cheng [Wed, 15 Apr 2020 08:14:33 +0000 (16:14 +0800)]
RDMA/hns: Simplify the cqe code of poll cq

Encapsulate codes to get status of cqe into a function and use map table
instead of switch-case to reduce cyclomatic complexity of
hns_roce_v2_poll_one().

Link: https://lore.kernel.org/r/1586938475-37049-5-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Simplify the qp state convert code
Lang Cheng [Wed, 15 Apr 2020 08:14:32 +0000 (16:14 +0800)]
RDMA/hns: Simplify the qp state convert code

Use type map table to reduce the cyclomatic complexity.

Link: https://lore.kernel.org/r/1586938475-37049-4-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Optimize hns_roce_v2_set_mac()
Lijun Ou [Wed, 15 Apr 2020 08:14:31 +0000 (16:14 +0800)]
RDMA/hns: Optimize hns_roce_v2_set_mac()

Removes the unnecessary memset opertaion and adjust style of some lines in
hns_roce_v2_set_mac().

Link: https://lore.kernel.org/r/1586938475-37049-3-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Optimize hns_roce_config_link_table()
Lijun Ou [Wed, 15 Apr 2020 08:14:30 +0000 (16:14 +0800)]
RDMA/hns: Optimize hns_roce_config_link_table()

Remove the unnecessary memset operation and adjust style of some lines in
hns_roce_config_link_table().

Link: https://lore.kernel.org/r/1586938475-37049-2-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agonet/mlx5: Update transobj.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 18:03:33 +0000 (21:03 +0300)]
net/mlx5: Update transobj.c new cmd interface

Do mass update of transobj.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update SW steering new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 18:02:08 +0000 (21:02 +0300)]
net/mlx5: Update SW steering new cmd interface

Do mass update of SW steering to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update port.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 18:00:23 +0000 (21:00 +0300)]
net/mlx5: Update port.c new cmd interface

Do mass update of port.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update rl.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 14:05:31 +0000 (17:05 +0300)]
net/mlx5: Update rl.c new cmd interface

Do mass update of rl.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update uar.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 14:05:05 +0000 (17:05 +0300)]
net/mlx5: Update uar.c new cmd interface

Do mass update of uar.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update pd.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 14:04:30 +0000 (17:04 +0300)]
net/mlx5: Update pd.c new cmd interface

Do mass update of pd.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update pagealloc.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 14:02:07 +0000 (17:02 +0300)]
net/mlx5: Update pagealloc.c new cmd interface

Do mass update of pagealloc.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update mr.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:50:37 +0000 (16:50 +0300)]
net/mlx5: Update mr.c new cmd interface

Do mass update of mr.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update mcg.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:43:58 +0000 (16:43 +0300)]
net/mlx5: Update mcg.c new cmd interface

Do mass update of mcg.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update main.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:33:38 +0000 (16:33 +0300)]
net/mlx5: Update main.c new cmd interface

Do mass update of main.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update vxlan.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:32:06 +0000 (16:32 +0300)]
net/mlx5: Update vxlan.c new cmd interface

Do mass update of vxlan.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update mpfs.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:31:21 +0000 (16:31 +0300)]
net/mlx5: Update mpfs.c new cmd interface

Do mass update of mpfs.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update gid.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:30:39 +0000 (16:30 +0300)]
net/mlx5: Update gid.c new cmd interface

Do mass update of gid.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update lag.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:17:01 +0000 (16:17 +0300)]
net/mlx5: Update lag.c new cmd interface

Do mass update of lag.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update fw.c new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:08:35 +0000 (16:08 +0300)]
net/mlx5: Update fw.c new cmd interface

Do mass update of fw.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update fs_core new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 13:01:30 +0000 (16:01 +0300)]
net/mlx5: Update fs_core new cmd interface

Do mass update of fs_core to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update FPGA to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 12:59:30 +0000 (15:59 +0300)]
net/mlx5: Update FPGA to new cmd interface

Do mass update of FPGA to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update eswitch to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 09:30:08 +0000 (12:30 +0300)]
net/mlx5: Update eswitch to new cmd interface

Do mass update of eswitch to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update statistics to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 09:26:41 +0000 (12:26 +0300)]
net/mlx5: Update statistics to new cmd interface

Do mass update of statistics to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update eq.c to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 09:25:08 +0000 (12:25 +0300)]
net/mlx5: Update eq.c to new cmd interface

Do mass update of eq.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update ecpf.c to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 08:56:42 +0000 (11:56 +0300)]
net/mlx5: Update ecpf.c to new cmd interface

Do mass update of ecpf.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update debugfs.c to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 08:55:06 +0000 (11:55 +0300)]
net/mlx5: Update debugfs.c to new cmd interface

Do mass update of debugfs.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update cq.c to new cmd interface
Leon Romanovsky [Thu, 9 Apr 2020 08:39:14 +0000 (11:39 +0300)]
net/mlx5: Update cq.c to new cmd interface

Do mass update of cq.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Update vport.c to new cmd interface
Leon Romanovsky [Tue, 7 Apr 2020 15:59:51 +0000 (18:59 +0300)]
net/mlx5: Update vport.c to new cmd interface

Do mass update of vport.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agoRDMA/bnxt: Delete 'nq_ptr' variable which is not used
Leon Romanovsky [Sun, 19 Apr 2020 13:20:46 +0000 (16:20 +0300)]
RDMA/bnxt: Delete 'nq_ptr' variable which is not used

The variable "nq_ptr" is set but never used, this generates the following
warning while compiling kernel with W=1 option.

drivers/infiniband/hw/bnxt_re/qplib_fp.c: In function 'bnxt_qplib_service_nq':
drivers/infiniband/hw/bnxt_re/qplib_fp.c:303:25: warning:
   variable 'nq_ptr' set but not used [-Wunused-but-set-variable]
303 |  struct nq_base *nqe, **nq_ptr;
    |

Fixes: fddcbbb02af4 ("RDMA/bnxt_re: Simplify obtaining queue entry from hw ring")
Link: https://lore.kernel.org/r/20200419132046.123887-1-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Support 0 hop addressing for CQE buffer
Xi Wang [Mon, 13 Apr 2020 11:58:11 +0000 (19:58 +0800)]
RDMA/hns: Support 0 hop addressing for CQE buffer

Add the zero hop addressing support by using mtr interface for CQE buffer,
so the hns driver can support addressing hopnum between 0 to 3 for CQE.

Link: https://lore.kernel.org/r/1586779091-51410-7-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Support 0 hop addressing for SRQ buffer
Xi Wang [Mon, 13 Apr 2020 11:58:10 +0000 (19:58 +0800)]
RDMA/hns: Support 0 hop addressing for SRQ buffer

Add the zero hop addressing support by using mtr interface for SRQ buffer,
so the hns driver can support addressing hopnum between 0 to 3 for SRQ.

Link: https://lore.kernel.org/r/1586779091-51410-6-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Support 0 hop addressing for WQE buffer
Xi Wang [Mon, 13 Apr 2020 11:58:09 +0000 (19:58 +0800)]
RDMA/hns: Support 0 hop addressing for WQE buffer

Add the zero hop addressing support by using new mtr interface for WQE
buffer and simple mtr invoking process, so WQE buffer can support hopnum
between 0 to 3.

Link: https://lore.kernel.org/r/1586779091-51410-5-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Optimize 0 hop addressing for EQE buffer
Xi Wang [Mon, 13 Apr 2020 11:58:08 +0000 (19:58 +0800)]
RDMA/hns: Optimize 0 hop addressing for EQE buffer

Use the new mtr interface to simple the hop 0 addressing and multihop
addressing process.

Link: https://lore.kernel.org/r/1586779091-51410-4-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Optimize hns buffer allocation flow
Xi Wang [Mon, 13 Apr 2020 11:58:07 +0000 (19:58 +0800)]
RDMA/hns: Optimize hns buffer allocation flow

When the value of nbufs is 1, the buffer is in direct mode, which may cause
confusion. So optimizes current codes to make it easier to maintain and
understand.

Link: https://lore.kernel.org/r/1586779091-51410-3-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/hns: Add support for addressing when hopnum is 0
Xi Wang [Mon, 13 Apr 2020 11:58:06 +0000 (19:58 +0800)]
RDMA/hns: Add support for addressing when hopnum is 0

Currently, WQE and EQE table have already used the mtr interface to config
and access memory by multi-hop addressing when hopnum is from 1 to 3. But
if hopnum is 0, each table need write its own but repetitive logic, and
many duplicate code exists in the mtr interfaces invoke process.

So wraps the public logic as 3 functions: hns_roce_mtr_create(),
hns_roce_mtr_destroy() and hns_roce_mtr_map() to support hopnum ranges from
0 to 3. In addition, makes the mtr interfaces easier to use.

Link: https://lore.kernel.org/r/1586779091-51410-2-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agonet/mlx5: Enable SW-defined RoCEv2 UDP source port
Mark Zhang [Tue, 14 Jan 2020 03:06:25 +0000 (05:06 +0200)]
net/mlx5: Enable SW-defined RoCEv2 UDP source port

When this is enabled, UDP source port for RoCEv2 packets are defined
by software instead of firmware.

Signed-off-by: Mark Zhang <markz@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Refactor HCA capability set flow
Leon Romanovsky [Thu, 19 Mar 2020 09:43:59 +0000 (11:43 +0200)]
net/mlx5: Refactor HCA capability set flow

Reduce the amount of kzalloc/kfree cycles by allocating
command structure in the parent function and leverage the
knowledge that set_caps() is called for HCA capabilities
only with specific HW structure as parameter to calculate
mailbox size.

Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Move QP logic to mlx5_ib
Leon Romanovsky [Sat, 4 Apr 2020 07:40:24 +0000 (10:40 +0300)]
net/mlx5: Move QP logic to mlx5_ib

The mlx5_core doesn't need any functionality coded in qp.c, so move
that file to drivers/infiniband/ be under mlx5_ib responsibility.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agoRDMA/mlx5: Alphabetically sort build artifacts
Leon Romanovsky [Wed, 1 Apr 2020 08:48:47 +0000 (11:48 +0300)]
RDMA/mlx5: Alphabetically sort build artifacts

Sort .o objects in makefile to make addition of new object
less cumbersome.

Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Delete not-used cmd header
Leon Romanovsky [Tue, 7 Apr 2020 13:09:15 +0000 (16:09 +0300)]
net/mlx5: Delete not-used cmd header

The structures defined in the cmd header are not used and can be safely
removed from the driver. This patch removes that file and deletes all
relevant includes.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agoRDMA/mlx5: Delete Q counter allocations command
Leon Romanovsky [Fri, 3 Apr 2020 10:31:18 +0000 (13:31 +0300)]
RDMA/mlx5: Delete Q counter allocations command

Remove mlx5_ib implementation of Q counter allocation logic
together with cleaning boolean which controlled validity of the
counter. It is not needed, because counter_id == 0 means that
counter is not valid.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Remove Q counter low level helper APIs
Leon Romanovsky [Fri, 3 Apr 2020 08:28:28 +0000 (11:28 +0300)]
net/mlx5: Remove Q counter low level helper APIs

mlx5 core users are encouraged to use low level API (mlx5_cmd_exec)
without the need of helper functions, do this for q counters, remove
helper functions and call mlx5_cmd_exec directly from users.

This will help reduce the total amount of code and reduction of the
mlx5_core symbol table.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Replace hand written QP context struct with automatic getters
Leon Romanovsky [Mon, 6 Apr 2020 12:53:06 +0000 (15:53 +0300)]
net/mlx5: Replace hand written QP context struct with automatic getters

By changing debugfs to not use any QP related API, convert the debugfs
code to use MLX5_GET() directly to access QP context instead of hand
written struct.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Remove extra indirection while storing QPN
Leon Romanovsky [Mon, 6 Apr 2020 08:17:44 +0000 (11:17 +0300)]
net/mlx5: Remove extra indirection while storing QPN

The FPGA, SW steering and IPoIB need to have only QPN from the
mlx5_core_qp struct, so reduce memory footprint by storing QPN
directly.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Open-code modify QP in the IPoIB module
Leon Romanovsky [Mon, 6 Apr 2020 10:43:14 +0000 (13:43 +0300)]
net/mlx5: Open-code modify QP in the IPoIB module

Remove dependency on qp.c from the IPoIB by open coding
modify QP interface.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Open-code modify QP in the FPGA module
Leon Romanovsky [Mon, 6 Apr 2020 06:42:43 +0000 (09:42 +0300)]
net/mlx5: Open-code modify QP in the FPGA module

Remove dependency on qp.c from the FPGA by open coding
modify QP interface.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Open-code modify QP in steering module
Leon Romanovsky [Sat, 4 Apr 2020 15:25:48 +0000 (18:25 +0300)]
net/mlx5: Open-code modify QP in steering module

Remove dependency on qp.c from SW steering by open
coding modify QP interface.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Remove empty QP and CQ events handlers
Leon Romanovsky [Mon, 6 Apr 2020 05:40:52 +0000 (08:40 +0300)]
net/mlx5: Remove empty QP and CQ events handlers

The QP and CQ events functions do nothing except printing some debug
messages. There is nothing to do with this knowledge and such events,
so remove them.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Open-code create and destroy QP calls
Leon Romanovsky [Thu, 2 Apr 2020 12:17:40 +0000 (15:17 +0300)]
net/mlx5: Open-code create and destroy QP calls

FPGA, IPoIB and SW steering don't need anything from the
mlx5_core_create_qp() and mlx5_core_destroy_qp() except calls
to mlx5_cmd_exec().

Let's open-code it, so we will be able to move qp.c to mlx5_ib.

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agonet/mlx5: Provide simplified command interfaces
Leon Romanovsky [Sun, 5 Apr 2020 17:57:00 +0000 (20:57 +0300)]
net/mlx5: Provide simplified command interfaces

Many mlx5_cmd_exec() callers are not interested in the output from that
command or have standard in/out structures. Those callers simply allocate
those structure on the stack and use sizeof() to provide in/out arguments.

In this naive approach provide simplified versions of mlx5_cmd_exec().

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4 years agoRDMA/rw: use DIV_ROUND_UP to calculate nr_ops
Max Gurtovoy [Mon, 13 Apr 2020 13:39:05 +0000 (16:39 +0300)]
RDMA/rw: use DIV_ROUND_UP to calculate nr_ops

Don't open-code DIV_ROUND_UP() kernel macro.

Link: https://lore.kernel.org/r/20200413133905.933343-1-leon@kernel.org
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/cma: Limit the scope of rdma_is_consumer_reject function
Leon Romanovsky [Mon, 13 Apr 2020 13:23:23 +0000 (16:23 +0300)]
RDMA/cma: Limit the scope of rdma_is_consumer_reject function

The function is local to cma.c, so let's limit its scope.

Link: https://lore.kernel.org/r/20200413132323.930869-1-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/bnxt_re: Remove dead code from rcfw
Devesh Sharma [Thu, 2 Apr 2020 18:12:15 +0000 (14:12 -0400)]
RDMA/bnxt_re: Remove dead code from rcfw

In the previous refactoring serise there were few leftover functions which
are not is use anymore.  Removed them as it is a dead code.

Fixes: 6f53196bc5e7 ("RDMA/bnxt_re: Refactor doorbell management functions")
Link: https://lore.kernel.org/r/1585851136-2316-5-git-send-email-devesh.sharma@broadcom.com
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/bnxt_re: Simplify obtaining queue entry from hw ring
Devesh Sharma [Thu, 2 Apr 2020 18:12:14 +0000 (14:12 -0400)]
RDMA/bnxt_re: Simplify obtaining queue entry from hw ring

Restructring the data path and control path queue management code to
simplify the way a queue element is extracted from the hardware ring.

Introduced a new function which will give a pointer to the next ring item
depending upon the current cons/prod index in the hardware queue.

Further, there are hardcoding when size of queue entry is calculated,
replacing it with an inline function. This function would be easier to
expand if need going forward.

The code section to initialize the PSN search areas has also been
restructured and couple of functions has been added there.

Link: https://lore.kernel.org/r/1585851136-2316-4-git-send-email-devesh.sharma@broadcom.com
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/bnxt_re: Update missing hsi data structures
Devesh Sharma [Thu, 2 Apr 2020 18:12:13 +0000 (14:12 -0400)]
RDMA/bnxt_re: Update missing hsi data structures

Adding fast path support data structure into hardware HSI. These
structures are header only definition of RQE/SRQE/SQE. This is to help
calculating the size of hardware wqe size.

Link: https://lore.kernel.org/r/1585851136-2316-3-git-send-email-devesh.sharma@broadcom.com
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/bnxt_re: Reduce device page size detection code
Devesh Sharma [Thu, 2 Apr 2020 18:12:12 +0000 (14:12 -0400)]
RDMA/bnxt_re: Reduce device page size detection code

Getting rid of the repeated code in the driver when deciding on the page
size of the hardware ring memory. A new common function would translate
the ring page size into device specific page size.

Link: https://lore.kernel.org/r/1585851136-2316-2-git-send-email-devesh.sharma@broadcom.com
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoIB/qib: Remove unused variable ret
Zou Wei [Mon, 13 Apr 2020 02:42:04 +0000 (10:42 +0800)]
IB/qib: Remove unused variable ret

This patch fixes below warnings reported by coccicheck

drivers/infiniband/hw/qib/qib_iba7322.c:6878:8-11:
Unneeded variable: "ret". Return "0" on line 6907
drivers/infiniband/hw/qib/qib_iba7322.c:2378:5-8:
Unneeded variable: "ret". Return "0" on line 2513

Link: https://lore.kernel.org/r/1586745724-107477-1-git-send-email-zou_wei@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoIB: Fix some documentation warnings
Mauro Carvalho Chehab [Tue, 14 Apr 2020 16:48:43 +0000 (18:48 +0200)]
IB: Fix some documentation warnings

Parsing verbs.c with kernel-doc produce some warnings:

./drivers/infiniband/core/verbs.c:2579: WARNING: Unexpected indentation.
./drivers/infiniband/core/verbs.c:2581: WARNING: Block quote ends without a blank line; unexpected unindent.
./drivers/infiniband/core/verbs.c:2613: WARNING: Unexpected indentation.
./drivers/infiniband/core/verbs.c:2579: WARNING: Unexpected indentation.
./drivers/infiniband/core/verbs.c:2581: WARNING: Block quote ends without a blank line; unexpected unindent.
./drivers/infiniband/core/verbs.c:2613: WARNING: Unexpected indentation.

Address them by adding an extra blank line and converting the parameters
on one of the arguments to a table.

Link: https://lore.kernel.org/r/4c5466d0f450c5a9952138150c3485740b37f9c5.1586881715.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA: Remove a few extra calls to ib_get_client_data()
Jason Gunthorpe [Tue, 7 Apr 2020 23:20:09 +0000 (20:20 -0300)]
RDMA: Remove a few extra calls to ib_get_client_data()

These four places already have easy access to the client data, just use
that instead.

Link: https://lore.kernel.org/r/0-v1-fae83f600b4a+68-less_get_client_data%25jgg@mellanox.com
Acked-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/uverbs: Make the event_queue fds return POLLERR when disassociated
Jason Gunthorpe [Tue, 7 Apr 2020 00:44:26 +0000 (21:44 -0300)]
RDMA/uverbs: Make the event_queue fds return POLLERR when disassociated

If is_closed is set, and the event list is empty, then read() will return
-EIO without blocking. After setting is_closed in
ib_uverbs_free_event_queue(), we do trigger a wake_up on the poll_wait,
but the fops->poll() function does not check it, so poll will continue to
sleep on an empty list.

Fixes: 14e23bd6d221 ("RDMA/core: Fix locking in ib_uverbs_event_read")
Link: https://lore.kernel.org/r/0-v1-ace813388969+48859-uverbs_poll_fix%25jgg@mellanox.com
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoRDMA/mlx5: Fix udata response upon SRQ creation
Yishai Hadas [Mon, 6 Apr 2020 17:35:40 +0000 (20:35 +0300)]
RDMA/mlx5: Fix udata response upon SRQ creation

Fix udata response upon SRQ creation to use the UAPI structure (i.e.
mlx5_ib_create_srq_resp). It did not zero the reserved field in userspace.

Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Link: https://lore.kernel.org/r/20200406173540.1466477-1-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@mellanox.com>
4 years agoRDMA/rxe: Set default vendor ID
Zhu Yanjun [Mon, 6 Apr 2020 17:35:01 +0000 (20:35 +0300)]
RDMA/rxe: Set default vendor ID

The RXE driver doesn't set vendor_id and user space applications see
zeros. This causes to pyverbs tests to fail with the following traceback,
because the expectation is to have valid vendor_id.

Traceback (most recent call last):
  File "tests/test_device.py", line 51, in test_query_device
    self.verify_device_attr(attr)
  File "tests/test_device.py", line 77, in verify_device_attr
    assert attr.vendor_id != 0

In order to fix it, we will set vendor_id 0XFFFFFF, according to the IBTA
v1.4 A3.3.1 VENDOR INFORMATION section.

"""
A vendor that produces a generic controller (i.e., one that supports a
standard I/O protocol such as SRP), which does not have vendor specific
device drivers, may use the value of 0xFFFFFF in the VendorID field.
"""

Before:

hca_id: rxe0
        transport:                      InfiniBand (0)
        fw_ver:                         0.0.0
        node_guid:                      5054:00ff:feaa:5363
        sys_image_guid:                 5054:00ff:feaa:5363
        vendor_id:                      0x0000

After:

hca_id: rxe0
        transport:                      InfiniBand (0)
        fw_ver:                         0.0.0
        node_guid:                      5054:00ff:feaa:5363
        sys_image_guid:                 5054:00ff:feaa:5363
        vendor_id:                      0xffffff

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20200406173501.1466273-1-leon@kernel.org
Signed-off-by: Zhu Yanjun <yanjunz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
4 years agoLinux 5.7-rc1
Linus Torvalds [Sun, 12 Apr 2020 19:35:55 +0000 (12:35 -0700)]
Linux 5.7-rc1

4 years agoMAINTAINERS: sort field names for all entries
Linus Torvalds [Sun, 12 Apr 2020 18:04:58 +0000 (11:04 -0700)]
MAINTAINERS: sort field names for all entries

This sorts the actual field names too, potentially causing even more
chaos and confusion at merge time if you have edited the MAINTAINERS
file.  But the end result is a more consistent layout, and hopefully
it's a one-time pain minimized by doing this just before the -rc1
release.

This was entirely scripted:

  ./scripts/parse-maintainers.pl --input=MAINTAINERS --output=MAINTAINERS --order

Requested-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>