svn commit: r321772 - in head/sys/dev/mlx4: . mlx4_core mlx4_ib
Hans Petter Selasky
hselasky at FreeBSD.org
Mon Jul 31 09:15:17 UTC 2017
Author: hselasky
Date: Mon Jul 31 09:15:15 2017
New Revision: 321772
URL: https://svnweb.freebsd.org/changeset/base/321772
Log:
Fix broken usage of the mlx4_read_clock() function:
- return value has too small width
- cycle_t is unsigned and cannot be less than zero
Sponsored by: Mellanox Technologies
MFC after: 1 week
Modified:
head/sys/dev/mlx4/device.h
head/sys/dev/mlx4/mlx4_core/mlx4_main.c
head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
Modified: head/sys/dev/mlx4/device.h
==============================================================================
--- head/sys/dev/mlx4/device.h Mon Jul 31 09:13:18 2017 (r321771)
+++ head/sys/dev/mlx4/device.h Mon Jul 31 09:15:15 2017 (r321772)
@@ -1337,7 +1337,7 @@ int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev,
int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, u32 max_range_qpn);
-int mlx4_read_clock(struct mlx4_dev *dev);
+s64 mlx4_read_clock(struct mlx4_dev *dev);
int mlx4_get_internal_clock_params(struct mlx4_dev *dev,
struct mlx4_clock_params *params);
Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==============================================================================
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Mon Jul 31 09:13:18 2017 (r321771)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Mon Jul 31 09:15:15 2017 (r321772)
@@ -1793,10 +1793,10 @@ static void unmap_bf_area(struct mlx4_dev *dev)
io_mapping_free(mlx4_priv(dev)->bf_mapping);
}
-int mlx4_read_clock(struct mlx4_dev *dev)
+s64 mlx4_read_clock(struct mlx4_dev *dev)
{
u32 clockhi, clocklo, clockhi1;
- cycle_t cycles;
+ s64 cycles;
int i;
struct mlx4_priv *priv = mlx4_priv(dev);
@@ -1813,7 +1813,7 @@ int mlx4_read_clock(struct mlx4_dev *dev)
cycles = (u64) clockhi << 32 | (u64) clocklo;
- return cycles;
+ return cycles & CORE_CLOCK_MASK;
}
EXPORT_SYMBOL_GPL(mlx4_read_clock);
Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==============================================================================
--- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Mon Jul 31 09:13:18 2017 (r321771)
+++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Mon Jul 31 09:15:15 2017 (r321772)
@@ -877,12 +877,12 @@ static int mlx4_ib_query_values(struct ib_device *devi
struct ib_device_values *values)
{
struct mlx4_ib_dev *dev = to_mdev(device);
- cycle_t cycles;
+ s64 cycles;
values->values_mask = 0;
if (q_values & IBV_VALUES_HW_CLOCK) {
cycles = mlx4_read_clock(dev->dev);
- if (cycles < 0) {
+ if (cycles >= 0) {
values->hwclock = cycles & CORE_CLOCK_MASK;
values->values_mask |= IBV_VALUES_HW_CLOCK;
}
More information about the svn-src-head
mailing list