aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/NsimUtil.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2021-06-23 08:42:51 +0000
committerTibor Frank <tifrank@cisco.com>2021-06-23 08:44:06 +0000
commit45944d29fdc589d637bd089af544a412069a9935 (patch)
treea4c193ce985cf843557c8372faf8d31b0dd57dc5 /resources/libraries/python/NsimUtil.py
parent7f5f25fbe5f7d7ce01f6a2ffe745cf15a15e6a41 (diff)
Report: Fix typo in spec
Change-Id: I19ad258be06e30bfb31e9178d646be93ac733cec Signed-off-by: Tibor Frank <tifrank@cisco.com> (cherry picked from commit 7f5983bd43f65b60a749d7a76a9e4b9d069a1363)
Diffstat (limited to 'resources/libraries/python/NsimUtil.py')
0 files changed, 0 insertions, 0 deletions
fname)) return -1; - MKSTR(path, "%s/device/net/%s/%s", priv->ctx->device->ibdev_path, - ifname, entry); - - file = fopen(path, "rb"); + if (priv_is_ib_cntr(entry)) { + MKSTR(path, "%s/ports/1/hw_counters/%s", + priv->ctx->device->ibdev_path, entry); + file = fopen(path, "rb"); + } else { + MKSTR(path, "%s/device/net/%s/%s", + priv->ctx->device->ibdev_path, ifname, entry); + file = fopen(path, "rb"); + } if (file == NULL) return -1; ret = fread(buf, 1, size, file); @@ -469,6 +491,30 @@ struct priv * } /** + * Read device counter from sysfs. + * + * @param priv + * Pointer to private structure. + * @param name + * Counter name. + * @param[out] cntr + * Counter output buffer. + * + * @return + * 0 on success, -1 on failure and errno is set. + */ +int +priv_get_cntr_sysfs(struct priv *priv, const char *name, uint64_t *cntr) +{ + unsigned long ulong_ctr; + + if (priv_get_sysfs_ulong(priv, name, &ulong_ctr) == -1) + return -1; + *cntr = ulong_ctr; + return 0; +} + +/** * Set device MTU. * * @param priv diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index 20c957e..a48ebea 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -125,6 +125,10 @@ struct mlx5_counter_ctrl { .dpdk_name = "tx_errors_phy", .ctr_name = "tx_errors_phy", }, + { + .dpdk_name = "rx_out_of_buffer", + .ctr_name = "out_of_buffer", + }, }; static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init); @@ -159,9 +163,15 @@ struct mlx5_counter_ctrl { WARN("unable to read statistic values from device"); return -1; } - for (i = 0; i != xstats_n; ++i) - stats[i] = (uint64_t) - et_stats->data[xstats_ctrl->dev_table_idx[i]]; + for (i = 0; i != xstats_n; ++i) { + if (priv_is_ib_cntr(mlx5_counters_init[i].ctr_name)) + priv_get_cntr_sysfs(priv, + mlx5_counters_init[i].ctr_name, + &stats[i]); + else + stats[i] = (uint64_t) + et_stats->data[xstats_ctrl->dev_table_idx[i]]; + } return 0; } @@ -233,6 +243,8 @@ struct mlx5_counter_ctrl { } } for (j = 0; j != xstats_n; ++j) { + if (priv_is_ib_cntr(mlx5_counters_init[i].ctr_name)) + continue; if (xstats_ctrl->dev_table_idx[j] >= dev_stats_n) { WARN("counter \"%s\" is not recognized", mlx5_counters_init[j].dpdk_name);