All of lore.kernel.org
 help / color / mirror / Atom feed
From: Moshe Shemesh <moshe@nvidia.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Tariq Toukan <tariqt@nvidia.com>
Cc: <netdev@vger.kernel.org>, Saeed Mahameed <saeedm@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>,
	Yevgeny Kliteynik <kliteyn@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>
Subject: Re: [PATCH net-next V3 03/11] net/mlx5: fs, add counter object to flow destination
Date: Thu, 19 Dec 2024 14:06:43 +0200	[thread overview]
Message-ID: <8fd507a8-c0bd-42fc-96b7-ea49e1faf63b@nvidia.com> (raw)
In-Reply-To: <015ad3e1-9526-4d40-af4e-ff852d9dd117@intel.com>



On 12/19/2024 11:00 AM, Przemek Kitszel wrote:
> 
> On 12/18/24 16:09, Tariq Toukan wrote:
>> From: Moshe Shemesh <moshe@nvidia.com>
>>
>> Currently mlx5_flow_destination includes counter_id which is assigned in
>> case we use flow counter on the flow steering rule. However, counter_id
>> is not enough data in case of using HW Steering. Thus, have mlx5_fc
>> object as part of mlx5_flow_destination instead of counter_id and assign
>> it where needed.
>>
>> In case counter_id is received from user space, create a local counter
>> object to represent it.
>>
>> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
>> Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
>> Reviewed-by: Mark Bloch <mbloch@nvidia.com>
>> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
>> ---
>>   drivers/infiniband/hw/mlx5/fs.c               | 37 +++++++++----
>>   .../mellanox/mlx5/core/diag/fs_tracepoint.h   |  2 +-
>>   .../mellanox/mlx5/core/en_accel/ipsec_fs.c    | 20 +++----
>>   .../net/ethernet/mellanox/mlx5/core/en_tc.c   |  2 +-
>>   .../mellanox/mlx5/core/esw/acl/egress_lgcy.c  |  2 +-
>>   .../mellanox/mlx5/core/esw/acl/ingress_lgcy.c |  2 +-
>>   .../ethernet/mellanox/mlx5/core/esw/bridge.c  | 20 +++----
>>   .../mellanox/mlx5/core/eswitch_offloads.c     |  2 +-
>>   .../net/ethernet/mellanox/mlx5/core/fs_cmd.c  |  2 +-
>>   .../net/ethernet/mellanox/mlx5/core/fs_core.c |  1 +
>>   .../ethernet/mellanox/mlx5/core/fs_counters.c | 52 +++++++++++++++++++
>>   .../mellanox/mlx5/core/lib/macsec_fs.c        |  8 +--
>>   .../mellanox/mlx5/core/steering/sws/fs_dr.c   |  2 +-
>>   drivers/vdpa/mlx5/net/mlx5_vnet.c             |  4 +-
>>   include/linux/mlx5/fs.h                       |  4 +-
>>   15 files changed, 116 insertions(+), 44 deletions(-)
> 
> 
> 
>> +/**
>> + * mlx5_fc_local_create - Allocate mlx5_fc struct for a counter which
>> + * was already acquired using its counter id and bulk data.
>> + *
>> + * @counter_id: counter acquired counter id
>> + * @offset: counter offset from bulk base
>> + * @bulk_size: counter's bulk size as was allocated
>> + *
>> + * Return: Pointer to mlx5_fc on success, ERR_PTR otherwise.
>> + */
>> +struct mlx5_fc *
>> +mlx5_fc_local_create(u32 counter_id, u32 offset, u32 bulk_size)
>> +{
>> +     struct mlx5_fc_bulk *bulk;
>> +     struct mlx5_fc *counter;
>> +
>> +     counter = kzalloc(sizeof(*counter), GFP_KERNEL);
>> +     if (!counter)
>> +             return ERR_PTR(-ENOMEM);
>> +     bulk = kzalloc(sizeof(*bulk), GFP_KERNEL);
>> +     if (!bulk) {
>> +             kfree(counter);
>> +             return ERR_PTR(-ENOMEM);
>> +     }
>> +
> 
> I would expect to have following line added here:
> 
>         counter->bulk = bulk;
> 
> otherwise that is memleak?

right, will fix.
> 
>> +     counter->type = MLX5_FC_TYPE_LOCAL;
>> +     counter->id = counter_id;
>> +     bulk->base_id = counter_id - offset;
>> +     bulk->bulk_len = bulk_size;
>> +     return counter;
>> +}
>> +EXPORT_SYMBOL(mlx5_fc_local_create);
>> +
>> +void mlx5_fc_local_destroy(struct mlx5_fc *counter)
>> +{
>> +     if (!counter || counter->type != MLX5_FC_TYPE_LOCAL)
>> +             return;
>> +
>> +     kfree(counter->bulk);
> 
> in the whole patch there is no "->bulk ="
> you didn't catched that as it's fine to kfree(NULL) of course

right, thanks!

> 
>> +     kfree(counter);
>> +}
>> +EXPORT_SYMBOL(mlx5_fc_local_destroy);

  reply	other threads:[~2024-12-19 12:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 15:09 [PATCH net-next V3 00/11] mlx5 misc changes 2024-12-18 Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 01/11] net/mlx5: LAG, Refactor lag logic Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 02/11] net/mlx5: LAG, Support LAG over Multi-Host NICs Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 03/11] net/mlx5: fs, add counter object to flow destination Tariq Toukan
2024-12-19  9:00   ` Przemek Kitszel
2024-12-19 12:06     ` Moshe Shemesh [this message]
2024-12-18 15:09 ` [PATCH net-next V3 04/11] net/mlx5: fs, add mlx5_fs_pool API Tariq Toukan
2024-12-19  9:17   ` Przemek Kitszel
2024-12-19 12:30     ` Moshe Shemesh
2024-12-19 15:12       ` Jakub Kicinski
2024-12-19 15:36       ` Przemek Kitszel
2024-12-18 15:09 ` [PATCH net-next V3 05/11] net/mlx5: fs, retry insertion to hash table on EBUSY Tariq Toukan
2024-12-19 10:03   ` Przemek Kitszel
2024-12-18 15:09 ` [PATCH net-next V3 06/11] net/mlx5: HWS, no need to expose mlx5hws_send_queues_open/close Tariq Toukan
2024-12-19 10:11   ` Przemek Kitszel
2024-12-18 15:09 ` [PATCH net-next V3 07/11] net/mlx5: HWS, do not initialize native API queues Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 08/11] net/mlx5: DR, expand SWS STE callbacks and consolidate common structs Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 09/11] net/mlx5: DR, add support for ConnectX-8 steering Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 10/11] net/mlx5: Remove PTM support log message Tariq Toukan
2024-12-18 15:09 ` [PATCH net-next V3 11/11] net/mlx5: fs, Add support for RDMA RX steering over IB link layer Tariq Toukan

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=8fd507a8-c0bd-42fc-96b7-ea49e1faf63b@nvidia.com \
    --to=moshe@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@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=przemyslaw.kitszel@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.