svn commit: r322161 - in stable/11/sys/ofed: drivers/infiniband/hw/mlx4 drivers/net/mlx4 include/linux/mlx4

Hans Petter Selasky hselasky at FreeBSD.org
Mon Aug 7 13:14:12 UTC 2017


Author: hselasky
Date: Mon Aug  7 13:14:10 2017
New Revision: 322161
URL: https://svnweb.freebsd.org/changeset/base/322161

Log:
  MFC r321772:
  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

Modified:
  stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c
  stable/11/sys/ofed/drivers/net/mlx4/main.c
  stable/11/sys/ofed/include/linux/mlx4/device.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c
==============================================================================
--- stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c	Mon Aug  7 13:07:58 2017	(r322160)
+++ stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c	Mon Aug  7 13:14:10 2017	(r322161)
@@ -878,12 +878,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;
 		}

Modified: stable/11/sys/ofed/drivers/net/mlx4/main.c
==============================================================================
--- stable/11/sys/ofed/drivers/net/mlx4/main.c	Mon Aug  7 13:07:58 2017	(r322160)
+++ stable/11/sys/ofed/drivers/net/mlx4/main.c	Mon Aug  7 13:14:10 2017	(r322161)
@@ -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: stable/11/sys/ofed/include/linux/mlx4/device.h
==============================================================================
--- stable/11/sys/ofed/include/linux/mlx4/device.h	Mon Aug  7 13:07:58 2017	(r322160)
+++ stable/11/sys/ofed/include/linux/mlx4/device.h	Mon Aug  7 13:14:10 2017	(r322161)
@@ -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);
 


More information about the svn-src-all mailing list