Print this page
10052 "dladm show-ether" should pick one kstat snapshot and stick with it
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gergo Doma <domag02@gmail.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libdladm/common/libdladm_impl.h
+++ new/usr/src/lib/libdladm/common/libdladm_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 +/*
26 + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
27 + */
28 +
25 29 #ifndef _LIBDLADM_IMPL_H
26 30 #define _LIBDLADM_IMPL_H
27 31
28 32 #include <sys/types.h>
29 33 #include <sys/mac.h>
30 34 #include <sys/mac_flow.h>
31 35 #include <libdladm.h>
32 36 #include <stdio.h>
33 37
34 38 #ifdef __cplusplus
35 39 extern "C" {
36 40 #endif
37 41
38 42 #define MAXLINELEN 1024
39 43 #define BUFLEN(lim, ptr) (((lim) > (ptr)) ? ((lim) - (ptr)) : 0)
40 44 #define V4_PART_OF_V6(v6) ((v6)._S6_un._S6_u32[3])
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
41 45
42 46 /*
43 47 * The handle contains file descriptors to DLD_CONTROL_DEV and
44 48 * DLMGMT_DOOR. Rather than opening the file descriptor each time
45 49 * it is required, the handle is opened by consumers of libdladm
46 50 * (e.g., dladm) and then passed to libdladm.
47 51 */
48 52 struct dladm_handle {
49 53 int dld_fd; /* file descriptor to DLD_CONTROL_DEV */
50 54 int door_fd; /* file descriptor to DLMGMT_DOOR */
55 + kstat_ctl_t *dld_kcp; /* for kstat consumers */
51 56 };
52 57
53 58 /* DLMGMT_DOOR can only be accessed by libdladm and dlmgmtd */
54 59 extern dladm_status_t dladm_door_fd(dladm_handle_t, int *);
55 60
56 61 extern dladm_status_t dladm_errno2status(int);
57 62 extern dladm_status_t i_dladm_rw_db(dladm_handle_t, const char *, mode_t,
58 63 dladm_status_t (*)(dladm_handle_t, void *, FILE *,
59 64 FILE *), void *, boolean_t);
60 65 extern dladm_status_t dladm_get_state(dladm_handle_t, datalink_id_t,
61 66 link_state_t *);
62 67 extern void dladm_find_setbits32(uint32_t, uint32_t *, uint32_t *);
63 68 extern dladm_status_t dladm_parse_args(char *, dladm_arg_list_t **,
64 69 boolean_t);
65 70 extern void dladm_free_args(dladm_arg_list_t *);
66 71
67 72 /*
68 73 * Link attributes persisted by dlmgmtd.
69 74 */
70 75 /*
71 76 * Set for VLANs only
72 77 */
73 78 #define FVLANID "vid" /* uint64_t */
74 79 #define FLINKOVER "linkover" /* uint64_t */
75 80
76 81 /*
77 82 * Set for AGGRs only
78 83 */
79 84 #define FKEY "key" /* uint64_t */
80 85 #define FNPORTS "nports" /* uint64_t */
81 86 #define FPORTS "portnames" /* string */
82 87 #define FPOLICY "policy" /* uint64_t */
83 88 #define FFIXMACADDR "fix_macaddr" /* boolean_t */
84 89 #define FFORCE "force" /* boolean_t */
85 90 #define FLACPMODE "lacp_mode" /* uint64_t */
86 91 #define FLACPTIMER "lacp_timer" /* uint64_t */
87 92
88 93 /*
89 94 * Set for VNICs only
90 95 */
91 96 #define FMADDRTYPE "maddrtype" /* uint64_t */
92 97 #define FMADDRLEN "maddrlen" /* uint64_t */
93 98 #define FMADDRSLOT "maddrslot" /* uint64_t */
94 99 #define FMADDRPREFIXLEN "maddrpreflen" /* uint64_t */
95 100 #define FVRID "vrid" /* uint64_t */
96 101 #define FVRAF "vraf" /* uint64_t */
97 102
98 103 /*
99 104 * Set for simlinks only
100 105 */
101 106 #define FSIMNETTYPE "simnettype" /* uint64_t */
102 107 #define FSIMNETPEER "simnetpeer" /* uint64_t */
103 108
104 109 /*
105 110 * Set for IB partitions only
106 111 */
107 112 #define FPORTPKEY "pkey" /* uint64_t */
108 113
109 114 /*
110 115 * Common fields
111 116 */
112 117 #define FMACADDR "macaddr" /* string */
113 118
114 119 /*
115 120 * List of all the above attributes.
116 121 */
117 122 #define DLADM_ATTR_NAMES FVLANID, FLINKOVER, \
118 123 FKEY, FNPORTS, FPORTS, FPOLICY, \
119 124 FFIXMACADDR, FFORCE, FLACPMODE, FLACPTIMER, \
120 125 FMADDRTYPE, FMADDRLEN, FMADDRSLOT, \
121 126 FMADDRPREFIXLEN, FVRID, FVRAF, \
122 127 FMACADDR, FSIMNETTYPE, FSIMNETPEER
123 128
124 129 /*
125 130 * Data structures used for implementing temporary properties
126 131 */
127 132
128 133 typedef struct val_desc {
129 134 char *vd_name;
130 135 uintptr_t vd_val;
131 136 } val_desc_t;
132 137
133 138 #define VALCNT(vals) (sizeof ((vals)) / sizeof (val_desc_t))
134 139
135 140 extern dladm_status_t dladm_link_proplist_extract(dladm_handle_t,
136 141 dladm_arg_list_t *, mac_resource_props_t *,
137 142 uint_t);
138 143
139 144 extern dladm_status_t dladm_flow_proplist_extract(dladm_arg_list_t *,
140 145 mac_resource_props_t *);
141 146
142 147 /*
143 148 * The prop extract() callback.
144 149 *
145 150 * rp_extract extracts the kernel structure from the val_desc_t created
146 151 * by the pd_check function.
147 152 */
148 153 typedef dladm_status_t rp_extractf_t(val_desc_t *, uint_t, void *);
149 154 extern rp_extractf_t extract_maxbw, extract_priority,
150 155 extract_cpus, extract_protection,
151 156 extract_allowedips, extract_allowedcids,
152 157 extract_rxrings, extract_txrings, extract_pool;
153 158
154 159 typedef struct resource_prop_s {
155 160 /*
156 161 * resource property name
157 162 */
158 163 char *rp_name;
159 164
160 165 /*
161 166 * callback to extract kernel structure
162 167 */
163 168 rp_extractf_t *rp_extract;
164 169 } resource_prop_t;
165 170
166 171 /*
167 172 * Set for bridged links only
168 173 */
169 174 #define FBRIDGE "bridge" /* string */
170 175
171 176 #ifdef __cplusplus
172 177 }
173 178 #endif
174 179
175 180 #endif /* _LIBDLADM_IMPL_H */
↓ open down ↓ |
115 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX