netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Saeed Mahameed <saeed@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Itamar Gozlan <igozlan@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>
Subject: Re: [net-next V2 11/15] net/mlx5: HWS, added memory management handling
Date: Fri, 6 Sep 2024 19:23:56 +0100	[thread overview]
Message-ID: <20240906182356.GK2097826@kernel.org> (raw)
In-Reply-To: <20240905062752.10883-12-saeed@kernel.org>

On Wed, Sep 04, 2024 at 11:27:46PM -0700, Saeed Mahameed wrote:
> From: Yevgeny Kliteynik <kliteyn@nvidia.com>
> 
> Added object pools and buddy allocator functionality.
> 
> Reviewed-by: Itamar Gozlan <igozlan@nvidia.com>
> Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
> Reviewed-by: Mark Bloch <mbloch@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

...

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_pool.c

...

> +static struct mlx5hws_pool_resource *
> +hws_pool_create_one_resource(struct mlx5hws_pool *pool, u32 log_range,
> +			     u32 fw_ft_type)
> +{
> +	struct mlx5hws_cmd_ste_create_attr ste_attr;
> +	struct mlx5hws_cmd_stc_create_attr stc_attr;
> +	struct mlx5hws_pool_resource *resource;
> +	u32 obj_id;
> +	int ret;
> +
> +	resource = kzalloc(sizeof(*resource), GFP_KERNEL);
> +	if (!resource)
> +		return NULL;
> +
> +	switch (pool->type) {
> +	case MLX5HWS_POOL_TYPE_STE:
> +		ste_attr.log_obj_range = log_range;
> +		ste_attr.table_type = fw_ft_type;
> +		ret = mlx5hws_cmd_ste_create(pool->ctx->mdev, &ste_attr, &obj_id);
> +		break;
> +	case MLX5HWS_POOL_TYPE_STC:
> +		stc_attr.log_obj_range = log_range;
> +		stc_attr.table_type = fw_ft_type;
> +		ret = mlx5hws_cmd_stc_create(pool->ctx->mdev, &stc_attr, &obj_id);
> +		break;
> +	default:

Hi Saeed and Yevgeny,

Another minor nit from my side (I think this is the last one).

If we get here, then ret will be used uninitialised by the if condition below.

Also flagged by Smatch.

> +		break;
> +	}
> +
> +	if (ret) {
> +		mlx5hws_err(pool->ctx, "Failed to allocate resource objects\n");
> +		goto free_resource;
> +	}
> +
> +	resource->pool = pool;
> +	resource->range = 1 << log_range;
> +	resource->base_id = obj_id;
> +
> +	return resource;
> +
> +free_resource:
> +	kfree(resource);
> +	return NULL;
> +}

  reply	other threads:[~2024-09-06 18:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  6:27 [pull request][net-next V2 00/15] mlx5 updates 2024-09-02 Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 01/15] net/mlx5: Added missing mlx5_ifc definition for HW Steering Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 02/15] net/mlx5: Added missing definitions in preparation " Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 03/15] net/mlx5: HWS, added actions handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 04/15] net/mlx5: HWS, added tables handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 05/15] net/mlx5: HWS, added rules handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 06/15] net/mlx5: HWS, added definers handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 07/15] net/mlx5: HWS, added matchers functionality Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 08/15] net/mlx5: HWS, added FW commands handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 09/15] net/mlx5: HWS, added modify header pattern and args handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 10/15] net/mlx5: HWS, added vport handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 11/15] net/mlx5: HWS, added memory management handling Saeed Mahameed
2024-09-06 18:23   ` Simon Horman [this message]
2024-09-06 19:26     ` Yevgeny Kliteynik
2024-09-05  6:27 ` [net-next V2 12/15] net/mlx5: HWS, added backward-compatible API handling Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 13/15] net/mlx5: HWS, added debug dump and internal headers Saeed Mahameed
2024-09-05  6:27 ` [net-next V2 14/15] net/mlx5: HWS, added send engine and context handling Saeed Mahameed
2024-09-06 18:21   ` Simon Horman
2024-09-06 19:25     ` Yevgeny Kliteynik
2024-09-05  6:27 ` [net-next V2 15/15] net/mlx5: HWS, added API and enabled HWS support Saeed Mahameed
2024-09-06  5:10 ` [pull request][net-next V2 00/15] mlx5 updates 2024-09-02 Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240906182356.GK2097826@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=igozlan@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeed@kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).