mlx5_devx_cmd_query_parse_samples;
mlx5_devx_cmd_query_virtio_q_counters; # WINDOWS_NO_EXPORT
mlx5_devx_cmd_query_virtq;
- mlx5_devx_cmd_queue_counter_alloc; # WINDOWS_NO_EXPORT
- mlx5_devx_cmd_queue_counter_query; # WINDOWS_NO_EXPORT
+ mlx5_devx_cmd_queue_counter_alloc;
+ mlx5_devx_cmd_queue_counter_query;
mlx5_devx_cmd_register_read;
mlx5_devx_cmd_register_write;
mlx5_devx_cmd_wq_query; # WINDOWS_NO_EXPORT
void
mlx5_os_stats_init(struct rte_eth_dev *dev)
{
- RTE_SET_USED(dev);
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_stats_ctrl *stats_ctrl = &priv->stats_ctrl;
+ int ret;
+
+ /* Copy to base at first time. */
+ ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
+ if (ret)
+ DRV_LOG(ERR, "port %u cannot read device counters: %s",
+ dev->data->port_id, strerror(rte_errno));
+ stats_ctrl->imissed = 0;
}
/**
},
};
+static void
+mlx5_queue_counter_id_prepare(struct rte_eth_dev *dev)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ void *ctx = priv->sh->cdev->ctx;
+
+ priv->q_counters = mlx5_devx_cmd_queue_counter_alloc(ctx);
+ if (!priv->q_counters) {
+ DRV_LOG(ERR, "Port %d queue counter object cannot be created "
+ "by DevX - imissed counter will be unavailable",
+ dev->data->port_id);
+ return;
+ }
+ priv->counter_set_id = priv->q_counters->id;
+}
+
/**
* Initialize shared data between primary and secondary process.
*
goto error;
}
mlx5_flow_counter_mode_config(eth_dev);
+ mlx5_queue_counter_id_prepare(eth_dev);
return eth_dev;
error:
if (priv) {
* @param[out] stat
* Pointer to read statistic value.
* @return
- * 0 on success and stat is valud, 1 if failed to read the value
+ * 0 on success and stat is valid, non-zero if failed to read the value
+ * or counter is not supported.
* rte_errno is set.
*
*/
mlx5_os_read_dev_stat(struct mlx5_priv *priv, const char *ctr_name,
uint64_t *stat)
{
- RTE_SET_USED(priv);
- RTE_SET_USED(ctr_name);
- RTE_SET_USED(stat);
- DRV_LOG(WARNING, "%s: is not supported", __func__);
+ if (priv->q_counters != NULL && strcmp(ctr_name, "out_of_buffer") == 0)
+ return mlx5_devx_cmd_queue_counter_query
+ (priv->q_counters, 0, (uint32_t *)stat);
+ DRV_LOG(WARNING, "%s: is not supported for the %s counter",
+ __func__, ctr_name);
return -ENOTSUP;
}