aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4/device.h
diff options
context:
space:
mode:
authorEran Ben Elisha <eranbe@mellanox.com>2015-06-15 17:59:05 +0300
committerDavid S. Miller <davem@davemloft.net>2015-06-15 17:23:02 -0700
commit9616982f3fcc9e6577d7f41009c4ef2df19a71ec (patch)
tree96f0e59cff49a2b82fe94cb08c0dc6c65ef0ca6c /include/linux/mlx4/device.h
parentIB/mlx4: Set VF to read from QP counters (diff)
downloadlinux-dev-9616982f3fcc9e6577d7f41009c4ef2df19a71ec.tar.xz
linux-dev-9616982f3fcc9e6577d7f41009c4ef2df19a71ec.zip
net/mlx4_core: Add helper to query counters
This is an infrastructure step for querying VF and PF counters. This code was in the IB driver, move it to the mlx4 core driver so it will be accessible for more use cases. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mlx4/device.h')
-rw-r--r--include/linux/mlx4/device.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 4820080ac394..efe80c754b2f 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -771,6 +771,14 @@ union mlx4_ext_av {
struct mlx4_eth_av eth;
};
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_32BIT_COUNTER(counter, value) do { \
+ if ((value) > U32_MAX) \
+ counter = cpu_to_be32(U32_MAX); \
+ else \
+ counter = cpu_to_be32(value); \
+} while (0)
+
struct mlx4_counter {
u8 reserved1[3];
u8 counter_mode;