Commit 84b56d57 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jason Gunthorpe

RDMA/ocrdma: Simplify process_mad function

Change the switch with one case into a simple if statement so the code is
less confusing.

Link: https://lore.kernel.org/r/20191029062745.7932-12-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent dd0b0159
...@@ -256,20 +256,16 @@ int ocrdma_process_mad(struct ib_device *ibdev, ...@@ -256,20 +256,16 @@ int ocrdma_process_mad(struct ib_device *ibdev,
struct ib_mad_hdr *out, size_t *out_mad_size, struct ib_mad_hdr *out, size_t *out_mad_size,
u16 *out_mad_pkey_index) u16 *out_mad_pkey_index)
{ {
int status; int status = IB_MAD_RESULT_SUCCESS;
struct ocrdma_dev *dev; struct ocrdma_dev *dev;
const struct ib_mad *in_mad = (const struct ib_mad *)in; const struct ib_mad *in_mad = (const struct ib_mad *)in;
struct ib_mad *out_mad = (struct ib_mad *)out; struct ib_mad *out_mad = (struct ib_mad *)out;
switch (in_mad->mad_hdr.mgmt_class) { if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {
case IB_MGMT_CLASS_PERF_MGMT:
dev = get_ocrdma_dev(ibdev); dev = get_ocrdma_dev(ibdev);
ocrdma_pma_counters(dev, out_mad); ocrdma_pma_counters(dev, out_mad);
status = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY; status |= IB_MAD_RESULT_REPLY;
break;
default:
status = IB_MAD_RESULT_SUCCESS;
break;
} }
return status; return status;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment