On Wed, 11 Mar 2026 00:26:53 +0100
Vincent Jardin <[email protected]> wrote:
> +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_mlx5_pp_rate_table_query, 26.07)
> +int rte_pmd_mlx5_pp_rate_table_query(uint16_t port_id,
> + struct rte_pmd_mlx5_pp_rate_table_info
> *info)
> +{
> + struct rte_eth_dev *dev;
> + struct mlx5_priv *priv;
> + uint16_t used = 0;
> + uint16_t *seen;
> + unsigned int i;
> +
> + if (info == NULL)
> + return -EINVAL;
Prefer NULL checks in ethdev layer
> + if (!rte_eth_dev_is_valid_port(port_id))
> + return -ENODEV;
Ditto checks for port_id should be at ethdev
> + dev = &rte_eth_devices[port_id];
> + priv = dev->data->dev_private;
> + if (!priv->sh->cdev->config.hca_attr.qos.packet_pacing) {
> + rte_errno = ENOTSUP;
> + return -ENOTSUP;
> + }
> + info->total = priv->sh->cdev->config.hca_attr.qos
> + .packet_pacing_rate_table_size;
Since DPDK allows 100 character lines now, don't need line break
> + if (priv->txqs == NULL || priv->txqs_n == 0) {
> + info->used = 0;
> + return 0;
> + }
> + seen = mlx5_malloc(MLX5_MEM_ZERO, priv->txqs_n * sizeof(*seen),
> + 0, SOCKET_ID_ANY);
Since this only has lifetime of this function, use calloc() instead
since that avoids using huge page memory, and compiler and other checkers
"know about" malloc functions and engage more checks.