Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a7ff14d authored by Matan Barak's avatar Matan Barak Committed by Doug Ledford
Browse files

IB/mlx4: Do not attemp to report HCA clock offset on VFs



mlx4 VFs can provide CQE raw time-stamping services, but they
don't have the hca core clock mapped to their PCI bars.

As such, we should not attempt to query and report the clock offset
to user space for VFs. Doing so causes query_device over VFs to fail
with -ENOSUPP.

Fixes: 4b664c43 ('IB/mlx4: Add support for CQ time-stamping')
Signed-off-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent be4b4993
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -253,14 +253,15 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
	props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL;
	props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL;
	props->timestamp_mask = 0xFFFFFFFFFFFFULL;
	props->timestamp_mask = 0xFFFFFFFFFFFFULL;


	if (!mlx4_is_slave(dev->dev))
		err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
		err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
	if (err)
		goto out;


	if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) {
	if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) {
		resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE;
		resp.response_length += sizeof(resp.hca_core_clock_offset);
		resp.response_length += sizeof(resp.hca_core_clock_offset);
		if (!err && !mlx4_is_slave(dev->dev)) {
			resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP;
			resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP;
			resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE;
		}
	}
	}


	if (uhw->outlen) {
	if (uhw->outlen) {