333 * hermon_kstat_cntr_update()
334 * Context: Called from the kstat context
335 */
336 static int
337 hermon_kstat_cntr_update(kstat_t *ksp, int rw)
338 {
339 hermon_state_t *state;
340 hermon_ks_mask_t *ib_perf;
341 hermon_ks_info_t *ksi;
342 struct kstat_named *data;
343 uint64_t pcr;
344 uint32_t tmp;
345 uint32_t oldval;
346 uint_t numports, indx;
347 int status;
348 hermon_hw_sm_perfcntr_t sm_perfcntr;
349
350 /*
351 * Extract the Hermon softstate pointer, kstat data, pointer to the
352 * kstat info structure, and pointer to the hki_ib_perfcnt[] array
353 * from the input parameters. Note: For warlock purposes, these
354 * parameters are all accessed only in this routine and are,
355 * therefore, protected by the lock used by the kstat framework.
356 */
357 state = ksp->ks_private;
358 data = (struct kstat_named *)(ksp->ks_data);
359 ksi = state->hs_ks_info;
360 ib_perf = &ksi->hki_ib_perfcnt[0];
361 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ksi))
362 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
363 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ib_perf))
364
365 /*
366 * Depending on whether we are reading the "pic" counters or
367 * writing the "pcr" control register, we need to handle and
368 * fill in the kstat data appropriately.
369 *
370 * If this is a write to the "pcr", then extract the value from
371 * the kstat data and store it in the kstat info structure.
372 *
373 * Otherwise, if this is a read of the "pic" counter(s), then
374 * extract the register offset, size, and mask values from the
375 * ib_perf[] array. Then read the corresponding register and store
376 * it into the kstat data. Note: We only read/fill in pic1 if more
377 * than one port is configured.
378 */
379 numports = state->hs_cfg_profile->cp_num_ports;
380 if (rw == KSTAT_WRITE) {
381 /* Update the stored "pcr" value */
382 ksi->hki_pcr = data[0].value.ui64;
383 return (0);
|
333 * hermon_kstat_cntr_update()
334 * Context: Called from the kstat context
335 */
336 static int
337 hermon_kstat_cntr_update(kstat_t *ksp, int rw)
338 {
339 hermon_state_t *state;
340 hermon_ks_mask_t *ib_perf;
341 hermon_ks_info_t *ksi;
342 struct kstat_named *data;
343 uint64_t pcr;
344 uint32_t tmp;
345 uint32_t oldval;
346 uint_t numports, indx;
347 int status;
348 hermon_hw_sm_perfcntr_t sm_perfcntr;
349
350 /*
351 * Extract the Hermon softstate pointer, kstat data, pointer to the
352 * kstat info structure, and pointer to the hki_ib_perfcnt[] array
353 * from the input parameters.
354 */
355 state = ksp->ks_private;
356 data = (struct kstat_named *)(ksp->ks_data);
357 ksi = state->hs_ks_info;
358 ib_perf = &ksi->hki_ib_perfcnt[0];
359
360 /*
361 * Depending on whether we are reading the "pic" counters or
362 * writing the "pcr" control register, we need to handle and
363 * fill in the kstat data appropriately.
364 *
365 * If this is a write to the "pcr", then extract the value from
366 * the kstat data and store it in the kstat info structure.
367 *
368 * Otherwise, if this is a read of the "pic" counter(s), then
369 * extract the register offset, size, and mask values from the
370 * ib_perf[] array. Then read the corresponding register and store
371 * it into the kstat data. Note: We only read/fill in pic1 if more
372 * than one port is configured.
373 */
374 numports = state->hs_cfg_profile->cp_num_ports;
375 if (rw == KSTAT_WRITE) {
376 /* Update the stored "pcr" value */
377 ksi->hki_pcr = data[0].value.ui64;
378 return (0);
|