summaryrefslogtreecommitdiffstats
path: root/sys/ofed
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2015-11-24 12:11:56 +0000
committerhselasky <hselasky@FreeBSD.org>2015-11-24 12:11:56 +0000
commit729fe703d70efcf6635af1921b105ab6ee8adab7 (patch)
tree9c489a4d4f6ae697e738ac01a0aaf95f17bfac90 /sys/ofed
parent34233609c9da19b0eff3179d44f78cb0786e4556 (diff)
downloadFreeBSD-src-729fe703d70efcf6635af1921b105ab6ee8adab7.zip
FreeBSD-src-729fe703d70efcf6635af1921b105ab6ee8adab7.tar.gz
Add some defines needed by the coming mlx5 infiniband support.
Sponsored by: Mellanox Technologies MFC after: 1 week
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/include/rdma/ib_pma.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/ofed/include/rdma/ib_pma.h b/sys/ofed/include/rdma/ib_pma.h
index a5889f1..a2300cd 100644
--- a/sys/ofed/include/rdma/ib_pma.h
+++ b/sys/ofed/include/rdma/ib_pma.h
@@ -37,6 +37,25 @@
#include <rdma/ib_mad.h>
+#define MAX_U32 0xffffffffULL
+#define MAX_U16 0xffffUL
+
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_32BIT_COUNTER(counter, value) do { \
+ if ((value) > MAX_U32) \
+ counter = cpu_to_be32(MAX_U32); \
+ else \
+ counter = cpu_to_be32(value); \
+} while (0)
+
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_16BIT_COUNTER(counter, value) do { \
+ if ((value) > MAX_U16) \
+ counter = cpu_to_be16(MAX_U16); \
+ else \
+ counter = cpu_to_be16(value); \
+} while (0)
+
/*
* PMA class portinfo capability mask bits
*/
OpenPOWER on IntegriCloud