110 { ETHER_STAT_LP_CAP_100HDX, "lp_cap_100hdx", KSTAT_DATA_UINT32, 0 },
111 { ETHER_STAT_LP_CAP_10FDX, "lp_cap_10fdx", KSTAT_DATA_UINT32, 0 },
112 { ETHER_STAT_LP_CAP_10HDX, "lp_cap_10hdx", KSTAT_DATA_UINT32, 0 },
113 { ETHER_STAT_LP_CAP_ASMPAUSE, "lp_cap_asmpause", KSTAT_DATA_UINT32, 0 },
114 { ETHER_STAT_LP_CAP_PAUSE, "lp_cap_pause", KSTAT_DATA_UINT32, 0 },
115 { ETHER_STAT_LP_CAP_AUTONEG, "lp_cap_autoneg", KSTAT_DATA_UINT32, 0 },
116 { ETHER_STAT_LP_REMFAULT, "lp_rem_fault", KSTAT_DATA_UINT32, 0 },
117 { ETHER_STAT_LINK_ASMPAUSE, "link_asmpause", KSTAT_DATA_UINT32, 0 },
118 { ETHER_STAT_LINK_PAUSE, "link_pause", KSTAT_DATA_UINT32, 0 },
119 { ETHER_STAT_LINK_AUTONEG, "link_autoneg", KSTAT_DATA_UINT32, 0 },
120 { ETHER_STAT_LINK_DUPLEX, "link_duplex", KSTAT_DATA_UINT32, 0 }
121 };
122
123 static struct modlmisc mac_ether_modlmisc = {
124 &mod_miscops,
125 "Ethernet MAC plugin"
126 };
127
128 static struct modlinkage mac_ether_modlinkage = {
129 MODREV_1,
130 &mac_ether_modlmisc,
131 NULL
132 };
133
134 static mactype_ops_t mac_ether_type_ops;
135
136 static mac_ndd_mapping_t mac_ether_mapping[] = {
137 {"adv_autoneg_cap", MAC_PROP_AUTONEG, 0, 1,
138 sizeof (uint8_t), MAC_PROP_PERM_RW},
139
140 {"adv_5000fdx_cap", MAC_PROP_EN_5000FDX_CAP, 0, 1,
141 sizeof (uint8_t), MAC_PROP_PERM_RW},
142
143 {"adv_2500fdx_cap", MAC_PROP_EN_2500FDX_CAP, 0, 1,
144 sizeof (uint8_t), MAC_PROP_PERM_RW},
145
146 {"adv_100gfdx_cap", MAC_PROP_EN_100GFDX_CAP, 0, 1,
147 sizeof (uint8_t), MAC_PROP_PERM_RW},
148
149 {"adv_40gfdx_cap", MAC_PROP_EN_40GFDX_CAP, 0, 1,
150 sizeof (uint8_t), MAC_PROP_PERM_RW},
151
152 {"adv_10gfdx_cap", MAC_PROP_EN_10GFDX_CAP, 0, 1,
153 sizeof (uint8_t), MAC_PROP_PERM_RW},
154
155 {"adv_1000fdx_cap", MAC_PROP_EN_1000FDX_CAP, 0, 1,
156 sizeof (uint8_t), MAC_PROP_PERM_RW},
157
158 {"adv_1000hdx_cap", MAC_PROP_EN_1000HDX_CAP, 0, 1,
159 sizeof (uint8_t), MAC_PROP_PERM_RW},
160
161 {"adv_100fdx_cap", MAC_PROP_EN_100FDX_CAP, 0, 1,
162 sizeof (uint8_t), MAC_PROP_PERM_RW},
163
164 {"adv_100hdx_cap", MAC_PROP_EN_100HDX_CAP, 0, 1,
165 sizeof (uint8_t), MAC_PROP_PERM_RW},
166
167 {"adv_10fdx_cap", MAC_PROP_EN_10FDX_CAP, 0, 1,
168 sizeof (uint8_t), MAC_PROP_PERM_RW},
169
170 {"adv_10hdx_cap", MAC_PROP_EN_10HDX_CAP, 0, 1,
171 sizeof (uint8_t), MAC_PROP_PERM_RW},
172
173 {"adv_100T4_cap", MAC_PROP_EN_100T4_CAP, 0, 1,
174 sizeof (uint8_t), MAC_PROP_PERM_READ},
175
176 {"link_status", MAC_STAT_LINK_UP, 0, 1,
177 sizeof (long), MAC_PROP_FLAGS_RK},
178
179 {"link_speed", MAC_PROP_SPEED, 0, LONG_MAX,
180 sizeof (uint64_t), MAC_PROP_PERM_READ},
181
182 {"link_duplex", MAC_PROP_DUPLEX, 0, 2,
183 sizeof (link_duplex_t), MAC_PROP_PERM_READ},
184
185 {"autoneg_cap", ETHER_STAT_CAP_AUTONEG, 0, 1,
186 sizeof (long), MAC_PROP_FLAGS_RK},
187
188 {"pause_cap", ETHER_STAT_CAP_PAUSE, 0, 1,
189 sizeof (long), MAC_PROP_FLAGS_RK},
190
191 {"asym_pause_cap", ETHER_STAT_CAP_ASMPAUSE, 0, 1,
192 sizeof (long), MAC_PROP_FLAGS_RK},
193
194 {"5000fdx_cap", ETHER_STAT_CAP_5000FDX, 0, 1,
195 sizeof (long), MAC_PROP_FLAGS_RK},
196
197 {"2500fdx_cap", ETHER_STAT_CAP_2500FDX, 0, 1,
198 sizeof (long), MAC_PROP_FLAGS_RK},
199
200 {"100gfdx_cap", ETHER_STAT_CAP_100GFDX, 0, 1,
201 sizeof (long), MAC_PROP_FLAGS_RK},
202
203 {"40gfdx_cap", ETHER_STAT_CAP_40GFDX, 0, 1,
204 sizeof (long), MAC_PROP_FLAGS_RK},
205
206 {"10gfdx_cap", ETHER_STAT_CAP_10GFDX, 0, 1,
207 sizeof (long), MAC_PROP_FLAGS_RK},
208
209 {"1000fdx_cap", ETHER_STAT_CAP_1000FDX, 0, 1,
210 sizeof (long), MAC_PROP_FLAGS_RK},
211
212 {"1000hdx_cap", ETHER_STAT_CAP_1000HDX, 0, 1,
213 sizeof (long), MAC_PROP_FLAGS_RK},
214
215 {"100T4_cap", ETHER_STAT_CAP_100T4, 0, 1,
216 sizeof (long), MAC_PROP_FLAGS_RK},
217
218 {"100fdx_cap", ETHER_STAT_CAP_100FDX, 0, 1,
219 sizeof (long), MAC_PROP_FLAGS_RK},
220
221 {"100hdx_cap", ETHER_STAT_CAP_100HDX, 0, 1,
222 sizeof (long), MAC_PROP_FLAGS_RK},
223
224 {"10fdx_cap", ETHER_STAT_CAP_10FDX, 0, 1,
225 sizeof (long), MAC_PROP_FLAGS_RK},
226
227 {"10hdx_cap", ETHER_STAT_CAP_10HDX, 0, 1,
228 sizeof (long), MAC_PROP_FLAGS_RK},
229
230 {"lp_autoneg_cap", ETHER_STAT_LP_CAP_AUTONEG, 0, 1,
231 sizeof (long), MAC_PROP_FLAGS_RK},
232
233 {"lp_pause_cap", ETHER_STAT_LP_CAP_PAUSE, 0, 1,
234 sizeof (long), MAC_PROP_FLAGS_RK},
235
236 {"lp_asym_pause_cap", ETHER_STAT_LP_CAP_ASMPAUSE, 0, 1,
237 sizeof (long), MAC_PROP_FLAGS_RK},
238
239 {"lp_5000fdx_cap", ETHER_STAT_LP_CAP_5000FDX, 0, 1,
240 sizeof (long), MAC_PROP_FLAGS_RK},
241
242 {"lp_2500fdx_cap", ETHER_STAT_LP_CAP_2500FDX, 0, 1,
243 sizeof (long), MAC_PROP_FLAGS_RK},
244
245 {"lp_100gfdx_cap", ETHER_STAT_LP_CAP_100GFDX, 0, 1,
246 sizeof (long), MAC_PROP_FLAGS_RK},
247
248 {"lp_40gfdx_cap", ETHER_STAT_LP_CAP_40GFDX, 0, 1,
249 sizeof (long), MAC_PROP_FLAGS_RK},
250
251 {"lp_10gfdx_cap", ETHER_STAT_LP_CAP_10GFDX, 0, 1,
252 sizeof (long), MAC_PROP_FLAGS_RK},
253
254 {"lp_1000hdx_cap", ETHER_STAT_LP_CAP_1000HDX, 0, 1,
255 sizeof (long), MAC_PROP_FLAGS_RK},
256
257 {"lp_1000fdx_cap", ETHER_STAT_LP_CAP_1000FDX, 0, 1,
258 sizeof (long), MAC_PROP_FLAGS_RK},
259
260 {"lp_100T4_cap", ETHER_STAT_LP_CAP_100T4, 0, 1,
261 sizeof (long), MAC_PROP_FLAGS_RK},
262
263 {"lp_100fdx_cap", ETHER_STAT_LP_CAP_100FDX, 0, 1,
264 sizeof (long), MAC_PROP_FLAGS_RK},
265
266 {"lp_100hdx_cap", ETHER_STAT_LP_CAP_100HDX, 0, 1,
267 sizeof (long), MAC_PROP_FLAGS_RK},
268
269 {"lp_10fdx_cap", ETHER_STAT_LP_CAP_10FDX, 0, 1,
270 sizeof (long), MAC_PROP_FLAGS_RK},
271
272 {"lp_10hdx_cap", ETHER_STAT_LP_CAP_10HDX, 0, 1,
273 sizeof (long), MAC_PROP_FLAGS_RK},
274
275 {"link_autoneg", ETHER_STAT_LINK_AUTONEG, 0, 1,
276 sizeof (long), MAC_PROP_FLAGS_RK}
277
278 };
279
280
281 int
282 _init(void)
283 {
284 mactype_register_t *mtrp;
285 int err;
286
287 if ((mtrp = mactype_alloc(MACTYPE_VERSION)) == NULL)
288 return (ENOTSUP);
289 mtrp->mtr_ident = MAC_PLUGIN_IDENT_ETHER;
290 mtrp->mtr_ops = &mac_ether_type_ops;
291 mtrp->mtr_mactype = DL_ETHER;
292 mtrp->mtr_nativetype = DL_ETHER;
293 mtrp->mtr_addrlen = ETHERADDRL;
294 mtrp->mtr_brdcst_addr = ether_brdcst;
295 mtrp->mtr_stats = ether_stats;
|
110 { ETHER_STAT_LP_CAP_100HDX, "lp_cap_100hdx", KSTAT_DATA_UINT32, 0 },
111 { ETHER_STAT_LP_CAP_10FDX, "lp_cap_10fdx", KSTAT_DATA_UINT32, 0 },
112 { ETHER_STAT_LP_CAP_10HDX, "lp_cap_10hdx", KSTAT_DATA_UINT32, 0 },
113 { ETHER_STAT_LP_CAP_ASMPAUSE, "lp_cap_asmpause", KSTAT_DATA_UINT32, 0 },
114 { ETHER_STAT_LP_CAP_PAUSE, "lp_cap_pause", KSTAT_DATA_UINT32, 0 },
115 { ETHER_STAT_LP_CAP_AUTONEG, "lp_cap_autoneg", KSTAT_DATA_UINT32, 0 },
116 { ETHER_STAT_LP_REMFAULT, "lp_rem_fault", KSTAT_DATA_UINT32, 0 },
117 { ETHER_STAT_LINK_ASMPAUSE, "link_asmpause", KSTAT_DATA_UINT32, 0 },
118 { ETHER_STAT_LINK_PAUSE, "link_pause", KSTAT_DATA_UINT32, 0 },
119 { ETHER_STAT_LINK_AUTONEG, "link_autoneg", KSTAT_DATA_UINT32, 0 },
120 { ETHER_STAT_LINK_DUPLEX, "link_duplex", KSTAT_DATA_UINT32, 0 }
121 };
122
123 static struct modlmisc mac_ether_modlmisc = {
124 &mod_miscops,
125 "Ethernet MAC plugin"
126 };
127
128 static struct modlinkage mac_ether_modlinkage = {
129 MODREV_1,
130 { &mac_ether_modlmisc,
131 NULL }
132 };
133
134 static mactype_ops_t mac_ether_type_ops;
135
136 static mac_ndd_mapping_t mac_ether_mapping[] = {
137 {"adv_autoneg_cap", .mp_prop_id = MAC_PROP_AUTONEG, 0, 1,
138 sizeof (uint8_t), MAC_PROP_PERM_RW},
139
140 {"adv_5000fdx_cap", .mp_prop_id = MAC_PROP_EN_5000FDX_CAP, 0, 1,
141 sizeof (uint8_t), MAC_PROP_PERM_RW},
142
143 {"adv_2500fdx_cap", .mp_prop_id = MAC_PROP_EN_2500FDX_CAP, 0, 1,
144 sizeof (uint8_t), MAC_PROP_PERM_RW},
145
146 {"adv_100gfdx_cap", .mp_prop_id = MAC_PROP_EN_100GFDX_CAP, 0, 1,
147 sizeof (uint8_t), MAC_PROP_PERM_RW},
148
149 {"adv_40gfdx_cap", .mp_prop_id = MAC_PROP_EN_40GFDX_CAP, 0, 1,
150 sizeof (uint8_t), MAC_PROP_PERM_RW},
151
152 {"adv_10gfdx_cap", .mp_prop_id = MAC_PROP_EN_10GFDX_CAP, 0, 1,
153 sizeof (uint8_t), MAC_PROP_PERM_RW},
154
155 {"adv_1000fdx_cap", .mp_prop_id = MAC_PROP_EN_1000FDX_CAP, 0, 1,
156 sizeof (uint8_t), MAC_PROP_PERM_RW},
157
158 {"adv_1000hdx_cap", .mp_prop_id = MAC_PROP_EN_1000HDX_CAP, 0, 1,
159 sizeof (uint8_t), MAC_PROP_PERM_RW},
160
161 {"adv_100fdx_cap", .mp_prop_id = MAC_PROP_EN_100FDX_CAP, 0, 1,
162 sizeof (uint8_t), MAC_PROP_PERM_RW},
163
164 {"adv_100hdx_cap", .mp_prop_id = MAC_PROP_EN_100HDX_CAP, 0, 1,
165 sizeof (uint8_t), MAC_PROP_PERM_RW},
166
167 {"adv_10fdx_cap", .mp_prop_id = MAC_PROP_EN_10FDX_CAP, 0, 1,
168 sizeof (uint8_t), MAC_PROP_PERM_RW},
169
170 {"adv_10hdx_cap", .mp_prop_id = MAC_PROP_EN_10HDX_CAP, 0, 1,
171 sizeof (uint8_t), MAC_PROP_PERM_RW},
172
173 {"adv_100T4_cap", .mp_prop_id = MAC_PROP_EN_100T4_CAP, 0, 1,
174 sizeof (uint8_t), MAC_PROP_PERM_READ},
175
176 {"link_status", .mp_prop_id = MAC_STAT_LINK_UP, 0, 1,
177 sizeof (long), MAC_PROP_FLAGS_RK},
178
179 {"link_speed", .mp_prop_id = MAC_PROP_SPEED, 0, LONG_MAX,
180 sizeof (uint64_t), MAC_PROP_PERM_READ},
181
182 {"link_duplex", .mp_prop_id = MAC_PROP_DUPLEX, 0, 2,
183 sizeof (link_duplex_t), MAC_PROP_PERM_READ},
184
185 {"autoneg_cap", .mp_prop_id = ETHER_STAT_CAP_AUTONEG, 0, 1,
186 sizeof (long), MAC_PROP_FLAGS_RK},
187
188 {"pause_cap", .mp_prop_id = ETHER_STAT_CAP_PAUSE, 0, 1,
189 sizeof (long), MAC_PROP_FLAGS_RK},
190
191 {"asym_pause_cap", .mp_prop_id = ETHER_STAT_CAP_ASMPAUSE, 0, 1,
192 sizeof (long), MAC_PROP_FLAGS_RK},
193
194 {"5000fdx_cap", .mp_prop_id = ETHER_STAT_CAP_5000FDX, 0, 1,
195 sizeof (long), MAC_PROP_FLAGS_RK},
196
197 {"2500fdx_cap", .mp_prop_id = ETHER_STAT_CAP_2500FDX, 0, 1,
198 sizeof (long), MAC_PROP_FLAGS_RK},
199
200 {"100gfdx_cap", .mp_prop_id = ETHER_STAT_CAP_100GFDX, 0, 1,
201 sizeof (long), MAC_PROP_FLAGS_RK},
202
203 {"40gfdx_cap", .mp_prop_id = ETHER_STAT_CAP_40GFDX, 0, 1,
204 sizeof (long), MAC_PROP_FLAGS_RK},
205
206 {"10gfdx_cap", .mp_prop_id = ETHER_STAT_CAP_10GFDX, 0, 1,
207 sizeof (long), MAC_PROP_FLAGS_RK},
208
209 {"1000fdx_cap", .mp_prop_id = ETHER_STAT_CAP_1000FDX, 0, 1,
210 sizeof (long), MAC_PROP_FLAGS_RK},
211
212 {"1000hdx_cap", .mp_prop_id = ETHER_STAT_CAP_1000HDX, 0, 1,
213 sizeof (long), MAC_PROP_FLAGS_RK},
214
215 {"100T4_cap", .mp_prop_id = ETHER_STAT_CAP_100T4, 0, 1,
216 sizeof (long), MAC_PROP_FLAGS_RK},
217
218 {"100fdx_cap", .mp_prop_id = ETHER_STAT_CAP_100FDX, 0, 1,
219 sizeof (long), MAC_PROP_FLAGS_RK},
220
221 {"100hdx_cap", .mp_prop_id = ETHER_STAT_CAP_100HDX, 0, 1,
222 sizeof (long), MAC_PROP_FLAGS_RK},
223
224 {"10fdx_cap", .mp_prop_id = ETHER_STAT_CAP_10FDX, 0, 1,
225 sizeof (long), MAC_PROP_FLAGS_RK},
226
227 {"10hdx_cap", .mp_prop_id = ETHER_STAT_CAP_10HDX, 0, 1,
228 sizeof (long), MAC_PROP_FLAGS_RK},
229
230 {"lp_autoneg_cap", .mp_prop_id = ETHER_STAT_LP_CAP_AUTONEG, 0, 1,
231 sizeof (long), MAC_PROP_FLAGS_RK},
232
233 {"lp_pause_cap", .mp_prop_id = ETHER_STAT_LP_CAP_PAUSE, 0, 1,
234 sizeof (long), MAC_PROP_FLAGS_RK},
235
236 {"lp_asym_pause_cap", .mp_prop_id = ETHER_STAT_LP_CAP_ASMPAUSE, 0, 1,
237 sizeof (long), MAC_PROP_FLAGS_RK},
238
239 {"lp_5000fdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_5000FDX, 0, 1,
240 sizeof (long), MAC_PROP_FLAGS_RK},
241
242 {"lp_2500fdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_2500FDX, 0, 1,
243 sizeof (long), MAC_PROP_FLAGS_RK},
244
245 {"lp_100gfdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_100GFDX, 0, 1,
246 sizeof (long), MAC_PROP_FLAGS_RK},
247
248 {"lp_40gfdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_40GFDX, 0, 1,
249 sizeof (long), MAC_PROP_FLAGS_RK},
250
251 {"lp_10gfdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_10GFDX, 0, 1,
252 sizeof (long), MAC_PROP_FLAGS_RK},
253
254 {"lp_1000hdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_1000HDX, 0, 1,
255 sizeof (long), MAC_PROP_FLAGS_RK},
256
257 {"lp_1000fdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_1000FDX, 0, 1,
258 sizeof (long), MAC_PROP_FLAGS_RK},
259
260 {"lp_100T4_cap", .mp_prop_id = ETHER_STAT_LP_CAP_100T4, 0, 1,
261 sizeof (long), MAC_PROP_FLAGS_RK},
262
263 {"lp_100fdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_100FDX, 0, 1,
264 sizeof (long), MAC_PROP_FLAGS_RK},
265
266 {"lp_100hdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_100HDX, 0, 1,
267 sizeof (long), MAC_PROP_FLAGS_RK},
268
269 {"lp_10fdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_10FDX, 0, 1,
270 sizeof (long), MAC_PROP_FLAGS_RK},
271
272 {"lp_10hdx_cap", .mp_prop_id = ETHER_STAT_LP_CAP_10HDX, 0, 1,
273 sizeof (long), MAC_PROP_FLAGS_RK},
274
275 {"link_autoneg", .mp_prop_id = ETHER_STAT_LINK_AUTONEG, 0, 1,
276 sizeof (long), MAC_PROP_FLAGS_RK}
277
278 };
279
280
281 int
282 _init(void)
283 {
284 mactype_register_t *mtrp;
285 int err;
286
287 if ((mtrp = mactype_alloc(MACTYPE_VERSION)) == NULL)
288 return (ENOTSUP);
289 mtrp->mtr_ident = MAC_PLUGIN_IDENT_ETHER;
290 mtrp->mtr_ops = &mac_ether_type_ops;
291 mtrp->mtr_mactype = DL_ETHER;
292 mtrp->mtr_nativetype = DL_ETHER;
293 mtrp->mtr_addrlen = ETHERADDRL;
294 mtrp->mtr_brdcst_addr = ether_brdcst;
295 mtrp->mtr_stats = ether_stats;
|