xref: /titanic_51/usr/src/uts/common/sys/ib/mgt/ibmf/ibmf_kstat.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * This file contains the IBMF kstat structures and defines.
34  */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* Kstat structure definitions */
41 typedef struct ibmf_port_kstat_s {
42 	kstat_named_t	clients_registered; /* # clients registered on HCA */
43 	kstat_named_t	client_regs_failed; /* client registration failures */
44 	kstat_named_t	send_wqes_alloced; /* # currently allocated send WQEs */
45 	kstat_named_t	recv_wqes_alloced; /* # currently allocated recv WQEs */
46 	kstat_named_t	swqe_allocs_failed; /* send WQE allocations failed */
47 	kstat_named_t	rwqe_allocs_failed; /* recv WQE allocations failed */
48 } ibmf_port_kstat_t;
49 
50 typedef struct ibmf_kstat_s {
51 	kstat_named_t	msgs_alloced;	  /* # currently allocated messages */
52 	kstat_named_t	msgs_active;	  /* # currently active messages */
53 	kstat_named_t	msgs_sent;	  /* # total msgs sent per port */
54 	kstat_named_t	msgs_received;	  /* # total msgs recv per port */
55 	kstat_named_t	sends_active;    /* # currently active send messages */
56 	kstat_named_t	recvs_active;    /* # currently active recv messages */
57 	kstat_named_t	ud_dests_alloced;  /* # currently allocated UD Dests */
58 	kstat_named_t	alt_qps_alloced;  /* # currently allocated alt. QPs */
59 	kstat_named_t	send_cb_active;	  /* # active send callbacks */
60 	kstat_named_t	recv_cb_active;	  /* # active send callbacks */
61 	kstat_named_t	recv_bufs_alloced; /* # receive buffers allocated */
62 	kstat_named_t	msg_allocs_failed; /* message allocations failed */
63 	kstat_named_t	uddest_allocs_failed; /* UD dest allocations failed */
64 	kstat_named_t	alt_qp_allocs_failed; /* alt. QP allocations failed */
65 	kstat_named_t	send_pkt_failed; /* send packet failures */
66 	kstat_named_t	rmpp_errors;	/* count of rmpp errors */
67 } ibmf_kstat_t;
68 
69 #define	IBMF_ADD32_KSTATS(clientp, xx, val)				\
70 	if ((clientp != NULL) && (clientp->ic_kstatp != NULL)) {	\
71 		ibmf_kstat_t	*kp;					\
72 		kp = (ibmf_kstat_t *)clientp->ic_kstatp->ks_data;	\
73 		kp->xx.value.ui32 += val;				\
74 	}
75 
76 #define	IBMF_SUB32_KSTATS(clientp, xx, val)				\
77 	if ((clientp != NULL) && (clientp->ic_kstatp != NULL)) {	\
78 		ibmf_kstat_t	*kp;					\
79 		kp = (ibmf_kstat_t *)clientp->ic_kstatp->ks_data;	\
80 		kp->xx.value.ui32 -= val;				\
81 	}
82 
83 #define	IBMF_ADD32_PORT_KSTATS(cip, xx, val)				\
84 	if ((cip != NULL) && (cip->ci_port_kstatp != NULL)) {		\
85 		ibmf_port_kstat_t	*kp;				\
86 		kp = (ibmf_port_kstat_t *)cip->ci_port_kstatp->ks_data;	\
87 		kp->xx.value.ui32 += val;				\
88 	}
89 
90 #define	IBMF_SUB32_PORT_KSTATS(cip, xx, val)				\
91 	if ((cip != NULL) && (cip->ci_port_kstatp != NULL)) {		\
92 		ibmf_port_kstat_t	*kp;				\
93 		kp = (ibmf_port_kstat_t *)cip->ci_port_kstatp->ks_data;	\
94 		kp->xx.value.ui32 -= val;				\
95 	}
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* _SYS_IB_MGT_IBMF_IBMF_KSTAT_H */
102