IB/mlx4: Fix use of flow-counters for process_mad
For IB links, reading HCA flow counters through iboe_process_mad() should
be used when mlx4_ib_process_mad() is invoked only for VFs PMA queries and
exactly nothing else.
Fixes: 7193a141eb
('IB/mlx4: Set VF to read from QP counters')
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
cb1ff431c3
commit
43bfb9729e
|
@ -860,22 +860,31 @@ int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||||
struct mlx4_ib_dev *dev = to_mdev(ibdev);
|
struct mlx4_ib_dev *dev = to_mdev(ibdev);
|
||||||
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;
|
||||||
|
enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num);
|
||||||
|
|
||||||
if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
|
if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
|
||||||
*out_mad_size != sizeof(*out_mad)))
|
*out_mad_size != sizeof(*out_mad)))
|
||||||
return IB_MAD_RESULT_FAILURE;
|
return IB_MAD_RESULT_FAILURE;
|
||||||
|
|
||||||
switch (rdma_port_get_link_layer(ibdev, port_num)) {
|
/* iboe_process_mad() which uses the HCA flow-counters to implement IB PMA
|
||||||
case IB_LINK_LAYER_INFINIBAND:
|
* queries, should be called only by VFs and for that specific purpose
|
||||||
if (!mlx4_is_slave(dev->dev))
|
*/
|
||||||
return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
|
if (link == IB_LINK_LAYER_INFINIBAND) {
|
||||||
in_grh, in_mad, out_mad);
|
if (mlx4_is_slave(dev->dev) &&
|
||||||
case IB_LINK_LAYER_ETHERNET:
|
in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT &&
|
||||||
|
in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS)
|
||||||
return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
|
return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
|
||||||
in_grh, in_mad, out_mad);
|
in_grh, in_mad, out_mad);
|
||||||
default:
|
|
||||||
return -EINVAL;
|
return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
|
||||||
|
in_grh, in_mad, out_mad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (link == IB_LINK_LAYER_ETHERNET)
|
||||||
|
return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
|
||||||
|
in_grh, in_mad, out_mad);
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_handler(struct ib_mad_agent *agent,
|
static void send_handler(struct ib_mad_agent *agent,
|
||||||
|
|
Loading…
Reference in New Issue