xref: /illumos-gate/usr/src/uts/common/smbsrv/smb_kstat.h (revision 8365a6eace264590da157cd110d1ad159fdd448e)
16537f381Sas200622 /*
26537f381Sas200622  * CDDL HEADER START
36537f381Sas200622  *
46537f381Sas200622  * The contents of this file are subject to the terms of the
56537f381Sas200622  * Common Development and Distribution License (the "License").
66537f381Sas200622  * You may not use this file except in compliance with the License.
76537f381Sas200622  *
86537f381Sas200622  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96537f381Sas200622  * or http://www.opensolaris.org/os/licensing.
106537f381Sas200622  * See the License for the specific language governing permissions
116537f381Sas200622  * and limitations under the License.
126537f381Sas200622  *
136537f381Sas200622  * When distributing Covered Code, include this CDDL HEADER in each
146537f381Sas200622  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156537f381Sas200622  * If applicable, add the following below this CDDL HEADER, with the
166537f381Sas200622  * fields enclosed by brackets "[]" replaced with your own identifying
176537f381Sas200622  * information: Portions Copyright [yyyy] [name of copyright owner]
186537f381Sas200622  *
196537f381Sas200622  * CDDL HEADER END
206537f381Sas200622  */
216537f381Sas200622 /*
22148c5f43SAlan Wright  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23*8365a6eaSGordon Ross  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
246537f381Sas200622  */
256537f381Sas200622 
266537f381Sas200622 /*
276537f381Sas200622  * Kstat definitions for the SMB server module.
286537f381Sas200622  */
296537f381Sas200622 #ifndef _SMBSRV_SMB_KSTAT_H
306537f381Sas200622 #define	_SMBSRV_SMB_KSTAT_H
316537f381Sas200622 
32*8365a6eaSGordon Ross #include	<sys/kstat.h>
33148c5f43SAlan Wright 
346537f381Sas200622 #ifdef	__cplusplus
356537f381Sas200622 extern "C" {
366537f381Sas200622 #endif
376537f381Sas200622 
38148c5f43SAlan Wright #define	SMBSRV_KSTAT_PROCESS		"smbd"
396537f381Sas200622 #define	SMBSRV_KSTAT_MODULE		"smbsrv"
406537f381Sas200622 #define	SMBSRV_KSTAT_CLASS		"net"
416537f381Sas200622 #define	SMBSRV_KSTAT_NAME		"smbsrv"
426537f381Sas200622 #define	SMBSRV_KSTAT_NAME_CMDS		"smbsrv_commands"
4321b7895dSjb150015 #define	SMBSRV_KSTAT_TXRCACHE		"smb_txreq"
442c2961f8Sjose borrego #define	SMBSRV_KSTAT_REQUEST_CACHE	"smb_request_cache"
452c2961f8Sjose borrego #define	SMBSRV_KSTAT_SESSION_CACHE	"smb_session_cache"
462c2961f8Sjose borrego #define	SMBSRV_KSTAT_USER_CACHE		"smb_user_cache"
472c2961f8Sjose borrego #define	SMBSRV_KSTAT_TREE_CACHE		"smb_tree_cache"
482c2961f8Sjose borrego #define	SMBSRV_KSTAT_OFILE_CACHE	"smb_ofile_cache"
492c2961f8Sjose borrego #define	SMBSRV_KSTAT_ODIR_CACHE		"smb_odir_cache"
502c2961f8Sjose borrego #define	SMBSRV_KSTAT_NODE_CACHE		"smb_node_cache"
512c2961f8Sjose borrego #define	SMBSRV_KSTAT_MBC_CACHE		"smb_mbc_cache"
52148c5f43SAlan Wright #define	SMBSRV_KSTAT_STATISTICS		"smbsrv_statistics"
53148c5f43SAlan Wright #define	SMBSRV_KSTAT_UNSUPPORTED	"Unsupported"
54148c5f43SAlan Wright #define	SMBSRV_KSTAT_WORKERS		"smb_workers"
55148c5f43SAlan Wright 
56*8365a6eaSGordon Ross /*
57*8365a6eaSGordon Ross  * We don't want to pull in smb.h or smb2.h here, so we're using
58*8365a6eaSGordon Ross  * local defines corresponding to SMB_COM_NUM, SMB2__NCMDS for
59*8365a6eaSGordon Ross  * the ks_reqs1 and ks_reqs2 arrays, respectively.  These are
60*8365a6eaSGordon Ross  * sanity-checked when smb_server.c is compiled.
61*8365a6eaSGordon Ross  */
62*8365a6eaSGordon Ross #define	SMBSRV_KS_NREQS1	256	/* See: SMB_COM_NUM */
63*8365a6eaSGordon Ross #define	SMBSRV_KS_NREQS2	20	/* See: SMB2__NCMDS */
64*8365a6eaSGordon Ross 
65148c5f43SAlan Wright #pragma pack(1)
66148c5f43SAlan Wright 
67148c5f43SAlan Wright typedef struct smb_kstat_utilization {
68148c5f43SAlan Wright 	hrtime_t	ku_wtime;
69148c5f43SAlan Wright 	hrtime_t	ku_wlentime;
70148c5f43SAlan Wright 	hrtime_t	ku_rtime;
71148c5f43SAlan Wright 	hrtime_t	ku_rlentime;
72148c5f43SAlan Wright } smb_kstat_utilization_t;
73148c5f43SAlan Wright 
74148c5f43SAlan Wright typedef struct smb_kstat_req {
75148c5f43SAlan Wright 	char		kr_name[KSTAT_STRLEN];
76cb174861Sjoyce mcintosh 	char		kr_pad[(~(KSTAT_STRLEN & 0x07) + 1) & 0x07];
77148c5f43SAlan Wright 	uint64_t	kr_sum;
78148c5f43SAlan Wright 	uint64_t	kr_txb;
79148c5f43SAlan Wright 	uint64_t	kr_rxb;
80148c5f43SAlan Wright 	uint64_t	kr_nreq;
81148c5f43SAlan Wright 	uint64_t	kr_a_mean;
82148c5f43SAlan Wright 	uint64_t	kr_a_stddev;
83148c5f43SAlan Wright 	uint64_t	kr_d_mean;
84148c5f43SAlan Wright 	uint64_t	kr_d_stddev;
85148c5f43SAlan Wright } smb_kstat_req_t;
86148c5f43SAlan Wright 
87148c5f43SAlan Wright typedef struct smbsrv_kstats {
88148c5f43SAlan Wright 	hrtime_t		ks_start_time;
89148c5f43SAlan Wright 	uint64_t		ks_txb;		/* Bytes transmitted */
90148c5f43SAlan Wright 	uint64_t		ks_rxb;		/* Bytes received */
91148c5f43SAlan Wright 	uint64_t		ks_nreq;	/* Requests treated */
92148c5f43SAlan Wright 	smb_kstat_utilization_t	ks_utilization;
93*8365a6eaSGordon Ross 	smb_kstat_req_t		ks_reqs1[SMBSRV_KS_NREQS1];
94*8365a6eaSGordon Ross 	smb_kstat_req_t		ks_reqs2[SMBSRV_KS_NREQS2];
95148c5f43SAlan Wright 	uint32_t		ks_nbt_sess;	/* NBT sessions */
96148c5f43SAlan Wright 	uint32_t		ks_tcp_sess;	/* TCP sessions */
97148c5f43SAlan Wright 	uint32_t		ks_users;	/* Users logged in */
98148c5f43SAlan Wright 	uint32_t		ks_trees;	/* Trees connected */
99148c5f43SAlan Wright 	uint32_t		ks_files;	/* Open files */
100148c5f43SAlan Wright 	uint32_t		ks_pipes;	/* Open pipes */
101148c5f43SAlan Wright 	uint32_t		ks_maxreqs;	/* Max number of reqs */
102148c5f43SAlan Wright 	uint32_t		ks_padding;
103148c5f43SAlan Wright } smbsrv_kstats_t;
104148c5f43SAlan Wright 
105148c5f43SAlan Wright #pragma pack()
1066537f381Sas200622 
1076537f381Sas200622 #ifdef	__cplusplus
1086537f381Sas200622 }
1096537f381Sas200622 #endif
1106537f381Sas200622 
1116537f381Sas200622 #endif /* _SMBSRV_SMB_KSTAT_H */
112