xref: /illumos-gate/usr/src/uts/common/sys/ib/mgt/ibmf/ibmf_kstat.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_IB_MGT_IBMF_IBMF_KSTAT_H
28 #define	_SYS_IB_MGT_IBMF_IBMF_KSTAT_H
29 
30 /*
31  * This file contains the IBMF kstat structures and defines.
32  */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /* Kstat structure definitions */
39 typedef struct ibmf_port_kstat_s {
40 	kstat_named_t	clients_registered; /* # clients registered on HCA */
41 	kstat_named_t	client_regs_failed; /* client registration failures */
42 	kstat_named_t	send_wqes_alloced; /* # currently allocated send WQEs */
43 	kstat_named_t	recv_wqes_alloced; /* # currently allocated recv WQEs */
44 	kstat_named_t	swqe_allocs_failed; /* send WQE allocations failed */
45 	kstat_named_t	rwqe_allocs_failed; /* recv WQE allocations failed */
46 } ibmf_port_kstat_t;
47 
48 typedef struct ibmf_kstat_s {
49 	kstat_named_t	msgs_alloced;	  /* # currently allocated messages */
50 	kstat_named_t	msgs_active;	  /* # currently active messages */
51 	kstat_named_t	msgs_sent;	  /* # total msgs sent per port */
52 	kstat_named_t	msgs_received;	  /* # total msgs recv per port */
53 	kstat_named_t	sends_active;    /* # currently active send messages */
54 	kstat_named_t	recvs_active;    /* # currently active recv messages */
55 	kstat_named_t	ud_dests_alloced;  /* # currently allocated UD Dests */
56 	kstat_named_t	alt_qps_alloced;  /* # currently allocated alt. QPs */
57 	kstat_named_t	send_cb_active;	  /* # active send callbacks */
58 	kstat_named_t	recv_cb_active;	  /* # active send callbacks */
59 	kstat_named_t	recv_bufs_alloced; /* # receive buffers allocated */
60 	kstat_named_t	msg_allocs_failed; /* message allocations failed */
61 	kstat_named_t	uddest_allocs_failed; /* UD dest allocations failed */
62 	kstat_named_t	alt_qp_allocs_failed; /* alt. QP allocations failed */
63 	kstat_named_t	send_pkt_failed; /* send packet failures */
64 	kstat_named_t	rmpp_errors;	/* count of rmpp errors */
65 } ibmf_kstat_t;
66 
67 #define	IBMF_ADD32_KSTATS(clientp, xx, val)				\
68 	if ((clientp != NULL) && (clientp->ic_kstatp != NULL)) {	\
69 		ibmf_kstat_t	*kp;					\
70 		kp = (ibmf_kstat_t *)clientp->ic_kstatp->ks_data;	\
71 		kp->xx.value.ui32 += val;				\
72 	}
73 
74 #define	IBMF_SUB32_KSTATS(clientp, xx, val)				\
75 	if ((clientp != NULL) && (clientp->ic_kstatp != NULL)) {	\
76 		ibmf_kstat_t	*kp;					\
77 		kp = (ibmf_kstat_t *)clientp->ic_kstatp->ks_data;	\
78 		kp->xx.value.ui32 -= val;				\
79 	}
80 
81 #define	IBMF_ADD32_PORT_KSTATS(cip, xx, val)				\
82 	if ((cip != NULL) && (cip->ci_port_kstatp != NULL)) {		\
83 		ibmf_port_kstat_t	*kp;				\
84 		kp = (ibmf_port_kstat_t *)cip->ci_port_kstatp->ks_data;	\
85 		kp->xx.value.ui32 += val;				\
86 	}
87 
88 #define	IBMF_SUB32_PORT_KSTATS(cip, xx, val)				\
89 	if ((cip != NULL) && (cip->ci_port_kstatp != NULL)) {		\
90 		ibmf_port_kstat_t	*kp;				\
91 		kp = (ibmf_port_kstat_t *)cip->ci_port_kstatp->ks_data;	\
92 		kp->xx.value.ui32 -= val;				\
93 	}
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* _SYS_IB_MGT_IBMF_IBMF_KSTAT_H */
100