Author: hselasky
Date: Tue Nov 24 12:11:56 2015
New Revision: 291249
URL: https://svnweb.freebsd.org/changeset/base/291249

Log:
  Add some defines needed by the coming mlx5 infiniband support.
  
  Sponsored by: Mellanox Technologies
  MFC after:    1 week

Modified:
  head/sys/ofed/include/rdma/ib_pma.h

Modified: head/sys/ofed/include/rdma/ib_pma.h
==============================================================================
--- head/sys/ofed/include/rdma/ib_pma.h Tue Nov 24 11:09:39 2015        
(r291248)
+++ head/sys/ofed/include/rdma/ib_pma.h Tue Nov 24 12:11:56 2015        
(r291249)
@@ -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
  */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to