From owner-svn-src-head@freebsd.org Tue Nov 24 12:11:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7C10A35049; Tue, 24 Nov 2015 12:11:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93D4518C9; Tue, 24 Nov 2015 12:11:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAOCBuSB082622; Tue, 24 Nov 2015 12:11:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAOCBuID082621; Tue, 24 Nov 2015 12:11:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511241211.tAOCBuID082621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 24 Nov 2015 12:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291249 - head/sys/ofed/include/rdma X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 12:11:57 -0000 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 +#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 */