|
root / base / usr / src / uts / common / smbsrv / smb_kstat.h
smb_kstat.h C 112 lines 3.4 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
 * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
 */

/*
 * Kstat definitions for the SMB server module.
 */
#ifndef _SMBSRV_SMB_KSTAT_H
#define	_SMBSRV_SMB_KSTAT_H

#include	<sys/kstat.h>

#ifdef	__cplusplus
extern "C" {
#endif

#define	SMBSRV_KSTAT_PROCESS		"smbd"
#define	SMBSRV_KSTAT_MODULE		"smbsrv"
#define	SMBSRV_KSTAT_CLASS		"net"
#define	SMBSRV_KSTAT_NAME		"smbsrv"
#define	SMBSRV_KSTAT_NAME_CMDS		"smbsrv_commands"
#define	SMBSRV_KSTAT_TXRCACHE		"smb_txreq"
#define	SMBSRV_KSTAT_REQUEST_CACHE	"smb_request_cache"
#define	SMBSRV_KSTAT_SESSION_CACHE	"smb_session_cache"
#define	SMBSRV_KSTAT_USER_CACHE		"smb_user_cache"
#define	SMBSRV_KSTAT_TREE_CACHE		"smb_tree_cache"
#define	SMBSRV_KSTAT_OFILE_CACHE	"smb_ofile_cache"
#define	SMBSRV_KSTAT_ODIR_CACHE		"smb_odir_cache"
#define	SMBSRV_KSTAT_NODE_CACHE		"smb_node_cache"
#define	SMBSRV_KSTAT_MBC_CACHE		"smb_mbc_cache"
#define	SMBSRV_KSTAT_STATISTICS		"smbsrv_statistics"
#define	SMBSRV_KSTAT_UNSUPPORTED	"Unsupported"
#define	SMBSRV_KSTAT_WORKERS		"smb_workers"

/*
 * We don't want to pull in smb.h or smb2.h here, so we're using
 * local defines corresponding to SMB_COM_NUM, SMB2__NCMDS for
 * the ks_reqs1 and ks_reqs2 arrays, respectively.  These are
 * sanity-checked when smb_server.c is compiled.
 */
#define	SMBSRV_KS_NREQS1	256	/* See: SMB_COM_NUM */
#define	SMBSRV_KS_NREQS2	20	/* See: SMB2__NCMDS */

#pragma pack(1)

typedef struct smb_kstat_utilization {
	hrtime_t	ku_wtime;
	hrtime_t	ku_wlentime;
	hrtime_t	ku_rtime;
	hrtime_t	ku_rlentime;
} smb_kstat_utilization_t;

typedef struct smb_kstat_req {
	char		kr_name[KSTAT_STRLEN];
	char		kr_pad[(~(KSTAT_STRLEN & 0x07) + 1) & 0x07];
	uint64_t	kr_sum;
	uint64_t	kr_txb;
	uint64_t	kr_rxb;
	uint64_t	kr_nreq;
	uint64_t	kr_a_mean;
	uint64_t	kr_a_stddev;
	uint64_t	kr_d_mean;
	uint64_t	kr_d_stddev;
} smb_kstat_req_t;

typedef struct smbsrv_kstats {
	hrtime_t		ks_start_time;
	uint64_t		ks_txb;		/* Bytes transmitted */
	uint64_t		ks_rxb;		/* Bytes received */
	uint64_t		ks_nreq;	/* Requests treated */
	smb_kstat_utilization_t	ks_utilization;
	smb_kstat_req_t		ks_reqs1[SMBSRV_KS_NREQS1];
	smb_kstat_req_t		ks_reqs2[SMBSRV_KS_NREQS2];
	uint32_t		ks_nbt_sess;	/* NBT sessions */
	uint32_t		ks_tcp_sess;	/* TCP sessions */
	uint32_t		ks_users;	/* Users logged in */
	uint32_t		ks_trees;	/* Trees connected */
	uint32_t		ks_files;	/* Open files */
	uint32_t		ks_pipes;	/* Open pipes */
	uint32_t		ks_maxreqs;	/* Max number of reqs */
	uint32_t		ks_padding;
} smbsrv_kstats_t;

#pragma pack()

#ifdef	__cplusplus
}
#endif

#endif /* _SMBSRV_SMB_KSTAT_H */