| 3510 | } |
| 3511 | |
| 3512 | static int ena_xstats_get_by_id(struct rte_eth_dev *dev, |
| 3513 | const uint64_t *ids, |
| 3514 | uint64_t *values, |
| 3515 | unsigned int n) |
| 3516 | { |
| 3517 | struct ena_adapter *adapter = dev->data->dev_private; |
| 3518 | uint64_t id; |
| 3519 | uint64_t rx_entries, tx_entries; |
| 3520 | unsigned int i; |
| 3521 | int qid; |
| 3522 | int valid = 0; |
| 3523 | bool were_metrics_copied = false; |
| 3524 | bool was_srd_info_copied = false; |
| 3525 | uint64_t metrics_stats[ENA_MAX_CUSTOMER_METRICS]; |
| 3526 | struct ena_stats_srd srd_info = {0}; |
| 3527 | |
| 3528 | for (i = 0; i < n; ++i) { |
| 3529 | id = ids[i]; |
| 3530 | /* Check if id belongs to global statistics */ |
| 3531 | if (id < ENA_STATS_ARRAY_GLOBAL) { |
| 3532 | values[i] = *((uint64_t *)&adapter->dev_stats + id); |
| 3533 | ++valid; |
| 3534 | continue; |
| 3535 | } |
| 3536 | |
| 3537 | /* Check if id belongs to ENI statistics */ |
| 3538 | id -= ENA_STATS_ARRAY_GLOBAL; |
| 3539 | if (id < adapter->metrics_num) { |
| 3540 | /* Avoid reading metrics multiple times in a single |
| 3541 | * function call, as it requires communication with the |
| 3542 | * admin queue. |
| 3543 | */ |
| 3544 | if (!were_metrics_copied) { |
| 3545 | were_metrics_copied = true; |
| 3546 | ena_copy_customer_metrics(adapter, |
| 3547 | metrics_stats, |
| 3548 | adapter->metrics_num); |
| 3549 | } |
| 3550 | |
| 3551 | values[i] = *((uint64_t *)&metrics_stats + id); |
| 3552 | ++valid; |
| 3553 | continue; |
| 3554 | } |
| 3555 | |
| 3556 | /* Check if id belongs to SRD info statistics */ |
| 3557 | id -= adapter->metrics_num; |
| 3558 | |
| 3559 | if (id < ENA_STATS_ARRAY_ENA_SRD) { |
| 3560 | /* |
| 3561 | * Avoid reading srd info multiple times in a single |
| 3562 | * function call, as it requires communication with the |
| 3563 | * admin queue. |
| 3564 | */ |
| 3565 | if (!was_srd_info_copied) { |
| 3566 | was_srd_info_copied = true; |
| 3567 | ena_copy_ena_srd_info(adapter, &srd_info); |
| 3568 | } |
| 3569 | values[i] = *((uint64_t *)&adapter->srd_stats + id); |
nothing calls this directly
no test coverage detected