373 * tavor_kstat_cntr_update()
374 * Context: Called from the kstat context
375 */
376 static int
377 tavor_kstat_cntr_update(kstat_t *ksp, int rw)
378 {
379 tavor_state_t *state;
380 tavor_ks_mask_t *ib_perf;
381 tavor_ks_info_t *ksi;
382 struct kstat_named *data;
383 uint64_t offset, pcr;
384 uint32_t pic0, pic1, tmp;
385 uint32_t shift, mask, oldval;
386 uint_t numports, indx;
387
388 TAVOR_TNF_ENTER(tavor_kstat_cntr_update);
389
390 /*
391 * Extract the Tavor softstate pointer, kstat data, pointer to the
392 * kstat info structure, and pointer to the tki_ib_perfcnt[] array
393 * from the input parameters. Note: For warlock purposes, these
394 * parameters are all accessed only in this routine and are,
395 * therefore, protected by the lock used by the kstat framework.
396 */
397 state = ksp->ks_private;
398 data = (struct kstat_named *)(ksp->ks_data);
399 ksi = state->ts_ks_info;
400 ib_perf = &ksi->tki_ib_perfcnt[0];
401 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ksi))
402 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*data))
403 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ib_perf))
404
405 /*
406 * Depending on whether we are reading the "pic" counters or
407 * writing the "pcr" control register, we need to handle and
408 * fill in the kstat data appropriately.
409 *
410 * If this is a write to the "pcr", then extract the value from
411 * the kstat data and store it in the kstat info structure.
412 *
413 * Otherwise, if this is a read of the "pic" counter(s), then
414 * extract the register offset, size, and mask values from the
415 * ib_perf[] array. Then read the corresponding register and store
416 * it into the kstat data. Note: We only read/fill in pic1 if more
417 * than one port is configured.
418 */
419 numports = state->ts_cfg_profile->cp_num_ports;
420 if (rw == KSTAT_WRITE) {
421 /* Update the stored "pcr" value */
422 ksi->tki_pcr = data[0].value.ui64;
423 TAVOR_TNF_EXIT(tavor_kstat_cntr_update);
|
373 * tavor_kstat_cntr_update()
374 * Context: Called from the kstat context
375 */
376 static int
377 tavor_kstat_cntr_update(kstat_t *ksp, int rw)
378 {
379 tavor_state_t *state;
380 tavor_ks_mask_t *ib_perf;
381 tavor_ks_info_t *ksi;
382 struct kstat_named *data;
383 uint64_t offset, pcr;
384 uint32_t pic0, pic1, tmp;
385 uint32_t shift, mask, oldval;
386 uint_t numports, indx;
387
388 TAVOR_TNF_ENTER(tavor_kstat_cntr_update);
389
390 /*
391 * Extract the Tavor softstate pointer, kstat data, pointer to the
392 * kstat info structure, and pointer to the tki_ib_perfcnt[] array
393 * from the input parameters.
394 */
395 state = ksp->ks_private;
396 data = (struct kstat_named *)(ksp->ks_data);
397 ksi = state->ts_ks_info;
398 ib_perf = &ksi->tki_ib_perfcnt[0];
399
400 /*
401 * Depending on whether we are reading the "pic" counters or
402 * writing the "pcr" control register, we need to handle and
403 * fill in the kstat data appropriately.
404 *
405 * If this is a write to the "pcr", then extract the value from
406 * the kstat data and store it in the kstat info structure.
407 *
408 * Otherwise, if this is a read of the "pic" counter(s), then
409 * extract the register offset, size, and mask values from the
410 * ib_perf[] array. Then read the corresponding register and store
411 * it into the kstat data. Note: We only read/fill in pic1 if more
412 * than one port is configured.
413 */
414 numports = state->ts_cfg_profile->cp_num_ports;
415 if (rw == KSTAT_WRITE) {
416 /* Update the stored "pcr" value */
417 ksi->tki_pcr = data[0].value.ui64;
418 TAVOR_TNF_EXIT(tavor_kstat_cntr_update);
|