Subject: Re: [net-next V2 14/15] net/mlx5: HWS, added send engine and context handling

From: Simon Horman <[email-masked]>
Date: Fri, 6 Sep 2024 19:21:19 +0100

On Wed, Sep 04, 2024 at 11:27:49PM -0700, Saeed Mahameed wrote:
> From: Yevgeny Kliteynik <[email-masked]>
> 
> Added implementation of send engine and handling of HWS context.
> 
> Reviewed-by: Itamar Gozlan <[email-masked]>
> Signed-off-by: Yevgeny Kliteynik <[email-masked]>
> Signed-off-by: Saeed Mahameed <[email-masked]>

...

> +static int hws_send_ring_open_cq(struct mlx5_core_dev *mdev,
> +				 struct mlx5hws_send_engine *queue,
> +				 int numa_node,
> +				 struct mlx5hws_send_ring_cq *cq)
> +{
> +	void *cqc_data;
> +	int err;
> +
> +	cqc_data = kvzalloc(MLX5_ST_SZ_BYTES(cqc), GFP_KERNEL);
> +	if (!cqc_data)
> +		return -ENOMEM;
> +
> +	MLX5_SET(cqc, cqc_data, uar_page, mdev->priv.uar->index);
> +	MLX5_SET(cqc, cqc_data, cqe_sz, queue->num_entries);
> +	MLX5_SET(cqc, cqc_data, log_cq_size, ilog2(queue->num_entries));
> +
> +	err = hws_send_ring_alloc_cq(mdev, numa_node, queue, cqc_data, cq);
> +	if (err) {
> +		goto err_out;
> +		return err;

Hi Saeed, Yevgeny, all,

A minor nit: the line above cannot be reached.

Flagged by Smatch.

> +	}
> +
> +	err = hws_send_ring_create_cq(mdev, queue, cqc_data, cq);
> +	if (err)
> +		goto err_free_cq;
> +
> +	kvfree(cqc_data);
> +
> +	return 0;
> +
> +err_free_cq:
> +	mlx5_wq_destroy(&cq->wq_ctrl);
> +err_out:
> +	kvfree(cqc_data);
> +	return err;
> +}

...