Date: Tue, 24 Nov 2015 12:11:56 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291249 - head/sys/ofed/include/rdma Message-ID: <201511241211.tAOCBuID082621@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511241211.tAOCBuID082621>